summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java64
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDef.java (renamed from sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java)13
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java36
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDefinition.java4
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java4
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefTest.java (renamed from sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java)40
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionsTest.java34
-rw-r--r--sonar-server/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java4
8 files changed, 97 insertions, 102 deletions
diff --git a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java
index 5c3979cb886..27994970c68 100644
--- a/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java
+++ b/plugins/sonar-cpd-plugin/src/main/java/org/sonar/plugins/cpd/CpdPlugin.java
@@ -23,7 +23,7 @@ import com.google.common.collect.ImmutableList;
import org.sonar.api.CoreProperties;
import org.sonar.api.PropertyType;
import org.sonar.api.SonarPlugin;
-import org.sonar.api.config.PropertyDefinition;
+import org.sonar.api.config.PropertyDef;
import org.sonar.api.resources.Qualifiers;
import org.sonar.plugins.cpd.decorators.DuplicationDensityDecorator;
import org.sonar.plugins.cpd.decorators.SumDuplicationsDecorator;
@@ -35,38 +35,38 @@ public final class CpdPlugin extends SonarPlugin {
public List getExtensions() {
return ImmutableList.of(
- PropertyDefinition.builder(CoreProperties.CPD_CROSS_RPOJECT)
- .defaultValue(CoreProperties.CPD_CROSS_RPOJECT_DEFAULT_VALUE + "")
- .name("Cross project duplication detection")
- .description("SonarQube supports the detection of cross project duplications. Activating this property will slightly increase each Sonar analysis time.")
- .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
- .category(CoreProperties.CATEGORY_DUPLICATIONS)
- .type(PropertyType.BOOLEAN)
- .build(),
- PropertyDefinition.builder(CoreProperties.CPD_SKIP_PROPERTY)
- .defaultValue("false")
- .name("Skip")
- .description("Disable detection of duplications")
- .hidden()
- .category(CoreProperties.CATEGORY_DUPLICATIONS)
- .type(PropertyType.BOOLEAN)
- .build(),
- PropertyDefinition.builder(CoreProperties.CPD_EXCLUSIONS)
- .defaultValue("")
- .name("Duplication exclusions")
- .description("Patterns used to exclude some source files from the duplication detection mechanism. " +
- "See the \"Exclusions\" category to know how to use wildcards to specify this property.")
- .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
- .category(CoreProperties.CATEGORY_DUPLICATIONS)
- .multiValues(true)
- .build(),
+ PropertyDef.builder(CoreProperties.CPD_CROSS_RPOJECT)
+ .defaultValue(CoreProperties.CPD_CROSS_RPOJECT_DEFAULT_VALUE + "")
+ .name("Cross project duplication detection")
+ .description("SonarQube supports the detection of cross project duplications. Activating this property will slightly increase each Sonar analysis time.")
+ .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
+ .category(CoreProperties.CATEGORY_DUPLICATIONS)
+ .type(PropertyType.BOOLEAN)
+ .build(),
+ PropertyDef.builder(CoreProperties.CPD_SKIP_PROPERTY)
+ .defaultValue("false")
+ .name("Skip")
+ .description("Disable detection of duplications")
+ .hidden()
+ .category(CoreProperties.CATEGORY_DUPLICATIONS)
+ .type(PropertyType.BOOLEAN)
+ .build(),
+ PropertyDef.builder(CoreProperties.CPD_EXCLUSIONS)
+ .defaultValue("")
+ .name("Duplication exclusions")
+ .description("Patterns used to exclude some source files from the duplication detection mechanism. " +
+ "See the \"Exclusions\" category to know how to use wildcards to specify this property.")
+ .onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
+ .category(CoreProperties.CATEGORY_DUPLICATIONS)
+ .multiValues(true)
+ .build(),
- CpdSensor.class,
- SumDuplicationsDecorator.class,
- DuplicationDensityDecorator.class,
- IndexFactory.class,
- SonarEngine.class,
- SonarBridgeEngine.class);
+ CpdSensor.class,
+ SumDuplicationsDecorator.class,
+ DuplicationDensityDecorator.class,
+ IndexFactory.class,
+ SonarEngine.class,
+ SonarBridgeEngine.class);
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDef.java
index 374a594f118..389002f9c40 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDef.java
@@ -39,10 +39,9 @@ import java.util.List;
import static com.google.common.collect.Lists.newArrayList;
/**
- *
* @since 3.0
*/
-public final class PropertyDefinition implements BatchExtension, ServerExtension {
+public final class PropertyDef implements BatchExtension, ServerExtension {
private String key;
private String defaultValue;
@@ -66,7 +65,7 @@ public final class PropertyDefinition implements BatchExtension, ServerExtension
/**
* @since 3.6
*/
- private PropertyDefinition(Builder builder) {
+ private PropertyDef(Builder builder) {
this.key = builder.key;
this.name = builder.name;
this.description = builder.description;
@@ -95,8 +94,8 @@ public final class PropertyDefinition implements BatchExtension, ServerExtension
/**
* @since 3.6
*/
- static PropertyDefinition create(Property annotation) {
- Builder builder = PropertyDefinition.builder(annotation.key())
+ static PropertyDef create(Property annotation) {
+ Builder builder = PropertyDef.builder(annotation.key())
.name(annotation.name())
.defaultValue(annotation.defaultValue())
.description(annotation.description())
@@ -420,7 +419,7 @@ public final class PropertyDefinition implements BatchExtension, ServerExtension
return this;
}
- public PropertyDefinition build() {
+ public PropertyDef build() {
Preconditions.checkArgument(!Strings.isNullOrEmpty(key), "Key must be set");
fixType(key, type);
Preconditions.checkArgument(onQualifiers.isEmpty() || onlyOnQualifiers.isEmpty(), "Cannot define both onQualifiers and onlyOnQualifiers");
@@ -428,7 +427,7 @@ public final class PropertyDefinition implements BatchExtension, ServerExtension
if (hidden) {
global = false;
}
- return new PropertyDefinition(this);
+ return new PropertyDef(this);
}
private void fixType(String key, PropertyType type) {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java
index 17eac9c0cb7..452ba25f82e 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java
@@ -30,11 +30,7 @@ import org.sonar.api.utils.AnnotationUtils;
import javax.annotation.Nullable;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
/**
* Metadata of all the properties declared by plugins
@@ -43,7 +39,7 @@ import java.util.Map;
*/
public final class PropertyDefinitions implements BatchComponent, ServerComponent {
- private final Map<String, PropertyDefinition> definitions = Maps.newHashMap();
+ private final Map<String, PropertyDef> definitions = Maps.newHashMap();
private final Map<String, String> categories = Maps.newHashMap();
private final Map<String, String> subcategories = Maps.newHashMap();
@@ -73,8 +69,8 @@ public final class PropertyDefinitions implements BatchComponent, ServerComponen
public PropertyDefinitions addComponent(Object component, String defaultCategory) {
addComponentFromAnnotationProperty(component, defaultCategory);
- if (component instanceof PropertyDefinition) {
- PropertyDefinition propertyDefinition = (PropertyDefinition) component;
+ if (component instanceof PropertyDef) {
+ PropertyDef propertyDefinition = (PropertyDef) component;
add(propertyDefinition, defaultCategory);
}
return this;
@@ -95,11 +91,11 @@ public final class PropertyDefinitions implements BatchComponent, ServerComponen
}
private PropertyDefinitions addProperty(Property property, String defaultCategory) {
- PropertyDefinition definition = PropertyDefinition.create(property);
+ PropertyDef definition = PropertyDef.create(property);
return add(definition, defaultCategory);
}
- private PropertyDefinitions add(PropertyDefinition definition, String defaultCategory) {
+ private PropertyDefinitions add(PropertyDef definition, String defaultCategory) {
if (!definitions.containsKey(definition.key())) {
definitions.put(definition.key(), definition);
categories.put(definition.key(), StringUtils.defaultIfBlank(definition.category(), defaultCategory));
@@ -111,11 +107,11 @@ public final class PropertyDefinitions implements BatchComponent, ServerComponen
return this;
}
- public PropertyDefinition get(String key) {
+ public PropertyDef get(String key) {
return definitions.get(validKey(key));
}
- public Collection<PropertyDefinition> getAll() {
+ public Collection<PropertyDef> getAll() {
return definitions.values();
}
@@ -126,18 +122,18 @@ public final class PropertyDefinitions implements BatchComponent, ServerComponen
/**
* @since 3.6
*/
- public Map<String, Map<String, Collection<PropertyDefinition>>> getPropertiesByCategory(@Nullable String qualifier) {
- Map<String, Map<String, Collection<PropertyDefinition>>> byCategory = new HashMap<String, Map<String, Collection<PropertyDefinition>>>();
+ public Map<String, Map<String, Collection<PropertyDef>>> getPropertiesByCategory(@Nullable String qualifier) {
+ Map<String, Map<String, Collection<PropertyDef>>> byCategory = new HashMap<String, Map<String, Collection<PropertyDef>>>();
- for (PropertyDefinition definition : getAll()) {
+ for (PropertyDef definition : getAll()) {
if (qualifier == null ? definition.global() : definition.qualifiers().contains(qualifier)) {
String category = getCategory(definition.key());
if (!byCategory.containsKey(category)) {
- byCategory.put(category, new HashMap<String, Collection<PropertyDefinition>>());
+ byCategory.put(category, new HashMap<String, Collection<PropertyDef>>());
}
String subCategory = getSubCategory(definition.key());
if (!byCategory.get(category).containsKey(subCategory)) {
- byCategory.get(category).put(subCategory, new ArrayList<PropertyDefinition>());
+ byCategory.get(category).put(subCategory, new ArrayList<PropertyDef>());
}
byCategory.get(category).get(subCategory).add(definition);
}
@@ -146,12 +142,12 @@ public final class PropertyDefinitions implements BatchComponent, ServerComponen
return byCategory;
}
- public Map<String, Map<String, Collection<PropertyDefinition>>> getPropertiesByCategory() {
+ public Map<String, Map<String, Collection<PropertyDef>>> getPropertiesByCategory() {
return getPropertiesByCategory(null);
}
public String getDefaultValue(String key) {
- PropertyDefinition def = get(key);
+ PropertyDef def = get(key);
if (def == null) {
return null;
}
@@ -175,7 +171,7 @@ public final class PropertyDefinitions implements BatchComponent, ServerComponen
}
public String getDeprecatedKey(String key) {
- PropertyDefinition def = get(key);
+ PropertyDef def = get(key);
if (def == null) {
return null;
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDefinition.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDefinition.java
index b48c1808ab6..3c3d4748ccd 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDefinition.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDefinition.java
@@ -94,8 +94,8 @@ public final class PropertyFieldDefinition {
return options;
}
- public PropertyDefinition.Result validate(@Nullable String value) {
- return PropertyDefinition.validate(type, value, options);
+ public PropertyDef.Result validate(@Nullable String value) {
+ return PropertyDef.validate(type, value, options);
}
public static class Builder {
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java
index 8623e9c458a..f63934c6228 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/Settings.java
@@ -190,7 +190,7 @@ public class Settings implements BatchComponent, ServerComponent {
* </ul>
*/
public String[] getStringArray(String key) {
- PropertyDefinition property = getDefinitions().get(key);
+ PropertyDef property = getDefinitions().get(key);
if ((null != property) && (property.multiValues())) {
String value = getString(key);
if (value == null) {
@@ -258,7 +258,7 @@ public class Settings implements BatchComponent, ServerComponent {
}
public Settings setProperty(String key, @Nullable String[] values) {
- PropertyDefinition property = getDefinitions().get(key);
+ PropertyDef property = getDefinitions().get(key);
if ((null == property) || (!property.multiValues())) {
throw new IllegalStateException("Fail to set multiple values on a single value property " + key);
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefTest.java
index 84978ff1795..4a284b97c30 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefTest.java
@@ -30,11 +30,11 @@ import org.sonar.api.utils.AnnotationUtils;
import static org.fest.assertions.Assertions.assertThat;
import static org.fest.assertions.Fail.fail;
-public class PropertyDefinitionTest {
+public class PropertyDefTest {
@Test
public void should_create_property() {
- PropertyDefinition def = PropertyDefinition.builder("hello")
+ PropertyDef def = PropertyDef.builder("hello")
.name("Hello")
.defaultValue("world")
.category("categ")
@@ -65,7 +65,7 @@ public class PropertyDefinitionTest {
Properties props = AnnotationUtils.getAnnotation(Init.class, Properties.class);
Property prop = props.value()[0];
- PropertyDefinition def = PropertyDefinition.create(prop);
+ PropertyDef def = PropertyDef.create(prop);
assertThat(def.key()).isEqualTo("hello");
assertThat(def.name()).isEqualTo("Hello");
@@ -83,7 +83,7 @@ public class PropertyDefinitionTest {
@Test
public void should_create_hidden_property() {
- PropertyDefinition def = PropertyDefinition.builder("hello")
+ PropertyDef def = PropertyDef.builder("hello")
.name("Hello")
.hidden()
.build();
@@ -95,7 +95,7 @@ public class PropertyDefinitionTest {
@Test
public void should_create_property_with_default_values() {
- PropertyDefinition def = PropertyDefinition.builder("hello")
+ PropertyDef def = PropertyDef.builder("hello")
.name("Hello")
.build();
@@ -118,7 +118,7 @@ public class PropertyDefinitionTest {
Properties props = AnnotationUtils.getAnnotation(DefaultValues.class, Properties.class);
Property prop = props.value()[0];
- PropertyDefinition def = PropertyDefinition.create(prop);
+ PropertyDef def = PropertyDef.create(prop);
assertThat(def.key()).isEqualTo("hello");
assertThat(def.name()).isEqualTo("Hello");
@@ -136,7 +136,7 @@ public class PropertyDefinitionTest {
@Test
public void should_support_property_sets() {
- PropertyDefinition def = PropertyDefinition.builder("hello")
+ PropertyDef def = PropertyDef.builder("hello")
.name("Hello")
.fields(
PropertyFieldDefinition.build("first").name("First").description("Description").options("A", "B").build(),
@@ -163,7 +163,7 @@ public class PropertyDefinitionTest {
Properties props = AnnotationUtils.getAnnotation(WithPropertySet.class, Properties.class);
Property prop = props.value()[0];
- PropertyDefinition def = PropertyDefinition.create(prop);
+ PropertyDef def = PropertyDef.create(prop);
assertThat(def.fields()).hasSize(2);
assertThat(def.fields().get(0).key()).isEqualTo("first");
@@ -181,7 +181,7 @@ public class PropertyDefinitionTest {
@Test
public void should_validate_string() {
- PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.STRING).build();
+ PropertyDef def = PropertyDef.builder("foo").name("foo").type(PropertyType.STRING).build();
assertThat(def.validate(null).isValid()).isTrue();
assertThat(def.validate("").isValid()).isTrue();
@@ -191,7 +191,7 @@ public class PropertyDefinitionTest {
@Test
public void should_validate_boolean() {
- PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.BOOLEAN).build();
+ PropertyDef def = PropertyDef.builder("foo").name("foo").type(PropertyType.BOOLEAN).build();
assertThat(def.validate(null).isValid()).isTrue();
assertThat(def.validate("").isValid()).isTrue();
@@ -205,7 +205,7 @@ public class PropertyDefinitionTest {
@Test
public void should_validate_integer() {
- PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.INTEGER).build();
+ PropertyDef def = PropertyDef.builder("foo").name("foo").type(PropertyType.INTEGER).build();
assertThat(def.validate(null).isValid()).isTrue();
assertThat(def.validate("").isValid()).isTrue();
@@ -218,7 +218,7 @@ public class PropertyDefinitionTest {
@Test
public void should_validate_float() {
- PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.FLOAT).build();
+ PropertyDef def = PropertyDef.builder("foo").name("foo").type(PropertyType.FLOAT).build();
assertThat(def.validate(null).isValid()).isTrue();
assertThat(def.validate("").isValid()).isTrue();
@@ -232,7 +232,7 @@ public class PropertyDefinitionTest {
@Test
public void should_validate_single_select_list() {
- PropertyDefinition def = PropertyDefinition.builder("foo").name("foo").type(PropertyType.SINGLE_SELECT_LIST).options("de", "en").build();
+ PropertyDef def = PropertyDef.builder("foo").name("foo").type(PropertyType.SINGLE_SELECT_LIST).options("de", "en").build();
assertThat(def.validate(null).isValid()).isTrue();
assertThat(def.validate("").isValid()).isTrue();
@@ -246,15 +246,15 @@ public class PropertyDefinitionTest {
@Test
public void should_auto_detect_password_type() {
- PropertyDefinition def = PropertyDefinition.builder("scm.password.secured").name("SCM password").build();
+ PropertyDef def = PropertyDef.builder("scm.password.secured").name("SCM password").build();
assertThat(def.key()).isEqualTo("scm.password.secured");
assertThat(def.type()).isEqualTo(PropertyType.PASSWORD);
}
@Test
- public void should_auto_detect_license_type() {
- PropertyDefinition def = PropertyDefinition.builder("views.license.secured").name("Views license").build();
+ public void PropertyDef() {
+ PropertyDef def = PropertyDef.builder("views.license.secured").name("Views license").build();
assertThat(def.key()).isEqualTo("views.license.secured");
assertThat(def.type()).isEqualTo(PropertyType.LICENSE);
@@ -263,7 +263,7 @@ public class PropertyDefinitionTest {
@Test
public void should_not_authorise_empty_key() {
try {
- PropertyDefinition.builder(null).build();
+ PropertyDef.builder(null).build();
fail();
} catch (Exception e) {
assertThat(e).hasMessage("Key must be set").isInstanceOf(IllegalArgumentException.class);
@@ -273,7 +273,7 @@ public class PropertyDefinitionTest {
@Test
public void should_not_authorize_defining_on_qualifiers_and_hidden() {
try {
- PropertyDefinition.builder("foo").name("foo").onQualifiers(Qualifiers.FILE).hidden().build();
+ PropertyDef.builder("foo").name("foo").onQualifiers(Qualifiers.FILE).hidden().build();
fail();
} catch (Exception e) {
assertThat(e).hasMessage("Cannot be hidden and defining qualifiers on which to display").isInstanceOf(IllegalArgumentException.class);
@@ -283,7 +283,7 @@ public class PropertyDefinitionTest {
@Test
public void should_not_authorize_defining_ony_on_qualifiers_and_hidden() {
try {
- PropertyDefinition.builder("foo").name("foo").onlyOnQualifiers(Qualifiers.FILE).hidden().build();
+ PropertyDef.builder("foo").name("foo").onlyOnQualifiers(Qualifiers.FILE).hidden().build();
fail();
} catch (Exception e) {
assertThat(e).hasMessage("Cannot be hidden and defining qualifiers on which to display").isInstanceOf(IllegalArgumentException.class);
@@ -293,7 +293,7 @@ public class PropertyDefinitionTest {
@Test
public void should_not_authorize_defining_on_qualifiers_and_only_on_qualifiers() {
try {
- PropertyDefinition.builder("foo").name("foo").onQualifiers(Qualifiers.FILE).onlyOnQualifiers(Qualifiers.PROJECT).build();
+ PropertyDef.builder("foo").name("foo").onQualifiers(Qualifiers.FILE).onlyOnQualifiers(Qualifiers.PROJECT).build();
fail();
} catch (Exception e) {
assertThat(e).hasMessage("Cannot define both onQualifiers and onlyOnQualifiers").isInstanceOf(IllegalArgumentException.class);
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionsTest.java
index f21fb611206..cdd9afc4f0e 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionsTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionsTest.java
@@ -31,9 +31,9 @@ public class PropertyDefinitionsTest {
@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()
+ PropertyDef.builder("foo").name("Foo").build(),
+ PropertyDef.builder("one").name("One").build(),
+ PropertyDef.builder("two").name("Two").defaultValue("2").build()
);
assertProperties(def);
@@ -56,8 +56,8 @@ public class PropertyDefinitionsTest {
@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()
+ PropertyDef.builder("inCateg").name("In Categ").category("categ").build(),
+ PropertyDef.builder("noCateg").name("No categ").build()
);
assertThat(def.getCategory("inCateg")).isEqualTo("categ");
@@ -75,8 +75,8 @@ public class PropertyDefinitionsTest {
@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");
+ def.addComponent(PropertyDef.builder("inCateg").name("In Categ").category("categ").build(), "default");
+ def.addComponent(PropertyDef.builder("noCateg").name("No categ").build(), "default");
assertThat(def.getCategory("inCateg")).isEqualTo("categ");
assertThat(def.getCategory("noCateg")).isEqualTo("default");
@@ -93,12 +93,12 @@ public class PropertyDefinitionsTest {
@Test
public void should_group_by_category() {
PropertyDefinitions def = new PropertyDefinitions(
- PropertyDefinition.builder("global1").name("Global1").category("catGlobal1").build(),
- PropertyDefinition.builder("global2").name("Global2").category("catGlobal1").build(),
- PropertyDefinition.builder("global3").name("Global3").category("catGlobal2").build(),
- PropertyDefinition.builder("project").name("Project").category("catProject").onlyOnQualifiers(Qualifiers.PROJECT).build(),
- PropertyDefinition.builder("module").name("Module").category("catModule").onlyOnQualifiers(Qualifiers.MODULE).build(),
- PropertyDefinition.builder("view").name("View").category("catView").onlyOnQualifiers(Qualifiers.VIEW).build()
+ PropertyDef.builder("global1").name("Global1").category("catGlobal1").build(),
+ PropertyDef.builder("global2").name("Global2").category("catGlobal1").build(),
+ PropertyDef.builder("global3").name("Global3").category("catGlobal2").build(),
+ PropertyDef.builder("project").name("Project").category("catProject").onlyOnQualifiers(Qualifiers.PROJECT).build(),
+ PropertyDef.builder("module").name("Module").category("catModule").onlyOnQualifiers(Qualifiers.MODULE).build(),
+ PropertyDef.builder("view").name("View").category("catView").onlyOnQualifiers(Qualifiers.VIEW).build()
);
assertThat(def.getPropertiesByCategory(null).keySet()).containsOnly("catGlobal1", "catGlobal2");
@@ -111,10 +111,10 @@ public class PropertyDefinitionsTest {
@Test
public void should_group_by_subcategory() {
PropertyDefinitions def = new PropertyDefinitions(
- PropertyDefinition.builder("global1").name("Global1").category("catGlobal1").subcategory("sub1").build(),
- PropertyDefinition.builder("global2").name("Global2").category("catGlobal1").subcategory("sub2").build(),
- PropertyDefinition.builder("global3").name("Global3").category("catGlobal1").build(),
- PropertyDefinition.builder("global4").name("Global4").category("catGlobal2").build()
+ PropertyDef.builder("global1").name("Global1").category("catGlobal1").subcategory("sub1").build(),
+ PropertyDef.builder("global2").name("Global2").category("catGlobal1").subcategory("sub2").build(),
+ PropertyDef.builder("global3").name("Global3").category("catGlobal1").build(),
+ PropertyDef.builder("global4").name("Global4").category("catGlobal2").build()
);
assertThat(def.getPropertiesByCategory(null).get("catGlobal1").keySet()).containsOnly("default", "sub1", "sub2");
diff --git a/sonar-server/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java b/sonar-server/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java
index 68e6ccf27d9..93bcd99ca3e 100644
--- a/sonar-server/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java
+++ b/sonar-server/src/main/java/org/sonar/server/startup/RenameDeprecatedPropertyKeys.java
@@ -21,7 +21,7 @@ package org.sonar.server.startup;
import com.google.common.base.Strings;
import org.slf4j.LoggerFactory;
-import org.sonar.api.config.PropertyDefinition;
+import org.sonar.api.config.PropertyDef;
import org.sonar.api.config.PropertyDefinitions;
import org.sonar.core.properties.PropertiesDao;
@@ -40,7 +40,7 @@ public class RenameDeprecatedPropertyKeys {
public void start() {
LoggerFactory.getLogger(RenameDeprecatedPropertyKeys.class).info("Rename deprecated property keys");
- for (PropertyDefinition definition : definitions.getAll()) {
+ for (PropertyDef definition : definitions.getAll()) {
if (!Strings.isNullOrEmpty(definition.deprecatedKey())) {
dao.renamePropertyKey(definition.deprecatedKey(), definition.key());
}