diff options
author | Michal Duda <michal.duda@sonarsource.com> | 2019-06-18 13:38:43 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2019-06-28 08:45:00 +0200 |
commit | 9c3628f7f4d5745c010cb2f958129495fdcda632 (patch) | |
tree | 701eebb80614c357f7a8e59028976ddebf971e72 /sonar-scanner-engine/src/test/java/org/sonar/scanner/report | |
parent | 09295555aac7866169029b83e96ecc93df08baec (diff) | |
download | sonarqube-9c3628f7f4d5745c010cb2f958129495fdcda632.tar.gz sonarqube-9c3628f7f4d5745c010cb2f958129495fdcda632.zip |
SONAR-12186 Fix SSF-78
Diffstat (limited to 'sonar-scanner-engine/src/test/java/org/sonar/scanner/report')
-rw-r--r-- | sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java | 67 |
1 files changed, 2 insertions, 65 deletions
diff --git a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java index 961a7dc5053..b883a266c3a 100644 --- a/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java +++ b/sonar-scanner-engine/src/test/java/org/sonar/scanner/report/AnalysisContextReportPublisherTest.java @@ -151,8 +151,7 @@ public class AnalysisContextReportPublisherTest { publisher.init(writer); List<String> lines = FileUtils.readLines(writer.getFileStructure().analysisLog(), StandardCharsets.UTF_8); - assertThat(lines).containsExactly("Environment variables:", - "System properties:", + assertThat(lines).containsExactly( "SonarQube plugins:", "Global server settings:", "Project server settings:", @@ -163,67 +162,6 @@ public class AnalysisContextReportPublisherTest { } @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); - DefaultInputModule rootModule = new DefaultInputModule(ProjectDefinition.create() - .setBaseDir(temp.newFolder()) - .setWorkDir(temp.newFolder()) - .setProperty("sonar.projectKey", "foo") - .setProperty(COM_FOO, "bar") - .setProperty(SONAR_SKIP, "true")); - when(store.allModules()).thenReturn(singletonList(rootModule)); - when(hierarchy.root()).thenReturn(rootModule); - - publisher.init(writer); - - List<String> lines = FileUtils.readLines(writer.getFileStructure().analysisLog(), StandardCharsets.UTF_8); - assertThat(lines).containsExactly("Environment variables:", - "System properties:", - " - com.foo=bar", - "SonarQube plugins:", - "Global server settings:", - "Project server settings:", - "Project scanner properties:", - " - sonar.projectKey=foo", - " - sonar.skip=true"); - } - - @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); - DefaultInputModule rootModule = new DefaultInputModule(ProjectDefinition.create() - .setBaseDir(temp.newFolder()) - .setWorkDir(temp.newFolder()) - .setProperty("sonar.projectKey", "foo") - .setProperty("env." + FOO, "BAR")); - when(store.allModules()).thenReturn(singletonList(rootModule)); - when(hierarchy.root()).thenReturn(rootModule); - publisher.init(writer); - - String content = FileUtils.readFileToString(writer.getFileStructure().analysisLog(), StandardCharsets.UTF_8); - assertThat(content).containsOnlyOnce(FOO); - assertThat(content).containsOnlyOnce(BIZ); - assertThat(content).containsSubsequence(BIZ, FOO); - - - content = FileUtils.readFileToString(writer.getFileStructure().analysisLog(), StandardCharsets.UTF_8); - assertThat(content).containsOnlyOnce(FOO); - assertThat(content).containsOnlyOnce(BIZ); - assertThat(content).doesNotContain("env." + FOO); - } - - @Test public void shouldNotDumpSensitiveModuleProperties() throws Exception { ScannerReportWriter writer = new ScannerReportWriter(temp.newFolder()); DefaultInputModule rootModule = new DefaultInputModule(ProjectDefinition.create() @@ -314,8 +252,7 @@ public class AnalysisContextReportPublisherTest { publisher.init(writer); List<String> lines = FileUtils.readLines(writer.getFileStructure().analysisLog(), StandardCharsets.UTF_8); - assertThat(lines).containsExactly("Environment variables:", - "System properties:", + assertThat(lines).containsExactly( "SonarQube plugins:", "Global server settings:", "Project server settings:", |