use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class ChangedLinesPublisherTest method setUp.
@Before
public void setUp() {
writer = new ScannerReportWriter(temp.getRoot());
when(branchConfiguration.isPullRequest()).thenReturn(true);
when(scmConfiguration.isDisabled()).thenReturn(false);
when(scmConfiguration.provider()).thenReturn(provider);
when(branchConfiguration.targetBranchName()).thenReturn(TARGET_BRANCH);
when(project.getBaseDir()).thenReturn(BASE_DIR);
}
use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class MetadataPublisherTest method write_revision_id.
@Test
public void write_revision_id() throws Exception {
String revisionId = "some-sha1";
when(scmRevision.get()).thenReturn(Optional.of(revisionId));
File outputDir = temp.newFolder();
underTest.publish(new ScannerReportWriter(outputDir));
ScannerReportReader reader = new ScannerReportReader(outputDir);
ScannerReport.Metadata metadata = reader.readMetadata();
assertThat(metadata.getScmRevisionId()).isEqualTo(revisionId);
}
use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class MetadataPublisherTest method write_not_analysed_file_counts.
@Test
public void write_not_analysed_file_counts() throws Exception {
when(componentStore.getNotAnalysedFilesByLanguage()).thenReturn(ImmutableMap.of("c", 10, "cpp", 20));
File outputDir = temp.newFolder();
ScannerReportWriter writer = new ScannerReportWriter(outputDir);
underTest.publish(writer);
ScannerReportReader reader = new ScannerReportReader(outputDir);
ScannerReport.Metadata metadata = reader.readMetadata();
assertThat(metadata.getNotAnalyzedFilesByLanguageMap()).contains(entry("c", 10), entry("cpp", 20));
}
use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class CpdExecutorTest method setUp.
@Before
public void setUp() throws IOException {
File outputDir = temp.newFolder();
baseDir = temp.newFolder();
when(publisher.getWriter()).thenReturn(new ScannerReportWriter(outputDir));
DefaultInputProject project = TestInputFileBuilder.newDefaultInputProject("foo", baseDir);
componentStore = new InputComponentStore(mock(BranchConfiguration.class), sonarRuntime);
executor = new CpdExecutor(settings, index, publisher, componentStore, executorService);
reader = new ScannerReportReader(outputDir);
batchComponent1 = createComponent("src/Foo.php", 5);
batchComponent2 = createComponent("src/Foo2.php", 5);
batchComponent3 = createComponent("src/Foo3.php", 5);
}
Aggregations