Refine search
static List<PropertyDefinition> all() { return singletonList( PropertyDefinition.builder(CoreProperties.CORE_FORCE_AUTHENTICATION_PROPERTY) .defaultValue(Boolean.toString(CoreProperties.CORE_FORCE_AUTHENTICATION_DEFAULT_VALUE)) .name("Force user authentication") .description( "Forcing user authentication prevents anonymous users from accessing the SonarQube UI, or project data via the Web API. " + "Some specific read-only Web APIs, including those required to prompt authentication, are still available anonymously.") .type(PropertyType.BOOLEAN) .category(CoreProperties.CATEGORY_SECURITY) .build()); } }
public static List<PropertyDefinition> properties() { return Collections.singletonList( PropertyDefinition.builder(REPORT_PATHS_PROPERTY_KEY) .name("Issues report paths") .description("List of comma-separated paths (absolute or relative) containing report with issues created by external rule engines.") .category(CoreProperties.CATEGORY_EXTERNAL_ISSUES) .onQualifiers(Qualifiers.PROJECT) .build()); }
public static ImmutableList<PropertyDefinition> properties() { return ImmutableList.of( PropertyDefinition.builder(REPORT_PATHS_PROPERTY_KEY) .name("Coverage report paths") .description("List of comma-separated paths (absolute or relative) containing coverage report.") .category(CATEGORY_CODE_COVERAGE) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .deprecatedKey(OLD_COVERAGE_REPORT_PATHS_PROPERTY_KEY) .build()); }
public static ImmutableList<PropertyDefinition> properties() { return ImmutableList.of( PropertyDefinition.builder(REPORT_PATHS_PROPERTY_KEY) .name("Unit tests results report paths") .description("List of comma-separated paths (absolute or relative) containing unit tests results report.") .category(CATEGORY_CODE_COVERAGE) .onQualifiers(Qualifiers.PROJECT) .multiValues(true) .deprecatedKey(OLD_UNIT_TEST_REPORT_PATHS_PROPERTY_KEY) .build()); }
@Test public void does_not_returned_secured_and_license_settings_when_not_authenticated() { propertyDefinitions.addComponents(asList( PropertyDefinition.builder("foo").build(), PropertyDefinition.builder("secret.secured").build(), PropertyDefinition.builder("plugin.license.secured").type(PropertyType.LICENSE).build(), PropertyDefinition.builder("commercial.plugin").type(PropertyType.LICENSE).build())); ListDefinitionsWsResponse result = executeRequest(); assertThat(result.getDefinitionsList()).extracting(Definition::getKey).containsOnly("foo"); }
@Test public void return_license_settings_when_authenticated_but_not_admin() { logInAsProjectUser(); propertyDefinitions.addComponents(asList( PropertyDefinition.builder("foo").build(), PropertyDefinition.builder("secret.secured").build(), PropertyDefinition.builder("plugin.license.secured").type(PropertyType.LICENSE).build(), PropertyDefinition.builder("commercial.plugin").type(PropertyType.LICENSE).build())); ListDefinitionsWsResponse result = executeRequest(); assertThat(result.getDefinitionsList()).extracting(Definition::getKey).containsOnly("foo", "plugin.license.secured", "commercial.plugin"); }
@Test public void should_build_with_predefined_list_of_definitions() { List<PropertyDefinition> list = Arrays.asList( PropertyDefinition.builder("foo").name("Foo").build(), PropertyDefinition.builder("one").name("One").build(), PropertyDefinition.builder("two").name("Two").defaultValue("2").build()); PropertyDefinitions def = new PropertyDefinitions(list); assertProperties(def); }
@Test public void return_only_global_properties_when_no_component_parameter() { logInAsProjectUser(); propertyDefinitions.addComponents(asList( PropertyDefinition.builder("global").build(), PropertyDefinition.builder("global-and-project").onQualifiers(PROJECT).build(), PropertyDefinition.builder("only-on-project").onlyOnQualifiers(PROJECT).build(), PropertyDefinition.builder("only-on-module").onlyOnQualifiers(MODULE).build())); ListDefinitionsWsResponse result = executeRequest(); assertThat(result.getDefinitionsList()).extracting("key").containsOnly("global", "global-and-project"); }
@Test public void test_categories() { PropertyDefinitions def = new PropertyDefinitions( PropertyDefinition.builder("inCateg").name("In Categ").category("categ").build(), PropertyDefinition.builder("noCateg").name("No categ").build()); assertThat(def.getCategory("inCateg")).isEqualTo("categ"); assertThat(def.getCategory("noCateg")).isEmpty(); }
@Test public void return_secured_and_license_settings_when_system_admin() { logInAsAdmin(db.getDefaultOrganization()); propertyDefinitions.addComponents(asList( PropertyDefinition.builder("foo").build(), PropertyDefinition.builder("secret.secured").build(), PropertyDefinition.builder("plugin.license.secured").type(PropertyType.LICENSE).build())); ListDefinitionsWsResponse result = executeRequest(); assertThat(result.getDefinitionsList()).extracting(Definition::getKey).containsOnly("foo", "secret.secured", "plugin.license.secured"); }
@Test public void should_inspect_plugin_objects() { PropertyDefinitions def = new PropertyDefinitions( PropertyDefinition.builder("foo").name("Foo").build(), PropertyDefinition.builder("one").name("One").build(), PropertyDefinition.builder("two").name("Two").defaultValue("2").build()); assertProperties(def); }
@Test public void test_default_category() { PropertyDefinitions def = new PropertyDefinitions(); def.addComponent(PropertyDefinition.builder("inCateg").name("In Categ").category("categ").build(), "default"); def.addComponent(PropertyDefinition.builder("noCateg").name("No categ").build(), "default"); assertThat(def.getCategory("inCateg")).isEqualTo("categ"); assertThat(def.getCategory("noCateg")).isEqualTo("default"); }