use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class AnalysisWarningsPublisherTest method publish_warnings.
@Test
public void publish_warnings() throws IOException {
File outputDir = temp.newFolder();
ScannerReportWriter writer = new ScannerReportWriter(outputDir);
String warning1 = "warning 1";
String warning2 = "warning 2";
analysisWarnings.addUnique(warning1);
analysisWarnings.addUnique(warning1);
analysisWarnings.addUnique(warning2);
underTest.publish(writer);
ScannerReportReader reader = new ScannerReportReader(outputDir);
List<ScannerReport.AnalysisWarning> warnings = Lists.newArrayList(reader.readAnalysisWarnings());
assertThat(warnings).extracting(ScannerReport.AnalysisWarning::getText).containsExactly(warning1, warning2);
}
use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class BatchReportReaderImplTest method setUp.
@Before
public void setUp() {
BatchReportDirectoryHolder holder = new ImmutableBatchReportDirectoryHolder(tempFolder.newDir());
underTest = new BatchReportReaderImpl(holder);
writer = new ScannerReportWriter(holder.getDirectory());
}
use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class ReportIteratorTest method setUp.
@Before
public void setUp() throws Exception {
File dir = temp.newFolder();
ScannerReportWriter writer = new ScannerReportWriter(dir);
writer.writeComponentCoverage(1, newArrayList(ScannerReport.LineCoverage.newBuilder().setLine(1).build()));
file = new FileStructure(dir).fileFor(FileStructure.Domain.COVERAGES, 1);
}
use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class ReportPublisher method start.
@Override
public void start() {
reportDir = new File(projectReactor.getRoot().getWorkDir(), "batch-report");
writer = new ScannerReportWriter(reportDir);
contextPublisher.init(writer);
if (!analysisMode.isIssues() && !analysisMode.isMediumTest()) {
String publicUrl = server.getPublicRootUrl();
if (HttpUrl.parse(publicUrl) == null) {
throw MessageException.of("Failed to parse public URL set in SonarQube server: " + publicUrl);
}
}
}
use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class AnalysisContextReportPublisherTest method shouldNotDumpEnvTwice.
@Test
public void shouldNotDumpEnvTwice() throws Exception {
logTester.setLevel(LoggerLevel.DEBUG);
ScannerReportWriter writer = new ScannerReportWriter(temp.newFolder());
Map<String, String> env = new HashMap<>();
env.put(FOO, "BAR");
env.put(BIZ, "BAZ");
when(system2.envVariables()).thenReturn(env);
publisher.init(writer);
String content = FileUtils.readFileToString(writer.getFileStructure().analysisLog());
assertThat(content).containsOnlyOnce(FOO);
assertThat(content).containsOnlyOnce(BIZ);
assertThat(content).containsSequence(BIZ, FOO);
publisher.dumpModuleSettings(ProjectDefinition.create().setProperty("sonar.projectKey", "foo").setProperty("env." + FOO, "BAR"));
content = FileUtils.readFileToString(writer.getFileStructure().analysisLog());
assertThat(content).containsOnlyOnce(FOO);
assertThat(content).containsOnlyOnce(BIZ);
assertThat(content).doesNotContain("env." + FOO);
}
Aggregations