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");
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_values_even_if_no_property_definition.
@Test
public void return_values_even_if_no_property_definition() throws Exception {
logIn();
propertyDb.insertProperties(newGlobalPropertyDto().setKey("globalPropertyWithoutDefinition").setValue("value"));
ValuesWsResponse result = executeRequestForGlobalProperties("globalPropertyWithoutDefinition");
Settings.Setting globalPropertyWithoutDefinitionValue = result.getSettings(0);
assertThat(globalPropertyWithoutDefinitionValue.getKey()).isEqualTo("globalPropertyWithoutDefinition");
assertThat(globalPropertyWithoutDefinitionValue.getValue()).isEqualTo("value");
assertThat(globalPropertyWithoutDefinitionValue.getInherited()).isFalse();
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method does_not_returned_secured_and_license_settings_when_not_authenticated.
@Test
public void does_not_returned_secured_and_license_settings_when_not_authenticated() throws Exception {
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"));
ValuesWsResponse result = executeRequestForGlobalProperties();
assertThat(result.getSettingsList()).extracting(Settings.Setting::getKey).containsOnly("foo");
}
use of org.sonarqube.ws.Settings.ValuesWsResponse in project sonarqube by SonarSource.
the class ValuesActionTest method return_simple_value.
@Test
public void return_simple_value() throws Exception {
logIn();
definitions.addComponent(PropertyDefinition.builder("foo").build());
propertyDb.insertProperties(newGlobalPropertyDto().setKey("foo").setValue("one"));
ValuesWsResponse result = executeRequestForGlobalProperties("foo");
assertThat(result.getSettingsList()).hasSize(1);
Settings.Setting value = result.getSettings(0);
assertThat(value.getKey()).isEqualTo("foo");
assertThat(value.getValue()).isEqualTo("one");
assertThat(value.getInherited()).isFalse();
}
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() throws Exception {
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);
}
Aggregations