diff options
author | Julien Lancelot <julien.lancelot@gmail.com> | 2013-04-25 09:04:27 +0200 |
---|---|---|
committer | Julien Lancelot <julien.lancelot@gmail.com> | 2013-04-25 09:04:27 +0200 |
commit | cf4c5fe91ce78cc4cba28c8fa342e1edf7e0cf76 (patch) | |
tree | 295804bf71c8533424e12f4edfa5c6791d259103 | |
parent | 49ae063a7ba3ea2f717138280bfac0583b415d23 (diff) | |
download | sonarqube-cf4c5fe91ce78cc4cba28c8fa342e1edf7e0cf76.tar.gz sonarqube-cf4c5fe91ce78cc4cba28c8fa342e1edf7e0cf76.zip |
Revert Rename PropertyDefinitions to PropertyDefs and PropertyFieldDefinition to PropertyFieldDef
21 files changed, 104 insertions, 104 deletions
diff --git a/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/CpdSensorTest.java b/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/CpdSensorTest.java index ed3038909ea..26d5637373f 100644 --- a/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/CpdSensorTest.java +++ b/plugins/sonar-cpd-plugin/src/test/java/org/sonar/plugins/cpd/CpdSensorTest.java @@ -22,7 +22,7 @@ package org.sonar.plugins.cpd; import org.apache.commons.configuration.PropertiesConfiguration; import org.junit.Before; import org.junit.Test; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; import org.sonar.api.resources.Java; import org.sonar.api.resources.Language; @@ -44,7 +44,7 @@ public class CpdSensorTest { IndexFactory indexFactory = mock(IndexFactory.class); sonarEngine = new SonarEngine(indexFactory, null, null, null); sonarBridgeEngine = new SonarBridgeEngine(indexFactory, null, null); - settings = new Settings(new PropertyDefs(CpdPlugin.class)); + settings = new Settings(new PropertyDefinitions(CpdPlugin.class)); sensor = new CpdSensor(sonarEngine, sonarBridgeEngine, settings); } diff --git a/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/DefaultPurgeTaskTest.java b/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/DefaultPurgeTaskTest.java index 38443e3097a..1afad9051d8 100644 --- a/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/DefaultPurgeTaskTest.java +++ b/plugins/sonar-dbcleaner-plugin/src/test/java/org/sonar/plugins/dbcleaner/DefaultPurgeTaskTest.java @@ -21,7 +21,7 @@ package org.sonar.plugins.dbcleaner; import org.junit.Test; import org.sonar.api.CoreProperties; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; import org.sonar.api.resources.Scopes; import org.sonar.core.purge.PurgeDao; @@ -37,7 +37,7 @@ public class DefaultPurgeTaskTest { @Test public void shouldNotDeleteHistoricalDataOfDirectories() { PurgeDao purgeDao = mock(PurgeDao.class); - Settings settings = new Settings(new PropertyDefs(DefaultPurgeTask.class)); + Settings settings = new Settings(new PropertyDefinitions(DefaultPurgeTask.class)); settings.setProperty(DbCleanerConstants.PROPERTY_CLEAN_DIRECTORY, "false"); DefaultPurgeTask task = new DefaultPurgeTask(purgeDao, settings, mock(DefaultPeriodCleaner.class), mock(PurgeProfiler.class)); @@ -49,7 +49,7 @@ public class DefaultPurgeTaskTest { @Test public void shouldDeleteHistoricalDataOfDirectoriesByDefault() { PurgeDao purgeDao = mock(PurgeDao.class); - Settings settings = new Settings(new PropertyDefs(DefaultPurgeTask.class)); + Settings settings = new Settings(new PropertyDefinitions(DefaultPurgeTask.class)); DefaultPurgeTask task = new DefaultPurgeTask(purgeDao, settings, mock(DefaultPeriodCleaner.class), mock(PurgeProfiler.class)); task.purge(1L); diff --git a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchSettings.java b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchSettings.java index 1bedd4b6b99..72d038aa58d 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchSettings.java +++ b/sonar-batch/src/main/java/org/sonar/batch/bootstrap/BatchSettings.java @@ -26,7 +26,7 @@ import org.json.simple.JSONValue; import org.slf4j.LoggerFactory; import org.sonar.api.CoreProperties; import org.sonar.api.batch.bootstrap.ProjectDefinition; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; import javax.annotation.Nullable; @@ -44,9 +44,9 @@ public class BatchSettings extends Settings { private final BootstrapSettings bootstrapSettings; private final ServerClient client; - public BatchSettings(BootstrapSettings bootstrapSettings, PropertyDefs propertyDefs, + public BatchSettings(BootstrapSettings bootstrapSettings, PropertyDefinitions propertyDefinitions, ServerClient client, Configuration deprecatedConfiguration) { - super(propertyDefs); + super(propertyDefinitions); this.bootstrapSettings = bootstrapSettings; this.client = client; this.deprecatedConfiguration = deprecatedConfiguration; diff --git a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchSettingsTest.java b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchSettingsTest.java index 870a88002b2..7ac5b3ba19b 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchSettingsTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/bootstrap/BatchSettingsTest.java @@ -23,7 +23,7 @@ import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.configuration.Configuration; import org.junit.Test; import org.sonar.api.batch.bootstrap.ProjectDefinition; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import java.util.Collections; import java.util.Map; @@ -52,7 +52,7 @@ public class BatchSettingsTest { // Reconstruct bootstrap settings to get system property bootstrapSettings = new BootstrapSettings(new BootstrapProperties(Collections.<String, String> emptyMap())); - BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefs(), client, deprecatedConf); + BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefinitions(), client, deprecatedConf); assertThat(batchSettings.getString("BatchSettingsTest.testSystemProp")).isEqualTo("system"); } @@ -63,7 +63,7 @@ public class BatchSettingsTest { when(client.request("/batch_bootstrap/properties?project=struts")).thenReturn(REACTOR_JSON_RESPONSE); project.setProperty("project.prop", "project"); - BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefs(), client, deprecatedConf); + BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefinitions(), client, deprecatedConf); batchSettings.init(project); assertThat(batchSettings.getString("project.prop")).isEqualTo("project"); @@ -73,7 +73,7 @@ public class BatchSettingsTest { public void should_load_global_settings() { when(client.request("/batch_bootstrap/properties")).thenReturn(JSON_RESPONSE); - BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefs(), client, deprecatedConf); + BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefinitions(), client, deprecatedConf); assertThat(batchSettings.getBoolean("sonar.cpd.cross")).isTrue(); } @@ -83,7 +83,7 @@ public class BatchSettingsTest { when(client.request("/batch_bootstrap/properties")).thenReturn(JSON_RESPONSE); when(client.request("/batch_bootstrap/properties?project=struts")).thenReturn(REACTOR_JSON_RESPONSE); - BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefs(), client, deprecatedConf); + BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefinitions(), client, deprecatedConf); batchSettings.init(project); assertThat(batchSettings.getString("sonar.java.coveragePlugin")).isEqualTo("jacoco"); @@ -94,7 +94,7 @@ public class BatchSettingsTest { when(client.request("/batch_bootstrap/properties")).thenReturn(JSON_RESPONSE); when(client.request("/batch_bootstrap/properties?project=struts")).thenReturn(REACTOR_JSON_RESPONSE); - BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefs(), client, deprecatedConf); + BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefinitions(), client, deprecatedConf); batchSettings.init(project); Map<String, String> moduleSettings = batchSettings.getModuleProperties("struts-core"); @@ -109,7 +109,7 @@ public class BatchSettingsTest { System.setProperty("BatchSettingsTest.testSystemProp", "system"); project.setProperty("BatchSettingsTest.testSystemProp", "build"); - BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefs(), client, deprecatedConf); + BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefinitions(), client, deprecatedConf); assertThat(batchSettings.getString("BatchSettingsTest.testSystemProp")).isEqualTo("system"); } @@ -119,7 +119,7 @@ public class BatchSettingsTest { when(client.request("/batch_bootstrap/properties")).thenReturn(JSON_RESPONSE); when(client.request("/batch_bootstrap/properties?project=struts")).thenReturn(REACTOR_JSON_RESPONSE); - BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefs(), client, deprecatedConf); + BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefinitions(), client, deprecatedConf); batchSettings.init(project); assertThat(deprecatedConf.getString("sonar.cpd.cross")).isEqualTo("true"); @@ -137,7 +137,7 @@ public class BatchSettingsTest { @Test public void project_should_be_optional() { when(client.request("/batch_bootstrap/properties")).thenReturn(JSON_RESPONSE); - BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefs(), client, deprecatedConf); + BatchSettings batchSettings = new BatchSettings(bootstrapSettings, new PropertyDefinitions(), client, deprecatedConf); assertThat(batchSettings.getProperties()).isNotEmpty(); } } diff --git a/sonar-batch/src/test/java/org/sonar/batch/scan/ModuleSettingsTest.java b/sonar-batch/src/test/java/org/sonar/batch/scan/ModuleSettingsTest.java index 1207c93e7f8..e3487f6dd79 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/scan/ModuleSettingsTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/scan/ModuleSettingsTest.java @@ -24,7 +24,7 @@ import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.PropertiesConfiguration; import org.junit.Test; import org.sonar.api.batch.bootstrap.ProjectDefinition; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import org.sonar.batch.bootstrap.BatchSettings; import java.util.List; @@ -52,7 +52,7 @@ public class ModuleSettingsTest { @Test public void test_loading_of_module_settings() { BatchSettings batchSettings = mock(BatchSettings.class); - when(batchSettings.getDefinitions()).thenReturn(new PropertyDefs()); + when(batchSettings.getDefinitions()).thenReturn(new PropertyDefinitions()); when(batchSettings.getProperties()).thenReturn(ImmutableMap.of( "overridding", "batch", "on-batch", "true" diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDef.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDef.java index a8736d58661..4c8db9efb3b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDef.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDef.java @@ -72,7 +72,7 @@ public final class PropertyDef implements BatchExtension, ServerExtension { private boolean multiValues; private String propertySetKey; private String deprecatedKey; - private List<PropertyFieldDef> fields; + private List<PropertyFieldDefinition> fields; private String subcategory; private int index; @@ -109,7 +109,7 @@ public final class PropertyDef implements BatchExtension, ServerExtension { .options(Arrays.asList(annotation.options())) .multiValues(annotation.multiValues()) .propertySetKey(annotation.propertySetKey()) - .fields(PropertyFieldDef.create(annotation.fields())) + .fields(PropertyFieldDefinition.create(annotation.fields())) .deprecatedKey(annotation.deprecatedKey()); List<String> qualifiers = newArrayList(); if (annotation.project()) { @@ -227,7 +227,7 @@ public final class PropertyDef implements BatchExtension, ServerExtension { return propertySetKey; } - public List<PropertyFieldDef> fields() { + public List<PropertyFieldDefinition> fields() { return fields; } @@ -280,7 +280,7 @@ public final class PropertyDef implements BatchExtension, ServerExtension { private List<String> options = newArrayList(); private boolean multiValues = false; private String propertySetKey = ""; - private List<PropertyFieldDef> fields = newArrayList(); + private List<PropertyFieldDefinition> fields = newArrayList(); private String deprecatedKey = ""; private boolean hidden = false; private int index = 999; @@ -363,12 +363,12 @@ public final class PropertyDef implements BatchExtension, ServerExtension { return this; } - public Builder fields(PropertyFieldDef first, PropertyFieldDef... rest) { + public Builder fields(PropertyFieldDefinition first, PropertyFieldDefinition... rest) { this.fields.addAll(Lists.asList(first, rest)); return this; } - public Builder fields(List<PropertyFieldDef> fields) { + public Builder fields(List<PropertyFieldDefinition> fields) { this.fields.addAll(ImmutableList.copyOf(fields)); return this; } diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefs.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java index a8a55ede663..452ba25f82e 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefs.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyDefinitions.java @@ -37,7 +37,7 @@ import java.util.*; * * @since 2.12 */ -public final class PropertyDefs implements BatchComponent, ServerComponent { +public final class PropertyDefinitions implements BatchComponent, ServerComponent { private final Map<String, PropertyDef> definitions = Maps.newHashMap(); private final Map<String, String> categories = Maps.newHashMap(); @@ -46,28 +46,28 @@ public final class PropertyDefs implements BatchComponent, ServerComponent { // deprecated key -> new key private final Map<String, String> deprecatedKeys = Maps.newHashMap(); - public PropertyDefs(Object... components) { + public PropertyDefinitions(Object... components) { if (components != null) { addComponents(Arrays.asList(components)); } } - public PropertyDefs addComponents(Collection components) { + public PropertyDefinitions addComponents(Collection components) { return addComponents(components, ""); } - public PropertyDefs addComponents(Collection components, String defaultCategory) { + public PropertyDefinitions addComponents(Collection components, String defaultCategory) { for (Object component : components) { addComponent(component, defaultCategory); } return this; } - public PropertyDefs addComponent(Object object) { + public PropertyDefinitions addComponent(Object object) { return addComponent(object, ""); } - public PropertyDefs addComponent(Object component, String defaultCategory) { + public PropertyDefinitions addComponent(Object component, String defaultCategory) { addComponentFromAnnotationProperty(component, defaultCategory); if (component instanceof PropertyDef) { PropertyDef propertyDefinition = (PropertyDef) component; @@ -76,7 +76,7 @@ public final class PropertyDefs implements BatchComponent, ServerComponent { return this; } - private PropertyDefs addComponentFromAnnotationProperty(Object component, String defaultCategory) { + private PropertyDefinitions addComponentFromAnnotationProperty(Object component, String defaultCategory) { Properties annotations = AnnotationUtils.getAnnotation(component, Properties.class); if (annotations != null) { for (Property property : annotations.value()) { @@ -90,12 +90,12 @@ public final class PropertyDefs implements BatchComponent, ServerComponent { return this; } - private PropertyDefs addProperty(Property property, String defaultCategory) { + private PropertyDefinitions addProperty(Property property, String defaultCategory) { PropertyDef definition = PropertyDef.create(property); return add(definition, defaultCategory); } - private PropertyDefs add(PropertyDef 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)); diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDef.java b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDefinition.java index f9928122df5..3c3d4748ccd 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDef.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/config/PropertyFieldDefinition.java @@ -34,7 +34,7 @@ import static com.google.common.collect.Lists.newArrayList; /** * @since 3.3 */ -public final class PropertyFieldDef { +public final class PropertyFieldDefinition { private final String key; private final String name; private final String description; @@ -42,7 +42,7 @@ public final class PropertyFieldDef { private final PropertyType type; private final List<String> options; - private PropertyFieldDef(Builder builder) { + private PropertyFieldDefinition(Builder builder) { this.key = builder.key; this.name = builder.name; this.description = builder.description; @@ -51,16 +51,16 @@ public final class PropertyFieldDef { this.options = builder.options; } - static List<PropertyFieldDef> create(PropertyField[] fields) { - List<PropertyFieldDef> definitions = newArrayList(); + static List<PropertyFieldDefinition> create(PropertyField[] fields) { + List<PropertyFieldDefinition> definitions = newArrayList(); for (PropertyField field : fields) { - definitions.add(PropertyFieldDef.build(field.key()) - .name(field.name()) - .description(field.description()) - .indicativeSize(field.indicativeSize()) - .type(field.type()) - .options(field.options()) - .build() + definitions.add(PropertyFieldDefinition.build(field.key()) + .name(field.name()) + .description(field.description()) + .indicativeSize(field.indicativeSize()) + .type(field.type()) + .options(field.options()) + .build() ); } return definitions; @@ -145,10 +145,10 @@ public final class PropertyFieldDef { return this; } - public PropertyFieldDef build() { + public PropertyFieldDefinition build() { Preconditions.checkArgument(!Strings.isNullOrEmpty(key), "Key must be set"); Preconditions.checkArgument(!Strings.isNullOrEmpty(name), "Name must be set"); - return new PropertyFieldDef(this); + return new PropertyFieldDefinition(this); } } } 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 c6de094d007..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 @@ -51,14 +51,14 @@ import java.util.Properties; public class Settings implements BatchComponent, ServerComponent { protected Map<String, String> properties; - protected PropertyDefs definitions; + protected PropertyDefinitions definitions; private Encryption encryption; public Settings() { - this(new PropertyDefs()); + this(new PropertyDefinitions()); } - public Settings(PropertyDefs definitions) { + public Settings(PropertyDefinitions definitions) { this.properties = Maps.newHashMap(); this.definitions = definitions; this.encryption = new Encryption(this); @@ -364,7 +364,7 @@ public class Settings implements BatchComponent, ServerComponent { return ImmutableMap.copyOf(properties); } - public PropertyDefs getDefinitions() { + public PropertyDefinitions getDefinitions() { return definitions; } @@ -373,7 +373,7 @@ public class Settings implements BatchComponent, ServerComponent { * This method is usually used by unit tests. */ public static Settings createForComponent(Object component) { - return new Settings(new PropertyDefs(component)); + return new Settings(new PropertyDefinitions(component)); } protected void doOnSetProperty(String key, @Nullable String value) { diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ComponentContainer.java b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ComponentContainer.java index 21774a6631c..860f297b032 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/platform/ComponentContainer.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/platform/ComponentContainer.java @@ -29,7 +29,7 @@ import org.picocontainer.lifecycle.ReflectionLifecycleStrategy; import org.picocontainer.monitors.NullComponentMonitor; import org.sonar.api.BatchComponent; import org.sonar.api.ServerComponent; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import javax.annotation.Nullable; @@ -42,7 +42,7 @@ public class ComponentContainer implements BatchComponent, ServerComponent { ComponentContainer parent, child; // no need for multiple children MutablePicoContainer pico; - PropertyDefs propertyDefs; + PropertyDefinitions propertyDefinitions; /** * Create root container @@ -51,8 +51,8 @@ public class ComponentContainer implements BatchComponent, ServerComponent { this.parent = null; this.child = null; this.pico = createPicoContainer(); - propertyDefs = new PropertyDefs(); - addSingleton(propertyDefs); + propertyDefinitions = new PropertyDefinitions(); + addSingleton(propertyDefinitions); addSingleton(this); } @@ -63,7 +63,7 @@ public class ComponentContainer implements BatchComponent, ServerComponent { this.parent = parent; this.pico = parent.pico.makeChildContainer(); this.parent.child = this; - this.propertyDefs = parent.propertyDefs; + this.propertyDefinitions = parent.propertyDefinitions; addSingleton(this); } @@ -170,7 +170,7 @@ public class ComponentContainer implements BatchComponent, ServerComponent { } public void declareExtension(@Nullable PluginMetadata plugin, Object extension) { - propertyDefs.addComponent(extension, plugin != null ? plugin.getName() : ""); + propertyDefinitions.addComponent(extension, plugin != null ? plugin.getName() : ""); } public ComponentContainer addPicoAdapter(ComponentAdapter adapter) { diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefTest.java index 416ab35b4b7..4a284b97c30 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefTest.java @@ -139,8 +139,8 @@ public class PropertyDefTest { PropertyDef def = PropertyDef.builder("hello") .name("Hello") .fields( - PropertyFieldDef.build("first").name("First").description("Description").options("A", "B").build(), - PropertyFieldDef.build("second").name("Second").type(PropertyType.INTEGER).indicativeSize(5).build() + PropertyFieldDefinition.build("first").name("First").description("Description").options("A", "B").build(), + PropertyFieldDefinition.build("second").name("Second").type(PropertyType.INTEGER).indicativeSize(5).build() ) .build(); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionsTest.java index 5765ec28b64..cdd9afc4f0e 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/PropertyDefinitionsTest.java @@ -26,11 +26,11 @@ import org.sonar.api.resources.Qualifiers; import static org.fest.assertions.Assertions.assertThat; -public class PropertyDefsTest { +public class PropertyDefinitionsTest { @Test public void should_inspect_plugin_objects() { - PropertyDefs def = new PropertyDefs( + PropertyDefinitions def = new PropertyDefinitions( PropertyDef.builder("foo").name("Foo").build(), PropertyDef.builder("one").name("One").build(), PropertyDef.builder("two").name("Two").defaultValue("2").build() @@ -41,21 +41,21 @@ public class PropertyDefsTest { @Test public void should_inspect_annotation_plugin_objects() { - PropertyDefs def = new PropertyDefs(new PluginWithProperty(), new PluginWithProperties()); + PropertyDefinitions def = new PropertyDefinitions(new PluginWithProperty(), new PluginWithProperties()); assertProperties(def); } @Test public void should_inspect_plugin_classes() { - PropertyDefs def = new PropertyDefs(PluginWithProperty.class, PluginWithProperties.class); + PropertyDefinitions def = new PropertyDefinitions(PluginWithProperty.class, PluginWithProperties.class); assertProperties(def); } @Test public void test_categories() { - PropertyDefs def = new PropertyDefs( + PropertyDefinitions def = new PropertyDefinitions( PropertyDef.builder("inCateg").name("In Categ").category("categ").build(), PropertyDef.builder("noCateg").name("No categ").build() ); @@ -66,7 +66,7 @@ public class PropertyDefsTest { @Test public void test_categories_on_annotation_plugin() { - PropertyDefs def = new PropertyDefs(Categories.class); + PropertyDefinitions def = new PropertyDefinitions(Categories.class); assertThat(def.getCategory("inCateg")).isEqualTo("categ"); assertThat(def.getCategory("noCateg")).isEqualTo(""); @@ -74,7 +74,7 @@ public class PropertyDefsTest { @Test public void test_default_category() { - PropertyDefs def = new PropertyDefs(); + PropertyDefinitions def = new PropertyDefinitions(); def.addComponent(PropertyDef.builder("inCateg").name("In Categ").category("categ").build(), "default"); def.addComponent(PropertyDef.builder("noCateg").name("No categ").build(), "default"); @@ -84,7 +84,7 @@ public class PropertyDefsTest { @Test public void test_default_category_on_annotation_plugin() { - PropertyDefs def = new PropertyDefs(); + PropertyDefinitions def = new PropertyDefinitions(); def.addComponent(Categories.class, "default"); assertThat(def.getCategory("inCateg")).isEqualTo("categ"); assertThat(def.getCategory("noCateg")).isEqualTo("default"); @@ -92,7 +92,7 @@ public class PropertyDefsTest { @Test public void should_group_by_category() { - PropertyDefs def = new PropertyDefs( + PropertyDefinitions def = new PropertyDefinitions( PropertyDef.builder("global1").name("Global1").category("catGlobal1").build(), PropertyDef.builder("global2").name("Global2").category("catGlobal1").build(), PropertyDef.builder("global3").name("Global3").category("catGlobal2").build(), @@ -110,7 +110,7 @@ public class PropertyDefsTest { @Test public void should_group_by_subcategory() { - PropertyDefs def = new PropertyDefs( + PropertyDefinitions def = new PropertyDefinitions( 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(), @@ -123,14 +123,14 @@ public class PropertyDefsTest { @Test public void should_group_by_category_on_annotation_plugin() { - PropertyDefs def = new PropertyDefs(ByCategory.class); + PropertyDefinitions def = new PropertyDefinitions(ByCategory.class); assertThat(def.getPropertiesByCategory().keySet()).containsOnly("catGlobal1", "catGlobal2"); assertThat(def.getPropertiesByCategory(Qualifiers.PROJECT).keySet()).containsOnly("catProject"); assertThat(def.getPropertiesByCategory(Qualifiers.MODULE).keySet()).containsOnly("catModule"); } - private void assertProperties(PropertyDefs definitions) { + private void assertProperties(PropertyDefinitions definitions) { assertThat(definitions.get("foo").name()).isEqualTo("Foo"); assertThat(definitions.get("one").name()).isEqualTo("One"); assertThat(definitions.get("two").name()).isEqualTo("Two"); diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java index 91280833a91..228e0ee6e12 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/config/SettingsTest.java @@ -33,7 +33,7 @@ import static org.fest.assertions.Assertions.assertThat; public class SettingsTest { - private PropertyDefs definitions; + private PropertyDefinitions definitions; @Properties({ @Property(key = "hello", name = "Hello", defaultValue = "world"), @@ -57,7 +57,7 @@ public class SettingsTest { @Before public void init_definitions() { - definitions = new PropertyDefs(); + definitions = new PropertyDefinitions(); definitions.addComponent(Init.class); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentContainerTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentContainerTest.java index 6a3bfa07658..6f1a766d303 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentContainerTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/platform/ComponentContainerTest.java @@ -24,7 +24,7 @@ import org.junit.Test; import org.junit.rules.ExpectedException; import org.picocontainer.injectors.ProviderAdapter; import org.sonar.api.Property; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import java.util.Arrays; @@ -157,9 +157,9 @@ public class ComponentContainerTest { ComponentContainer container = new ComponentContainer(); container.addSingleton(ComponentWithProperty.class); - PropertyDefs propertyDefs = container.getComponentByType(PropertyDefs.class); - assertThat(propertyDefs.get("foo")).isNotNull(); - assertThat(propertyDefs.get("foo").defaultValue()).isEqualTo("bar"); + PropertyDefinitions propertyDefinitions = container.getComponentByType(PropertyDefinitions.class); + assertThat(propertyDefinitions.get("foo")).isNotNull(); + assertThat(propertyDefinitions.get("foo").defaultValue()).isEqualTo("bar"); } @Test @@ -168,8 +168,8 @@ public class ComponentContainerTest { PluginMetadata plugin = mock(PluginMetadata.class); container.declareExtension(plugin, ComponentWithProperty.class); - PropertyDefs propertyDefs = container.getComponentByType(PropertyDefs.class); - assertThat(propertyDefs.get("foo")).isNotNull(); + PropertyDefinitions propertyDefinitions = container.getComponentByType(PropertyDefinitions.class); + assertThat(propertyDefinitions.get("foo")).isNotNull(); assertThat(container.getComponentByType(ComponentWithProperty.class)).isNull(); } @@ -179,8 +179,8 @@ public class ComponentContainerTest { PluginMetadata plugin = mock(PluginMetadata.class); container.addExtension(plugin, ComponentWithProperty.class); - PropertyDefs propertyDefs = container.getComponentByType(PropertyDefs.class); - assertThat(propertyDefs.get("foo")).isNotNull(); + PropertyDefinitions propertyDefinitions = container.getComponentByType(PropertyDefinitions.class); + assertThat(propertyDefinitions.get("foo")).isNotNull(); assertThat(container.getComponentByType(ComponentWithProperty.class)).isNotNull(); assertThat(container.getComponentByKey(ComponentWithProperty.class)).isNotNull(); } diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasProjectPropertyConditionTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasProjectPropertyConditionTest.java index 32a382cb6d3..37f9d9940c8 100644 --- a/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasProjectPropertyConditionTest.java +++ b/sonar-plugin-api/src/test/java/org/sonar/api/workflow/condition/HasProjectPropertyConditionTest.java @@ -22,7 +22,7 @@ package org.sonar.api.workflow.condition; import org.junit.Test; import org.sonar.api.Properties; import org.sonar.api.Property; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; import org.sonar.api.workflow.internal.DefaultReview; import org.sonar.api.workflow.internal.DefaultWorkflowContext; @@ -50,7 +50,7 @@ public class HasProjectPropertyConditionTest { public void returnTrueIfDefaultValue() { HasProjectPropertyCondition condition = new HasProjectPropertyCondition("jira.url"); DefaultWorkflowContext context = new DefaultWorkflowContext(); - context.setSettings(new Settings(new PropertyDefs().addComponent(WithDefaultValue.class))); + context.setSettings(new Settings(new PropertyDefinitions().addComponent(WithDefaultValue.class))); assertThat(condition.doVerify(new DefaultReview(), context)).isTrue(); } diff --git a/sonar-server/src/main/java/org/sonar/server/platform/ServerSettings.java b/sonar-server/src/main/java/org/sonar/server/platform/ServerSettings.java index 115e010fff8..a357d077fe8 100644 --- a/sonar-server/src/main/java/org/sonar/server/platform/ServerSettings.java +++ b/sonar-server/src/main/java/org/sonar/server/platform/ServerSettings.java @@ -22,7 +22,7 @@ package org.sonar.server.platform; import com.google.common.annotations.VisibleForTesting; import org.apache.commons.configuration.Configuration; import org.sonar.api.CoreProperties; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; import org.sonar.core.config.ConfigurationUtils; @@ -53,12 +53,12 @@ public class ServerSettings extends Settings { private File deployDir; private File sonarHome; - public ServerSettings(PropertyDefs definitions, Configuration deprecatedConfiguration, ServletContext servletContext) { + public ServerSettings(PropertyDefinitions definitions, Configuration deprecatedConfiguration, ServletContext servletContext) { this(definitions, deprecatedConfiguration, getDeployDir(servletContext), SonarHome.getHome()); } @VisibleForTesting - ServerSettings(PropertyDefs definitions, Configuration deprecatedConfiguration, File deployDir, File sonarHome) { + ServerSettings(PropertyDefinitions definitions, Configuration deprecatedConfiguration, File deployDir, File sonarHome) { super(definitions); this.deprecatedConfiguration = deprecatedConfiguration; this.deployDir = deployDir; 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 ac4a2aace4d..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 @@ -22,7 +22,7 @@ package org.sonar.server.startup; import com.google.common.base.Strings; import org.slf4j.LoggerFactory; import org.sonar.api.config.PropertyDef; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import org.sonar.core.properties.PropertiesDao; /** @@ -31,9 +31,9 @@ import org.sonar.core.properties.PropertiesDao; public class RenameDeprecatedPropertyKeys { private PropertiesDao dao; - private PropertyDefs definitions; + private PropertyDefinitions definitions; - public RenameDeprecatedPropertyKeys(PropertiesDao dao, PropertyDefs definitions) { + public RenameDeprecatedPropertyKeys(PropertiesDao dao, PropertyDefinitions definitions) { this.dao = dao; this.definitions = definitions; } diff --git a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java index 5892a089b21..0e16d6329d7 100644 --- a/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java +++ b/sonar-server/src/main/java/org/sonar/server/ui/JRubyFacade.java @@ -23,7 +23,7 @@ import com.google.common.collect.ListMultimap; import org.slf4j.LoggerFactory; import org.sonar.api.CoreProperties; import org.sonar.api.config.License; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import org.sonar.api.config.Settings; import org.sonar.api.platform.ComponentContainer; import org.sonar.api.platform.NewUserHandler; @@ -185,8 +185,8 @@ public final class JRubyFacade { } // PLUGINS ------------------------------------------------------------------ - public PropertyDefs getPropertyDefinitions() { - return get(PropertyDefs.class); + public PropertyDefinitions getPropertyDefinitions() { + return get(PropertyDefinitions.class); } public boolean hasPlugin(String key) { diff --git a/sonar-server/src/test/java/org/sonar/server/platform/PersistentSettingsTest.java b/sonar-server/src/test/java/org/sonar/server/platform/PersistentSettingsTest.java index dc034d3807b..737cdb50c12 100644 --- a/sonar-server/src/test/java/org/sonar/server/platform/PersistentSettingsTest.java +++ b/sonar-server/src/test/java/org/sonar/server/platform/PersistentSettingsTest.java @@ -24,7 +24,7 @@ import org.apache.commons.configuration.PropertiesConfiguration; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentMatcher; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import org.sonar.core.properties.PropertiesDao; import org.sonar.core.properties.PropertyDto; @@ -45,7 +45,7 @@ public class PersistentSettingsTest { public void init() throws URISyntaxException { dao = mock(PropertiesDao.class); settings = new ServerSettings( - new PropertyDefs(), + new PropertyDefinitions(), new PropertiesConfiguration(), new File("."), new File(PersistentSettingsTest.class.getResource("/org/sonar/server/platform/PersistentSettingsTest/").toURI())); diff --git a/sonar-server/src/test/java/org/sonar/server/platform/ServerSettingsTest.java b/sonar-server/src/test/java/org/sonar/server/platform/ServerSettingsTest.java index 46ae543034f..a9b181ca343 100644 --- a/sonar-server/src/test/java/org/sonar/server/platform/ServerSettingsTest.java +++ b/sonar-server/src/test/java/org/sonar/server/platform/ServerSettingsTest.java @@ -22,7 +22,7 @@ package org.sonar.server.platform; import com.google.common.collect.ImmutableMap; import org.apache.commons.configuration.BaseConfiguration; import org.junit.Test; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import java.io.File; import java.net.URISyntaxException; @@ -36,7 +36,7 @@ public class ServerSettingsTest { @Test public void load_properties_file() { - ServerSettings settings = new ServerSettings(new PropertyDefs(), new BaseConfiguration(), new File("."), home); + ServerSettings settings = new ServerSettings(new PropertyDefinitions(), new BaseConfiguration(), new File("."), home); assertThat(settings.getString("hello")).isEqualTo("world"); } @@ -44,7 +44,7 @@ public class ServerSettingsTest { @Test public void systemPropertiesShouldOverridePropertiesFile() { System.setProperty("ServerSettingsTestEnv", "in_env"); - ServerSettings settings = new ServerSettings(new PropertyDefs(), new BaseConfiguration(), new File("."), home); + ServerSettings settings = new ServerSettings(new PropertyDefinitions(), new BaseConfiguration(), new File("."), home); assertThat(settings.getString("ServerSettingsTestEnv")).isEqualTo("in_env"); } @@ -52,12 +52,12 @@ public class ServerSettingsTest { @Test(expected = IllegalStateException.class) public void fail_if_properties_file_is_not_found() { File sonarHome = new File("unknown/path"); - new ServerSettings(new PropertyDefs(), new BaseConfiguration(), new File("."), sonarHome); + new ServerSettings(new PropertyDefinitions(), new BaseConfiguration(), new File("."), sonarHome); } @Test public void activateDatabaseSettings() { - ServerSettings settings = new ServerSettings(new PropertyDefs(), new BaseConfiguration(), new File("."), home); + ServerSettings settings = new ServerSettings(new PropertyDefinitions(), new BaseConfiguration(), new File("."), home); Map<String, String> databaseProperties = ImmutableMap.of("in_db", "true"); settings.activateDatabaseSettings(databaseProperties); @@ -67,7 +67,7 @@ public class ServerSettingsTest { @Test public void file_settings_override_db_settings() { - ServerSettings settings = new ServerSettings(new PropertyDefs(), new BaseConfiguration(), new File("."), home); + ServerSettings settings = new ServerSettings(new PropertyDefinitions(), new BaseConfiguration(), new File("."), home); assertThat(settings.getString("in_file")).isEqualTo("true"); Map<String, String> databaseProperties = ImmutableMap.of("in_file", "false"); @@ -79,7 +79,7 @@ public class ServerSettingsTest { @Test public void synchronize_deprecated_commons_configuration() { BaseConfiguration deprecated = new BaseConfiguration(); - ServerSettings settings = new ServerSettings(new PropertyDefs(), deprecated, new File("."), home); + ServerSettings settings = new ServerSettings(new PropertyDefinitions(), deprecated, new File("."), home); assertThat(settings.getString("in_file")).isEqualTo("true"); assertThat(deprecated.getString("in_file")).isEqualTo("true"); diff --git a/sonar-server/src/test/java/org/sonar/server/startup/RenameDeprecatedPropertyKeysTest.java b/sonar-server/src/test/java/org/sonar/server/startup/RenameDeprecatedPropertyKeysTest.java index e08e5ecda91..eea101c7e38 100644 --- a/sonar-server/src/test/java/org/sonar/server/startup/RenameDeprecatedPropertyKeysTest.java +++ b/sonar-server/src/test/java/org/sonar/server/startup/RenameDeprecatedPropertyKeysTest.java @@ -22,7 +22,7 @@ package org.sonar.server.startup; import org.junit.Test; import org.sonar.api.Properties; import org.sonar.api.Property; -import org.sonar.api.config.PropertyDefs; +import org.sonar.api.config.PropertyDefinitions; import org.sonar.core.properties.PropertiesDao; import static org.mockito.Mockito.*; @@ -31,7 +31,7 @@ public class RenameDeprecatedPropertyKeysTest { @Test public void should_rename_deprecated_keys() { PropertiesDao dao = mock(PropertiesDao.class); - PropertyDefs definitions = new PropertyDefs(FakeExtension.class); + PropertyDefinitions definitions = new PropertyDefinitions(FakeExtension.class); RenameDeprecatedPropertyKeys task = new RenameDeprecatedPropertyKeys(dao, definitions); task.start(); |