use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_secured_settings_when_system_admin.
@Test
public void return_secured_settings_when_system_admin() {
logInAsAdmin();
definitions.addComponents(asList(PropertyDefinition.builder("foo").build(), PropertyDefinition.builder("secret.secured").build()));
propertyDb.insertProperties(null, null, null, null, newGlobalPropertyDto().setKey("foo").setValue("one"), newGlobalPropertyDto().setKey("secret.secured").setValue("password"));
ValuesWsResponse result = executeRequestForGlobalProperties();
assertThat(result.getSettingsList()).extracting(Settings.Setting::getKey).containsOnly("foo");
assertThat(result.getSetSecuredSettingsList()).containsOnly("secret.secured");
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_additional_settings_specific_for_scanner_when_no_keys.
@Test
public void return_additional_settings_specific_for_scanner_when_no_keys() {
logInAsAdmin();
definitions.addComponent(PropertyDefinition.builder("secret.secured").build());
propertyDb.insertProperties(null, null, null, null, newGlobalPropertyDto().setKey("sonar.core.id").setValue("ID"), newGlobalPropertyDto().setKey("sonar.core.startTime").setValue("2017-01-01"));
ValuesWsResponse result = executeRequestForGlobalProperties();
assertThat(result.getSettingsList()).extracting(Settings.Setting::getKey).containsOnly("sonar.core.id", "sonar.core.startTime");
}
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() {
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"));
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_default_values.
@Test
public void return_default_values() {
logIn();
definitions.addComponent(PropertyDefinition.builder("foo").defaultValue("default").build());
ValuesWsResponse result = executeRequestForGlobalProperties("foo");
assertThat(result.getSettingsList()).hasSize(1);
assertSetting(result.getSettings(0), "foo", "default", true);
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method do_not_return_secured_settings_when_not_authenticated.
@Test
public void do_not_return_secured_settings_when_not_authenticated() {
definitions.addComponents(asList(PropertyDefinition.builder("foo").build(), PropertyDefinition.builder("secret.secured").build()));
propertyDb.insertProperties(null, null, null, null, newGlobalPropertyDto().setKey("foo").setValue("one"), newGlobalPropertyDto().setKey("secret.secured").setValue("password"));
ValuesWsResponse result = executeRequestForGlobalProperties();
assertThat(result.getSettingsList()).extracting(Settings.Setting::getKey).containsOnly("foo");
}
Aggregations