From dae4decaa165461d2cdd52860e93fc6c2dd0f493 Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Tue, 3 Sep 2019 15:59:11 +0200 Subject: SQSCANNER-61 Consider 'project.settings' if set using SONARQUBE_SCANNER_PARAMS --- src/test/java/org/sonarsource/scanner/cli/ConfTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/test') diff --git a/src/test/java/org/sonarsource/scanner/cli/ConfTest.java b/src/test/java/org/sonarsource/scanner/cli/ConfTest.java index a966b50..1dbbbec 100644 --- a/src/test/java/org/sonarsource/scanner/cli/ConfTest.java +++ b/src/test/java/org/sonarsource/scanner/cli/ConfTest.java @@ -316,4 +316,19 @@ public class ConfTest { properties = conf.properties(); assertThat(properties.get("sonar.prop")).isEqualTo("expected"); } + + // SQSCANNER-61 + @Test + public void should_load_project_settings_using_env() throws Exception { + Path home = Paths.get(getClass().getResource("ConfTest/shouldOverrideProjectSettingsPath/").toURI()); + args.setProperty("project.home", home.toAbsolutePath().toString()); + + Properties properties = conf.properties(); + assertThat(properties.get("sonar.prop")).isEqualTo("default"); + + env.put("SONARQUBE_SCANNER_PARAMS", "{\"project.settings\" : \"" + home.resolve("conf/sq-project.properties").toAbsolutePath().toString() + "\"}"); + + properties = conf.properties(); + assertThat(properties.get("sonar.prop")).isEqualTo("expected"); + } } -- cgit v1.2.3