org.sonar.api.utils.System2 Java Examples

The following examples show how to use org.sonar.api.utils.System2. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TsLintExecutorImplTest.java    From SonarTsPlugin with MIT License 6 votes vote down vote up
@Before
public void setUp() throws Exception {
    this.system = mock(System2.class);
    this.tempFolder = mock(TempFolder.class);

    this.tempOutputFile = mock(File.class);
    when(this.tempOutputFile.getAbsolutePath()).thenReturn("path/to/temp");
    when(this.tempFolder.newFile()).thenReturn(this.tempOutputFile);

    this.commandExecutor = mock(CommandExecutor.class);

    this.executorImpl = spy(new TsLintExecutorImpl(this.system, this.tempFolder));
    when(this.executorImpl.createExecutor()).thenReturn(this.commandExecutor);
    doReturn(mock(BufferedReader.class)).when(this.executorImpl).getBufferedReaderForFile(any(File.class));

    // Setup a default config, which each method will mutate as required
    this.config = new TsLintExecutorConfig();
    this.config.setPathToNode("node");
    this.config.setPathToTsLint("path/to/tslint");
    this.config.setConfigFile("path/to/config");
    this.config.setRulesDir("path/to/rules");
    this.config.setTimeoutMs(40000);
}
 
Example #2
Source File: RubocopSensorTest.java    From sonar-ruby-plugin with MIT License 5 votes vote down vote up
@Test
public void testDescribe() {
    RubocopExecutor executor = new RubocopExecutor(System2.INSTANCE, new JUnitTempFolder());

    RubocopSensor sensor = new RubocopSensor(new PathResolver(), executor, new RubocopParser());

    DefaultSensorDescriptor descriptor = new DefaultSensorDescriptor();
    sensor.describe(descriptor);

    assertThat(descriptor.name()).isEqualTo("Linting sensor for Ruby files");
    assertThat(descriptor.languages()).containsExactly(Ruby.LANGUAGE_KEY);
}
 
Example #3
Source File: ScannerPullRequestPropertySensor.java    From sonarqube-community-branch-plugin with GNU General Public License v3.0 4 votes vote down vote up
public ScannerPullRequestPropertySensor(System2 system2) {
    super();
    this.system2 = system2;
}
 
Example #4
Source File: CommunityBranchConfigurationLoader.java    From sonarqube-community-branch-plugin with GNU General Public License v3.0 4 votes vote down vote up
public CommunityBranchConfigurationLoader(System2 system2, AnalysisWarnings analysisWarnings) {
    super();
    this.system2 = system2;
    this.analysisWarnings = analysisWarnings;
}
 
Example #5
Source File: RubocopExecutor.java    From sonar-ruby-plugin with MIT License 4 votes vote down vote up
public RubocopExecutor(System2 system, TempFolder tempFolder) {
    this.mustQuoteSpaceContainingPaths = system.isOsWindows();
    this.tempFolder = tempFolder;
}
 
Example #6
Source File: TsLintExecutorImpl.java    From SonarTsPlugin with MIT License 4 votes vote down vote up
public TsLintExecutorImpl(System2 system, TempFolder tempFolder) {
    this.mustQuoteSpaceContainingPaths = system.isOsWindows();
    this.tempFolder = tempFolder;
}