use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_secured_and_license_settings_when_project_admin.
@Test
public void return_secured_and_license_settings_when_project_admin() throws Exception {
logInAsProjectAdmin();
definitions.addComponents(asList(PropertyDefinition.builder("foo").onQualifiers(PROJECT).build(), PropertyDefinition.builder("global.secret.secured").build(), PropertyDefinition.builder("secret.secured").onQualifiers(PROJECT).build(), PropertyDefinition.builder("plugin.license.secured").type(LICENSE).build()));
propertyDb.insertProperties(newComponentPropertyDto(project).setKey("foo").setValue("one"), newGlobalPropertyDto().setKey("global.secret.secured").setValue("very secret"), newComponentPropertyDto(project).setKey("secret.secured").setValue("password"), newGlobalPropertyDto().setKey("plugin.license.secured").setValue("ABCD"), newGlobalPropertyDto().setKey("sonar.plugin.licenseHash.secured").setValue("987654321"));
ValuesWsResponse result = executeRequestForProjectProperties();
assertThat(result.getSettingsList()).extracting(Settings.Setting::getKey).containsOnly("foo", "global.secret.secured", "secret.secured", "plugin.license.secured", "sonar.plugin.licenseHash.secured");
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_multi_value_with_coma.
@Test
public void return_multi_value_with_coma() throws Exception {
logIn();
definitions.addComponent(PropertyDefinition.builder("global").multiValues(true).build());
propertyDb.insertProperties(newGlobalPropertyDto().setKey("global").setValue("three,four%2Cfive"));
ValuesWsResponse result = executeRequestForGlobalProperties("global");
assertThat(result.getSettingsList()).hasSize(1);
Settings.Setting setting = result.getSettings(0);
assertThat(setting.getKey()).isEqualTo("global");
assertThat(setting.getValues().getValuesList()).containsOnly("three", "four,five");
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_module_values.
@Test
public void return_module_values() throws Exception {
logInAsProjectUser();
ComponentDto module = componentDb.insertComponent(newModuleDto(project));
definitions.addComponent(PropertyDefinition.builder("property").defaultValue("default").onQualifiers(PROJECT, MODULE).build());
propertyDb.insertProperties(newGlobalPropertyDto().setKey("property").setValue("one"), // The property is overriding global value
newComponentPropertyDto(module).setKey("property").setValue("two"));
ValuesWsResponse result = executeRequestForComponentProperties(module, "property");
assertThat(result.getSettingsList()).hasSize(1);
assertSetting(result.getSettings(0), "property", "two", false);
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_global_values.
@Test
public void return_global_values() throws Exception {
logIn();
definitions.addComponent(PropertyDefinition.builder("property").defaultValue("default").build());
propertyDb.insertProperties(// The property is overriding default value
newGlobalPropertyDto().setKey("property").setValue("one"));
ValuesWsResponse result = executeRequestForGlobalProperties("property");
assertThat(result.getSettingsList()).hasSize(1);
assertSetting(result.getSettings(0), "property", "one", false);
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_property_set_for_component.
@Test
public void return_property_set_for_component() throws Exception {
logInAsProjectUser();
definitions.addComponent(PropertyDefinition.builder("foo").type(PropertyType.PROPERTY_SET).onQualifiers(PROJECT).fields(asList(PropertyFieldDefinition.build("key").name("Key").build(), PropertyFieldDefinition.build("size").name("Size").build())).build());
propertyDb.insertPropertySet("foo", project, ImmutableMap.of("key", "key1", "size", "size1"), ImmutableMap.of("key", "key2"));
ValuesWsResponse result = executeRequestForProjectProperties("foo");
assertThat(result.getSettingsList()).hasSize(1);
Settings.Setting value = result.getSettings(0);
assertThat(value.getKey()).isEqualTo("foo");
assertFieldValues(value, ImmutableMap.of("key", "key1", "size", "size1"), ImmutableMap.of("key", "key2"));
}
Aggregations