use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_secured_and_license_settings_in_property_set_when_system_admin.
@Test
public void return_secured_and_license_settings_in_property_set_when_system_admin() throws Exception {
logInAsAdmin();
definitions.addComponent(PropertyDefinition.builder("foo").type(PropertyType.PROPERTY_SET).fields(asList(PropertyFieldDefinition.build("key").name("Key").build(), PropertyFieldDefinition.build("plugin.license.secured").name("License").type(LICENSE).build(), PropertyFieldDefinition.build("secret.secured").name("Secured").build())).build());
propertyDb.insertPropertySet("foo", null, ImmutableMap.of("key", "key1", "plugin.license.secured", "ABCD", "secret.secured", "123456"));
ValuesWsResponse result = executeRequestForGlobalProperties();
assertFieldValues(result.getSettings(0), ImmutableMap.of("key", "key1", "plugin.license.secured", "ABCD", "secret.secured", "123456"));
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_secured_and_license_settings_even_if_not_defined_when_project_admin.
@Test
public void return_secured_and_license_settings_even_if_not_defined_when_project_admin() throws Exception {
logInAsProjectAdmin();
propertyDb.insertProperties(newComponentPropertyDto(project).setKey("not-defined.secured").setValue("123"));
ValuesWsResponse result = executeRequestForProjectProperties("not-defined.secured");
assertThat(result.getSettingsList()).extracting(Settings.Setting::getKey).containsOnly("not-defined.secured");
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class LicensesPageTest method change_licenses.
@Test
public void change_licenses() {
String EXAMPLE_LICENSE = "TmFtZTogRGV2ZWxvcHBlcnMKUGx1Z2luOiBhdXRvY29udHJvbApFeHBpcmVzOiAyMDEyLTA0LTAxCktleTogNjI5N2MxMzEwYzg2NDZiZTE5MDU1MWE4ZmZmYzk1OTBmYzEyYTIyMgo=";
LicensesPage page = nav.logIn().asAdmin().openLicenses();
LicenseItem licenseItem = page.getLicenseByKey("typed.license.secured");
licenseItem.setLicense(EXAMPLE_LICENSE);
ValuesWsResponse response = wsClient.settingsService().values(ValuesRequest.builder().setKeys("typed.license.secured").build());
assertThat(response.getSettings(0).getValue()).isEqualTo(EXAMPLE_LICENSE);
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class SettingsTest method getSetting.
@CheckForNull
private static Setting getSetting(String key, SettingsService settingsService) {
ValuesWsResponse response = settingsService.values(ValuesRequest.builder().setKeys(key).build());
List<Settings.Setting> settings = response.getSettingsList();
return settings.isEmpty() ? null : settings.get(0);
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_license_with_hash_settings_when_authenticated_but_not_admin.
@Test
public void return_license_with_hash_settings_when_authenticated_but_not_admin() throws Exception {
logIn();
definitions.addComponents(asList(PropertyDefinition.builder("foo").build(), PropertyDefinition.builder("secret.secured").build(), PropertyDefinition.builder("commercial.plugin").type(LICENSE).build(), PropertyDefinition.builder("plugin.license.secured").type(LICENSE).build()));
propertyDb.insertProperties(newGlobalPropertyDto().setKey("foo").setValue("one"), newGlobalPropertyDto().setKey("secret.secured").setValue("password"), newGlobalPropertyDto().setKey("commercial.plugin").setValue("ABCD"), newGlobalPropertyDto().setKey("plugin.license.secured").setValue("ABCD"), newGlobalPropertyDto().setKey("sonar.plugin.licenseHash.secured").setValue("987654321"));
ValuesWsResponse result = executeRequestForGlobalProperties();
assertThat(result.getSettingsList()).extracting(Settings.Setting::getKey).containsOnly("foo", "commercial.plugin", "plugin.license.secured", "sonar.plugin.licenseHash.secured");
}
Aggregations