use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_inherited_values_on_module.
@Test
public void return_inherited_values_on_module() throws Exception {
logInAsProjectUser();
ComponentDto module = componentDb.insertComponent(newModuleDto(project));
definitions.addComponents(asList(PropertyDefinition.builder("defaultProperty").defaultValue("default").onQualifiers(PROJECT, MODULE).build(), PropertyDefinition.builder("globalProperty").onQualifiers(PROJECT, MODULE).build(), PropertyDefinition.builder("projectProperty").onQualifiers(PROJECT, MODULE).build(), PropertyDefinition.builder("moduleProperty").onQualifiers(PROJECT, MODULE).build()));
propertyDb.insertProperties(newGlobalPropertyDto().setKey("globalProperty").setValue("global"), newComponentPropertyDto(project).setKey("projectProperty").setValue("project"), newComponentPropertyDto(module).setKey("moduleProperty").setValue("module"));
ValuesWsResponse result = executeRequestForComponentProperties(module, "defaultProperty", "globalProperty", "projectProperty", "moduleProperty");
assertThat(result.getSettingsList()).hasSize(4);
assertSetting(result.getSettings(0), "defaultProperty", "default", true);
assertSetting(result.getSettings(1), "globalProperty", "global", true);
assertSetting(result.getSettings(2), "projectProperty", "project", true);
assertSetting(result.getSettings(3), "moduleProperty", "module", false);
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_project_values.
@Test
public void return_project_values() throws Exception {
logInAsProjectUser();
definitions.addComponent(PropertyDefinition.builder("property").defaultValue("default").onQualifiers(PROJECT).build());
propertyDb.insertProperties(newGlobalPropertyDto().setKey("property").setValue("one"), // The property is overriding global value
newComponentPropertyDto(project).setKey("property").setValue("two"));
ValuesWsResponse result = executeRequestForProjectProperties("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_simple_value_with_non_ascii_characters.
@Test
public void return_simple_value_with_non_ascii_characters() throws Exception {
logIn();
definitions.addComponent(PropertyDefinition.builder("foo").build());
propertyDb.insertProperties(newGlobalPropertyDto().setKey("foo").setValue("fi±∞…"));
ValuesWsResponse result = executeRequestForGlobalProperties("foo");
assertThat(result.getSettings(0).getValue()).isEqualTo("fi±∞…");
}
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);
}
Aggregations