aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api-impl
diff options
context:
space:
mode:
authorMichal Duda <michal.duda@sonarsource.com>2020-04-08 19:38:02 +0200
committersonartech <sonartech@sonarsource.com>2020-04-14 20:04:04 +0000
commitd662d0c0269e1a12da0c3ecdb8f9d33b765ccdcc (patch)
tree7ec6d738cc8516bf42f42552a64f1cdbb0307a37 /sonar-plugin-api-impl
parentab6328a769fbe531464fc9dd77cc64efc72ba390 (diff)
downloadsonarqube-d662d0c0269e1a12da0c3ecdb8f9d33b765ccdcc.tar.gz
sonarqube-d662d0c0269e1a12da0c3ecdb8f9d33b765ccdcc.zip
SONAR-13272 fix issue with setting some properties through env variables
Diffstat (limited to 'sonar-plugin-api-impl')
-rw-r--r--sonar-plugin-api-impl/src/main/java/org/sonar/api/config/internal/MapSettings.java3
-rw-r--r--sonar-plugin-api-impl/src/test/java/org/sonar/api/config/internal/MapSettingsTest.java7
2 files changed, 6 insertions, 4 deletions
diff --git a/sonar-plugin-api-impl/src/main/java/org/sonar/api/config/internal/MapSettings.java b/sonar-plugin-api-impl/src/main/java/org/sonar/api/config/internal/MapSettings.java
index 764eef2812d..4ca59b06733 100644
--- a/sonar-plugin-api-impl/src/main/java/org/sonar/api/config/internal/MapSettings.java
+++ b/sonar-plugin-api-impl/src/main/java/org/sonar/api/config/internal/MapSettings.java
@@ -24,6 +24,7 @@ import java.util.Map;
import java.util.Optional;
import org.sonar.api.config.Configuration;
import org.sonar.api.config.PropertyDefinitions;
+import org.sonar.api.utils.System2;
import static java.util.Collections.unmodifiableMap;
import static java.util.Objects.requireNonNull;
@@ -42,7 +43,7 @@ public class MapSettings extends Settings {
private final ConfigurationBridge configurationBridge;
public MapSettings() {
- this(new PropertyDefinitions());
+ this(new PropertyDefinitions(System2.INSTANCE));
}
public MapSettings(PropertyDefinitions definitions) {
diff --git a/sonar-plugin-api-impl/src/test/java/org/sonar/api/config/internal/MapSettingsTest.java b/sonar-plugin-api-impl/src/test/java/org/sonar/api/config/internal/MapSettingsTest.java
index 89845b01dbb..6cf2c86c021 100644
--- a/sonar-plugin-api-impl/src/test/java/org/sonar/api/config/internal/MapSettingsTest.java
+++ b/sonar-plugin-api-impl/src/test/java/org/sonar/api/config/internal/MapSettingsTest.java
@@ -41,6 +41,7 @@ import org.sonar.api.PropertyType;
import org.sonar.api.config.PropertyDefinition;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.api.utils.DateUtils;
+import org.sonar.api.utils.System2;
import static java.util.Collections.singletonList;
import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
@@ -75,7 +76,7 @@ public class MapSettingsTest {
@Before
public void init_definitions() {
- definitions = new PropertyDefinitions();
+ definitions = new PropertyDefinitions(System2.INSTANCE);
definitions.addComponent(Init.class);
}
@@ -129,7 +130,7 @@ public class MapSettingsTest {
public void set_property_string_throws_NPE_if_key_is_null() {
String key = randomAlphanumeric(3);
- Settings underTest = new MapSettings(new PropertyDefinitions(singletonList(PropertyDefinition.builder(key).multiValues(true).build())));
+ Settings underTest = new MapSettings(new PropertyDefinitions(System2.INSTANCE, singletonList(PropertyDefinition.builder(key).multiValues(true).build())));
expectKeyNullNPE();
@@ -160,7 +161,7 @@ public class MapSettingsTest {
public void set_property_string_array_trims_key() {
String key = randomAlphanumeric(3);
- Settings underTest = new MapSettings(new PropertyDefinitions(singletonList(PropertyDefinition.builder(key).multiValues(true).build())));
+ Settings underTest = new MapSettings(new PropertyDefinitions(System2.INSTANCE, singletonList(PropertyDefinition.builder(key).multiValues(true).build())));
Random random = new Random();
String blankBefore = blank(random);