use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class MetadataPublisherTest method write_project_organization.
@Test
public void write_project_organization() throws Exception {
settings.setProperty(CoreProperties.PROJECT_ORGANIZATION_PROPERTY, "SonarSource");
File outputDir = temp.newFolder();
ScannerReportWriter writer = new ScannerReportWriter(outputDir);
underTest.publish(writer);
ScannerReportReader reader = new ScannerReportReader(outputDir);
ScannerReport.Metadata metadata = reader.readMetadata();
assertThat(metadata.getOrganizationKey()).isEqualTo("SonarSource");
}
use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class SourcePublisherTest method prepare.
@Before
public void prepare() throws IOException {
File baseDir = temp.newFolder();
sourceFile = new File(baseDir, "src/Foo.php");
String moduleKey = "foo";
inputFile = new TestInputFileBuilder(moduleKey, "src/Foo.php").setLines(5).setModuleBaseDir(baseDir.toPath()).setCharset(StandardCharsets.ISO_8859_1).build();
InputComponentStore componentStore = new InputComponentStore(new PathResolver());
componentStore.put(TestInputFileBuilder.newDefaultInputModule(moduleKey, baseDir));
componentStore.put(inputFile);
publisher = new SourcePublisher(componentStore);
File outputDir = temp.newFolder();
writer = new ScannerReportWriter(outputDir);
}
use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class AnalysisContextReportPublisherTest method dumpServerSideGlobalProps.
@Test
public void dumpServerSideGlobalProps() throws Exception {
logTester.setLevel(LoggerLevel.DEBUG);
ScannerReportWriter writer = new ScannerReportWriter(temp.newFolder());
when(globalSettings.getServerSideSettings()).thenReturn(ImmutableMap.of(COM_FOO, "bar", SONAR_SKIP, "true"));
publisher.init(writer);
String content = FileUtils.readFileToString(writer.getFileStructure().analysisLog());
assertThat(content).containsOnlyOnce(COM_FOO);
assertThat(content).containsOnlyOnce(SONAR_SKIP);
}
use of org.sonar.scanner.protocol.output.ScannerReportWriter in project sonarqube by SonarSource.
the class AnalysisContextReportPublisherTest method shouldNotDumpSQPropsInSystemProps.
@Test
public void shouldNotDumpSQPropsInSystemProps() throws Exception {
logTester.setLevel(LoggerLevel.DEBUG);
ScannerReportWriter writer = new ScannerReportWriter(temp.newFolder());
Properties props = new Properties();
props.setProperty(COM_FOO, "bar");
props.setProperty(SONAR_SKIP, "true");
when(system2.properties()).thenReturn(props);
publisher.init(writer);
String content = FileUtils.readFileToString(writer.getFileStructure().analysisLog());
assertThat(content).containsOnlyOnce(COM_FOO);
assertThat(content).doesNotContain(SONAR_SKIP);
publisher.dumpModuleSettings(ProjectDefinition.create().setProperty("sonar.projectKey", "foo").setProperty(COM_FOO, "bar").setProperty(SONAR_SKIP, "true"));
content = FileUtils.readFileToString(writer.getFileStructure().analysisLog());
assertThat(content).containsOnlyOnce(COM_FOO);
assertThat(content).containsOnlyOnce(SONAR_SKIP);
}
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());
}
Aggregations