List of usage examples for org.apache.commons.lang SystemUtils IS_OS_WINDOWS
boolean IS_OS_WINDOWS
To view the source code for org.apache.commons.lang SystemUtils IS_OS_WINDOWS.
Click Source Link
Is true
if this is Windows.
The field will return false
if OS_NAME
is null
.
From source file:org.sonar.plugins.csharp.sarif.SarifParser10Test.java
@Test public void sarif_version_1_0_more_rules() throws IOException { new SarifParser10(getContents("v1_0_another.json")).parse(callback); if (SystemUtils.IS_OS_WINDOWS) { InOrder inOrder = inOrder(callback); inOrder.verify(callback).onIssue("S1186", "C:\\Program.cs", "Add a nested comment explaining why this method is empty, throw a \"NotSupportedException\" or complete the implementation.", 26);//from w w w . j a v a 2s. c om inOrder.verify(callback).onIssue("S1172", "C:\\Program.cs", "Remove this unused method parameter \"args\".", 26); inOrder.verify(callback).onIssue("S1118", "C:\\Program.cs", "Add a \"protected\" constructor or the \"static\" keyword to the class declaration.", 9); inOrder.verifyNoMoreInteractions(); } }
From source file:org.sonar.plugins.csharp.sarif.SarifParser10Test.java
@Test public void sarif_version_1_0_uri() throws IOException { new SarifParser10(getContents("v1_0_uri.json")).parse(callback); if (SystemUtils.IS_OS_WINDOWS) { InOrder inOrder = inOrder(callback); inOrder.verify(callback).onIssue("S1118", "nfs:///C:/Program.cs", "Add a \"protected\" constructor or the \"static\" keyword to the class declaration.", 9); inOrder.verifyNoMoreInteractions(); }//from w w w . j a v a2 s . c om }
From source file:org.sonar.plugins.csharp.sarif.SarifParser10Test.java
@Test public void sarif_version_1_0_supressed() throws IOException { new SarifParser10(getContents("v1_0_suppressed.json")).parse(callback); if (SystemUtils.IS_OS_WINDOWS) { InOrder inOrder = inOrder(callback); inOrder.verify(callback).onIssue("S1186", "C:\\Program.cs", "Add a nested comment explaining why this method is empty, throw a \"NotSupportedException\" or complete the implementation.", 26);/*from ww w . j a v a 2 s . c om*/ inOrder.verifyNoMoreInteractions(); } }
From source file:org.sonar.plugins.csharp.sarif.SarifParser10Test.java
@Test public void sarif_path_escaping() throws IOException { new SarifParser10(getContents("v1_0_escaping.json")).parse(callback); if (SystemUtils.IS_OS_WINDOWS) { InOrder inOrder = inOrder(callback); inOrder.verify(callback).onIssue("S107", "C:\\git\\Temp Folder SomeRandom!@#$%^&()\\csharp\\ConsoleApplication1\\Program.cs", "Method has 3 parameters, which is greater than the 2 authorized.", 52); inOrder.verifyNoMoreInteractions(); }// w w w .j av a 2s.co m }
From source file:org.sonar.plugins.fxcop.FxCopSensor.java
@Override public boolean shouldExecuteOnProject(Project project) { boolean shouldExecute; if (!hasFilesToAnalyze()) { shouldExecute = false;/*from www.ja v a2s. c om*/ } else if (profile.getActiveRulesByRepository(fxCopConf.repositoryKey()).isEmpty()) { LOG.info("All FxCop rules are disabled, skipping its execution."); shouldExecute = false; } else if (!SystemUtils.IS_OS_WINDOWS) { shouldExecute = false; } else { shouldExecute = true; } return shouldExecute; }
From source file:org.sonar.plugins.fxcop.FxCopSensorTest.java
@Test public void shouldExecuteOnProject() { Assume.assumeTrue(SystemUtils.IS_OS_WINDOWS); Settings settings = mock(Settings.class); RulesProfile profile = mock(RulesProfile.class); DefaultFileSystem fs = new DefaultFileSystem(); ResourcePerspectives perspectives = mock(ResourcePerspectives.class); Project project = mock(Project.class); FxCopSensor sensor = new FxCopSensor(new FxCopConfiguration("foo", "foo-fxcop", "", "", "", "", "", "", ""), settings, profile, fs, perspectives); assertThat(sensor.shouldExecuteOnProject(project)).isFalse(); fs.add(new DefaultInputFile("bar").setAbsolutePath("bar").setLanguage("bar")); assertThat(sensor.shouldExecuteOnProject(project)).isFalse(); fs.add(new DefaultInputFile("foo").setAbsolutePath("foo").setLanguage("foo")); assertThat(sensor.shouldExecuteOnProject(project)).isFalse(); when(profile.getActiveRulesByRepository("foo-fxcop")).thenReturn(ImmutableList.<ActiveRule>of()); assertThat(sensor.shouldExecuteOnProject(project)).isFalse(); when(profile.getActiveRulesByRepository("foo-fxcop")).thenReturn(ImmutableList.of(mock(ActiveRule.class))); assertThat(sensor.shouldExecuteOnProject(project)).isTrue(); }
From source file:org.sonar.plugins.php.core.configuration.PhpPluginAbstractConfiguration.java
/** * Checks if running os is windows. * * @return true, if os is windows */ protected boolean isOsWindows() { return SystemUtils.IS_OS_WINDOWS; }
From source file:org.sonar.plugins.plsqltoad.PlSqlToadSensorTest.java
private File getInfiniteLoopExecutableFile() { String extension;// w w w . j a v a2s .co m if (SystemUtils.IS_OS_WINDOWS) { extension = "bat"; } else { extension = "sh"; } return new File("src/test/resources/PlSqlToadSensor/forever." + extension); }
From source file:org.sonar.plugins.python.pylint.PylintArgumentsTest.java
private Command command(String toOutput) { if (SystemUtils.IS_OS_WINDOWS) { return Command.create("cmd.exe").addArguments(new String[] { "/c", "echo", toOutput }); }//from www . j a va 2 s . co m return Command.create("echo").addArgument(toOutput); }
From source file:org.sonar.runner.api.OsTest.java
@Test public void testIsWindows() throws Exception { assertThat(new Os().isWindows()).isEqualTo(SystemUtils.IS_OS_WINDOWS); }