use of org.sonar.scanner.bootstrap.ScannerProperties in project sonarqube by SonarSource.
the class ProjectReactorBuilderTest method shouldInitWorkDirWithCustomRelativeFolder.
@Test
public void shouldInitWorkDirWithCustomRelativeFolder() {
Map<String, String> props = singletonMap("sonar.working.directory", ".foo");
ProjectReactorBuilder builder = new ProjectReactorBuilder(new ScannerProperties(props), mock(AnalysisWarnings.class));
File baseDir = new File("target/tmp/baseDir");
File workDir = builder.initRootProjectWorkDir(baseDir, props);
assertThat(workDir).isEqualTo(new File(baseDir, ".foo"));
}
use of org.sonar.scanner.bootstrap.ScannerProperties in project sonarqube by SonarSource.
the class ProjectReactorBuilderTest method shouldInitRootWorkDir.
@Test
public void shouldInitRootWorkDir() {
ProjectReactorBuilder builder = new ProjectReactorBuilder(new ScannerProperties(emptyMap()), mock(AnalysisWarnings.class));
File baseDir = new File("target/tmp/baseDir");
File workDir = builder.initRootProjectWorkDir(baseDir, emptyMap());
assertThat(workDir).isEqualTo(new File(baseDir, ".sonar"));
}
use of org.sonar.scanner.bootstrap.ScannerProperties in project sonarqube by SonarSource.
the class ScmRevisionImplTest method ignore_failure_if_scm_does_not_support_revisions.
@Test
public void ignore_failure_if_scm_does_not_support_revisions() {
CiConfiguration ciConfiguration = mock(CiConfiguration.class);
when(ciConfiguration.getScmRevision()).thenReturn(Optional.empty());
Map<String, String> scannerConfiguration = new HashMap<>();
ScmConfiguration scmConfiguration = mock(ScmConfiguration.class, RETURNS_DEEP_STUBS);
when(scmConfiguration.provider().revisionId(any())).thenThrow(new UnsupportedOperationException("BOOM"));
InputModuleHierarchy moduleHierarchy = mock(InputModuleHierarchy.class, RETURNS_DEEP_STUBS);
ScmRevisionImpl underTest = new ScmRevisionImpl(ciConfiguration, new ScannerProperties(scannerConfiguration), scmConfiguration, moduleHierarchy);
assertThat(underTest.get()).isEmpty();
}
use of org.sonar.scanner.bootstrap.ScannerProperties in project sonarqube by SonarSource.
the class ScmRevisionImplTest method testGet.
private Optional<String> testGet(@Nullable String cliValue, @Nullable String ciValue, @Nullable String scmValue) {
CiConfiguration ciConfiguration = mock(CiConfiguration.class);
when(ciConfiguration.getScmRevision()).thenReturn(Optional.ofNullable(ciValue));
Map<String, String> scannerConfiguration = new HashMap<>();
scannerConfiguration.put("sonar.scm.revision", cliValue);
ScmConfiguration scmConfiguration = mock(ScmConfiguration.class, RETURNS_DEEP_STUBS);
when(scmConfiguration.provider().revisionId(any())).thenReturn(scmValue);
InputModuleHierarchy moduleHierarchy = mock(InputModuleHierarchy.class, RETURNS_DEEP_STUBS);
ScmRevisionImpl underTest = new ScmRevisionImpl(ciConfiguration, new ScannerProperties(scannerConfiguration), scmConfiguration, moduleHierarchy);
return underTest.get();
}
use of org.sonar.scanner.bootstrap.ScannerProperties in project sonarqube by SonarSource.
the class ProjectReactorBuilderTest method shouldInitRootWorkDirWithCustomAbsoluteFolder.
@Test
public void shouldInitRootWorkDirWithCustomAbsoluteFolder() {
Map<String, String> props = singletonMap("sonar.working.directory", new File("src").getAbsolutePath());
ProjectReactorBuilder builder = new ProjectReactorBuilder(new ScannerProperties(props), mock(AnalysisWarnings.class));
File baseDir = new File("target/tmp/baseDir");
File workDir = builder.initRootProjectWorkDir(baseDir, props);
assertThat(workDir).isEqualTo(new File("src").getAbsoluteFile());
}
Aggregations