aboutsummaryrefslogtreecommitdiffstats
path: root/it/it-tests
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@sonarsource.com>2017-01-11 17:42:26 +0100
committerJulien Lancelot <julien.lancelot@sonarsource.com>2017-01-12 14:53:56 +0100
commitc0af11805a81ba7452569f5cc4ccafa013000b6e (patch)
treed8d456835d4580154881aafde8d5a5ec688c5a08 /it/it-tests
parent789de98954c5cd46398a172afe7edb8836e404d9 (diff)
downloadsonarqube-c0af11805a81ba7452569f5cc4ccafa013000b6e.tar.gz
sonarqube-c0af11805a81ba7452569f5cc4ccafa013000b6e.zip
SONAR-7300 Handle multi values in PUT|POST api/properties
Diffstat (limited to 'it/it-tests')
-rw-r--r--it/it-tests/src/test/java/it/settings/DeprecatedPropertiesWsTest.java24
1 files changed, 20 insertions, 4 deletions
diff --git a/it/it-tests/src/test/java/it/settings/DeprecatedPropertiesWsTest.java b/it/it-tests/src/test/java/it/settings/DeprecatedPropertiesWsTest.java
index 80deea8e407..a6d02dbf232 100644
--- a/it/it-tests/src/test/java/it/settings/DeprecatedPropertiesWsTest.java
+++ b/it/it-tests/src/test/java/it/settings/DeprecatedPropertiesWsTest.java
@@ -102,7 +102,7 @@ public class DeprecatedPropertiesWsTest {
}
private static void doResetSettings() {
- resetSettings(orchestrator, null, "some-property", "custom-property", "int", "multi", "boolean", "hidden", "not_defined", "setting.secured", "setting.license.secured", "list");
+ resetSettings(orchestrator, null, "some-property", "custom-property", "int", "multi", "boolean", "hidden", "not_defined", "setting.secured", "setting.license.secured", "list", "undefined");
resetSettings(orchestrator, PROJECT_KEY, PROJECT_SETTING_KEY, "sonar.coverage.exclusions", "project.setting");
}
@@ -120,11 +120,11 @@ public class DeprecatedPropertiesWsTest {
@Test
public void get_multi_values() throws Exception {
- setProperty("multi", asList("value1", "value2"), null);
+ setProperty("multi", asList("value1", "value2", "value,3"), null);
Properties.Property setting = getProperty("multi", null);
- assertThat(setting.getValue()).isEqualTo("value1,value2");
- assertThat(setting.getValues()).containsOnly("value1", "value2");
+ assertThat(setting.getValue()).isEqualTo("value1,value2,value%2C3");
+ assertThat(setting.getValues()).containsOnly("value1", "value2", "value,3");
}
@Test
@@ -236,6 +236,22 @@ public class DeprecatedPropertiesWsTest {
}
@Test
+ public void put_property_for_undefined_setting() throws Exception {
+ putProperty("undefined", "some-value", null);
+
+ assertThat(getProperty("undefined", null).getValue()).isEqualTo("some-value");
+ }
+
+ @Test
+ public void put_property_multi_values() throws Exception {
+ putProperty("multi", "value1,value2,value3", null);
+
+ Properties.Property setting = getProperty("multi", null);
+ assertThat(setting.getValue()).isEqualTo("value1,value2,value3");
+ assertThat(setting.getValues()).containsOnly("value1", "value2", "value3");
+ }
+
+ @Test
public void delete_property() throws Exception {
setProperty("custom-property", "value", null);