diff options
author | Robert Godfrey <rgodfrey@apache.org> | 2014-08-05 18:13:55 +0000 |
---|---|---|
committer | Robert Godfrey <rgodfrey@apache.org> | 2014-08-05 18:13:55 +0000 |
commit | e4551106b672069e603e55c5ae2f433607e96e39 (patch) | |
tree | 6edd0a5e19f9c98e1c80d2edda8ab8e0e2d55d95 /qpid | |
parent | 81e41c8a360e6b92c5b29ec7061d8447ded75945 (diff) | |
download | qpid-python-e4551106b672069e603e55c5ae2f433607e96e39.tar.gz |
QPID-5940 : Make ConfiguredObjectTypeRegistry more easy to test, and add some tests
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1615969 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid')
20 files changed, 379 insertions, 85 deletions
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java index 8b9effbd16..6c8945582c 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractConfiguredObject.java @@ -197,9 +197,9 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im _category = ConfiguredObjectTypeRegistry.getCategory(getClass()); - _attributeTypes = ConfiguredObjectTypeRegistry.getAttributeTypes(getClass()); - _automatedFields = ConfiguredObjectTypeRegistry.getAutomatedFields(getClass()); - _stateChangeMethods = ConfiguredObjectTypeRegistry.getStateChangeMethods(getClass()); + _attributeTypes = model.getTypeRegistry().getAttributeTypes(getClass()); + _automatedFields = model.getTypeRegistry().getAutomatedFields(getClass()); + _stateChangeMethods = model.getTypeRegistry().getStateChangeMethods(getClass()); Object idObj = attributes.get(ID); @@ -1044,7 +1044,7 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im public final Collection<String> getAttributeNames() { - return ConfiguredObjectTypeRegistry.getAttributeNames(getClass()); + return _model.getTypeRegistry().getAttributeNames(getClass()); } @Override @@ -1369,7 +1369,7 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im @Override public Map<String,Number> getStatistics() { - Collection<ConfiguredObjectStatistic> stats = ConfiguredObjectTypeRegistry.getStatistics(getClass()); + Collection<ConfiguredObjectStatistic> stats = _model.getTypeRegistry().getStatistics(getClass()); Map<String,Number> map = new HashMap<String,Number>(); for(ConfiguredObjectStatistic stat : stats) { @@ -1439,7 +1439,7 @@ public abstract class AbstractConfiguredObject<X extends ConfiguredObject<X>> im new Strings.MapResolver(inheritedContext), Strings.JAVA_SYS_PROPS_RESOLVER, Strings.ENV_VARS_RESOLVER, - ConfiguredObjectTypeRegistry.getDefaultContextResolver()); + object.getModel().getTypeRegistry().getDefaultContextResolver()); } private static OwnAttributeResolver getOwnAttributeResolver(final ConfiguredObject<?> object) diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java index e7e8bdd5e9..df6a6e4cea 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/AbstractUnresolvedObject.java @@ -50,7 +50,7 @@ public abstract class AbstractUnresolvedObject<C extends ConfiguredObject<C>> im _parents = parents; Collection<ConfiguredObjectAttribute<? super C, ?>> attributes = - ConfiguredObjectTypeRegistry.getAttributes(clazz); + parents[0].getModel().getTypeRegistry().getAttributes(clazz); for(ConfiguredObjectAttribute<? super C, ?> attribute : attributes) { if(attribute.isPersisted()) diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java index 39a40781dd..2cffea5d73 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/BrokerModel.java @@ -28,6 +28,9 @@ import java.util.HashSet; import java.util.Map; import java.util.Set; +import org.apache.qpid.server.plugin.ConfiguredObjectRegistration; +import org.apache.qpid.server.plugin.QpidServiceLoader; + public final class BrokerModel extends Model { @@ -52,6 +55,7 @@ public final class BrokerModel extends Model private final Set<Class<? extends ConfiguredObject>> _supportedTypes = new HashSet<Class<? extends ConfiguredObject>>(); + private final ConfiguredObjectTypeRegistry _typeRegistry; private Class<? extends ConfiguredObject> _rootCategory; private final ConfiguredObjectFactory _objectFactory; @@ -101,8 +105,15 @@ public final class BrokerModel extends Model addRelationship(Session.class, Publisher.class); _objectFactory = new ConfiguredObjectFactoryImpl(this); + _typeRegistry = new ConfiguredObjectTypeRegistry((new QpidServiceLoader<ConfiguredObjectRegistration>()).instancesOf(ConfiguredObjectRegistration.class), getSupportedCategories()); } + public final ConfiguredObjectTypeRegistry getTypeRegistry() + { + return _typeRegistry; + } + + public static Model getInstance() { return MODEL_INSTANCE; diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java index 66ae7b2d2e..3201ff16f1 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistry.java @@ -36,8 +36,8 @@ import java.util.SortedSet; import java.util.TreeSet; import org.apache.log4j.Logger; + import org.apache.qpid.server.plugin.ConfiguredObjectRegistration; -import org.apache.qpid.server.plugin.QpidServiceLoader; import org.apache.qpid.server.util.ServerScopedRuntimeException; import org.apache.qpid.util.Strings; @@ -56,66 +56,71 @@ public class ConfiguredObjectTypeRegistry }; - private static final Map<Class<? extends ConfiguredObject>, Collection<ConfiguredObjectAttribute<?,?>>> _allAttributes = + private final Map<Class<? extends ConfiguredObject>, Collection<ConfiguredObjectAttribute<?,?>>> _allAttributes = Collections.synchronizedMap(new HashMap<Class<? extends ConfiguredObject>, Collection<ConfiguredObjectAttribute<?, ?>>>()); - private static final Map<Class<? extends ConfiguredObject>, Collection<ConfiguredObjectStatistic<?,?>>> _allStatistics = + private final Map<Class<? extends ConfiguredObject>, Collection<ConfiguredObjectStatistic<?,?>>> _allStatistics = Collections.synchronizedMap(new HashMap<Class<? extends ConfiguredObject>, Collection<ConfiguredObjectStatistic<?, ?>>>()); - private static final Map<Class<? extends ConfiguredObject>, Map<String, ConfiguredObjectAttribute<?,?>>> _allAttributeTypes = + private final Map<Class<? extends ConfiguredObject>, Map<String, ConfiguredObjectAttribute<?,?>>> _allAttributeTypes = Collections.synchronizedMap(new HashMap<Class<? extends ConfiguredObject>, Map<String, ConfiguredObjectAttribute<?, ?>>>()); - private static final Map<Class<? extends ConfiguredObject>, Map<String, AutomatedField>> _allAutomatedFields = + private final Map<Class<? extends ConfiguredObject>, Map<String, AutomatedField>> _allAutomatedFields = Collections.synchronizedMap(new HashMap<Class<? extends ConfiguredObject>, Map<String, AutomatedField>>()); - private static final Map<String, String> _defaultContext = + private final Map<String, String> _defaultContext = Collections.synchronizedMap(new HashMap<String, String>()); - private static final Map<Class<? extends ConfiguredObject>,Set<Class<? extends ConfiguredObject>>> _knownTypes = + private final Map<Class<? extends ConfiguredObject>,Set<Class<? extends ConfiguredObject>>> _knownTypes = Collections.synchronizedMap(new HashMap<Class<? extends ConfiguredObject>, Set<Class<? extends ConfiguredObject>>>()); - private static final Map<Class<? extends ConfiguredObject>, Collection<ConfiguredObjectAttribute<?,?>>> _typeSpecificAttributes = + private final Map<Class<? extends ConfiguredObject>, Collection<ConfiguredObjectAttribute<?,?>>> _typeSpecificAttributes = Collections.synchronizedMap(new HashMap<Class<? extends ConfiguredObject>, Collection<ConfiguredObjectAttribute<?, ?>>>()); - private static final Map<Class<? extends ConfiguredObject>, Map<State, Map<State, Method>>> _stateChangeMethods = + private final Map<Class<? extends ConfiguredObject>, Map<State, Map<State, Method>>> _stateChangeMethods = Collections.synchronizedMap(new HashMap<Class<? extends ConfiguredObject>, Map<State, Map<State, Method>>>()); - static + public ConfiguredObjectTypeRegistry(Iterable<ConfiguredObjectRegistration> configuredObjectRegistrations, Collection<Class<? extends ConfiguredObject>> categoriesRestriction) { - QpidServiceLoader<ConfiguredObjectRegistration> loader = new QpidServiceLoader<>(); Set<Class<? extends ConfiguredObject>> categories = new HashSet<>(); Set<Class<? extends ConfiguredObject>> types = new HashSet<>(); - for (ConfiguredObjectRegistration registration : loader.instancesOf(ConfiguredObjectRegistration.class)) + for (ConfiguredObjectRegistration registration : configuredObjectRegistrations) { for (Class<? extends ConfiguredObject> configuredObjectClass : registration.getConfiguredObjectClasses()) { - try + if(categoriesRestriction.isEmpty() || categoriesRestriction.contains(getCategory(configuredObjectClass))) { - process(configuredObjectClass); - ManagedObject annotation = configuredObjectClass.getAnnotation(ManagedObject.class); - if (annotation.category()) - { - categories.add(configuredObjectClass); - } - else + try { - Class<? extends ConfiguredObject> category = getCategory(configuredObjectClass); - if(category != null) + process(configuredObjectClass); + ManagedObject annotation = configuredObjectClass.getAnnotation(ManagedObject.class); + if (annotation.category()) { - categories.add(category); + categories.add(configuredObjectClass); + } + else + { + Class<? extends ConfiguredObject> category = getCategory(configuredObjectClass); + if (category != null) + { + categories.add(category); + } + } + if (!"".equals(annotation.type())) + { + types.add(configuredObjectClass); } } - if (!"".equals(annotation.type())) + catch (NoClassDefFoundError ncdfe) { - types.add(configuredObjectClass); + LOGGER.warn("A class definition could not be found while processing the model for '" + + configuredObjectClass.getName() + + "': " + + ncdfe.getMessage()); } } - catch(NoClassDefFoundError ncdfe) - { - LOGGER.warn("A class definition could not be found while processing the model for '" + configuredObjectClass.getName() + "': " + ncdfe.getMessage()); - } } } for (Class<? extends ConfiguredObject> categoryClass : categories) @@ -188,7 +193,7 @@ public class ConfiguredObjectTypeRegistry return null; } - public static Class<? extends ConfiguredObject> getTypeClass(final Class<? extends ConfiguredObject> clazz) + private Class<? extends ConfiguredObject> getTypeClass(final Class<? extends ConfiguredObject> clazz) { String typeName = getType(clazz); Class<? extends ConfiguredObject> typeClass = null; @@ -218,7 +223,7 @@ public class ConfiguredObjectTypeRegistry } - public static Collection<Class<? extends ConfiguredObject>> getTypeSpecialisations(Class<? extends ConfiguredObject> clazz) + public Collection<Class<? extends ConfiguredObject>> getTypeSpecialisations(Class<? extends ConfiguredObject> clazz) { Class<? extends ConfiguredObject> categoryClass = getCategory(clazz); if(categoryClass == null) @@ -234,7 +239,7 @@ public class ConfiguredObjectTypeRegistry } - public static Collection<ConfiguredObjectAttribute<?,?>> getTypeSpecificAttributes(Class<? extends ConfiguredObject> clazz) + public Collection<ConfiguredObjectAttribute<?,?>> getTypeSpecificAttributes(Class<? extends ConfiguredObject> clazz) { Class<? extends ConfiguredObject> typeClass = getTypeClass(clazz); if(typeClass == null) @@ -308,7 +313,7 @@ public class ConfiguredObjectTypeRegistry return ""; } - public static Strings.Resolver getDefaultContextResolver() + public Strings.Resolver getDefaultContextResolver() { return new Strings.MapResolver(_defaultContext); } @@ -345,7 +350,7 @@ public class ConfiguredObjectTypeRegistry - private static <X extends ConfiguredObject> void process(final Class<X> clazz) + private <X extends ConfiguredObject> void process(final Class<X> clazz) { synchronized (_allAttributes) { @@ -451,7 +456,7 @@ public class ConfiguredObjectTypeRegistry } } - private static void initialiseWithParentAttributes(final SortedSet<ConfiguredObjectAttribute<?, ?>> attributeSet, + private void initialiseWithParentAttributes(final SortedSet<ConfiguredObjectAttribute<?, ?>> attributeSet, final SortedSet<ConfiguredObjectStatistic<?, ?>> statisticSet, final Class<? extends ConfiguredObject> parent) { @@ -473,7 +478,7 @@ public class ConfiguredObjectTypeRegistry } } - private static <X extends ConfiguredObject> void processAttributesTypesAndFields(final Class<X> clazz) + private <X extends ConfiguredObject> void processAttributesTypesAndFields(final Class<X> clazz) { Map<String,ConfiguredObjectAttribute<?,?>> attrMap = new HashMap<String, ConfiguredObjectAttribute<?, ?>>(); Map<String,AutomatedField> fieldMap = new HashMap<String, AutomatedField>(); @@ -493,7 +498,7 @@ public class ConfiguredObjectTypeRegistry _allAutomatedFields.put(clazz, fieldMap); } - private static <X extends ConfiguredObject> void processDefaultContext(final Class<X> clazz) + private <X extends ConfiguredObject> void processDefaultContext(final Class<X> clazz) { for(Field field : clazz.getDeclaredFields()) { @@ -520,7 +525,7 @@ public class ConfiguredObjectTypeRegistry } } - private static void processStateChangeMethods(Class<? extends ConfiguredObject> clazz) + private void processStateChangeMethods(Class<? extends ConfiguredObject> clazz) { Map<State, Map<State, Method>> map = new HashMap<>(); @@ -543,7 +548,7 @@ public class ConfiguredObjectTypeRegistry } } - private static void inheritTransitions(final Class<? extends ConfiguredObject> parent, + private void inheritTransitions(final Class<? extends ConfiguredObject> parent, final Map<State, Map<State, Method>> map) { Map<State, Map<State, Method>> parentMap = _stateChangeMethods.get(parent); @@ -567,7 +572,7 @@ public class ConfiguredObjectTypeRegistry } } - private static void addStateTransitions(final Class<? extends ConfiguredObject> clazz, + private void addStateTransitions(final Class<? extends ConfiguredObject> clazz, final Map<State, Map<State, Method>> map) { for(Method m : clazz.getDeclaredMethods()) @@ -593,7 +598,7 @@ public class ConfiguredObjectTypeRegistry } } - private static void addStateTransition(final State fromState, + private void addStateTransition(final State fromState, final State toState, final Method method, final Map<State, Map<State, Method>> map) @@ -614,7 +619,7 @@ public class ConfiguredObjectTypeRegistry } } - private static AutomatedField findField(final ConfiguredObjectAttribute<?, ?> attr, Class<?> objClass) + private AutomatedField findField(final ConfiguredObjectAttribute<?, ?> attr, Class<?> objClass) { Class<?> clazz = objClass; while(clazz != null) @@ -665,7 +670,7 @@ public class ConfiguredObjectTypeRegistry throw new ServerScopedRuntimeException("Unable to find field definition for automated field " + attr.getName() + " in class " + objClass.getName()); } - public static <X extends ConfiguredObject> Collection<String> getAttributeNames(Class<X> clazz) + public <X extends ConfiguredObject> Collection<String> getAttributeNames(Class<X> clazz) { final Collection<ConfiguredObjectAttribute<? super X, ?>> attrs = getAttributes(clazz); @@ -706,7 +711,7 @@ public class ConfiguredObjectTypeRegistry } - protected static <X extends ConfiguredObject> Collection<ConfiguredObjectAttribute<? super X, ?>> getAttributes(final Class<X> clazz) + protected <X extends ConfiguredObject> Collection<ConfiguredObjectAttribute<? super X, ?>> getAttributes(final Class<X> clazz) { if(!_allAttributes.containsKey(clazz)) { @@ -717,7 +722,7 @@ public class ConfiguredObjectTypeRegistry } - protected static Collection<ConfiguredObjectStatistic> getStatistics(final Class<? extends ConfiguredObject> clazz) + protected Collection<ConfiguredObjectStatistic> getStatistics(final Class<? extends ConfiguredObject> clazz) { if(!_allAttributes.containsKey(clazz)) { @@ -728,7 +733,7 @@ public class ConfiguredObjectTypeRegistry } - public static Map<String, ConfiguredObjectAttribute<?, ?>> getAttributeTypes(final Class<? extends ConfiguredObject> clazz) + public Map<String, ConfiguredObjectAttribute<?, ?>> getAttributeTypes(final Class<? extends ConfiguredObject> clazz) { if(!_allAttributes.containsKey(clazz)) { @@ -737,7 +742,7 @@ public class ConfiguredObjectTypeRegistry return _allAttributeTypes.get(clazz); } - static Map<String, AutomatedField> getAutomatedFields(Class<? extends ConfiguredObject> clazz) + Map<String, AutomatedField> getAutomatedFields(Class<? extends ConfiguredObject> clazz) { if(!_allAttributes.containsKey(clazz)) { @@ -746,7 +751,7 @@ public class ConfiguredObjectTypeRegistry return _allAutomatedFields.get(clazz); } - static Map<State, Map<State, Method>> getStateChangeMethods(final Class<? extends ConfiguredObject> objectClass) + Map<State, Map<State, Method>> getStateChangeMethods(final Class<? extends ConfiguredObject> objectClass) { if(!_allAttributes.containsKey(objectClass)) { diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Model.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Model.java index 790ed74afb..9f671b47a8 100644 --- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Model.java +++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/model/Model.java @@ -145,6 +145,7 @@ public abstract class Model return allDescendants.contains(descendantClass); } + public abstract Collection<Class<? extends ConfiguredObject>> getSupportedCategories(); public abstract Collection<Class<? extends ConfiguredObject>> getChildTypes(Class<? extends ConfiguredObject> parent); @@ -156,4 +157,6 @@ public abstract class Model public abstract ConfiguredObjectFactory getObjectFactory(); + public abstract ConfiguredObjectTypeRegistry getTypeRegistry(); + } diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfigureObjectTypeRegistryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfigureObjectTypeRegistryTest.java new file mode 100644 index 0000000000..8bd599f22f --- /dev/null +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfigureObjectTypeRegistryTest.java @@ -0,0 +1,95 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.server.model; + +import java.util.Collection; + +import junit.framework.TestCase; + +import org.apache.qpid.server.model.testmodel.Test2RootCategory; +import org.apache.qpid.server.model.testmodel.Test2RootCategoryImpl; +import org.apache.qpid.server.model.testmodel.TestModel; +import org.apache.qpid.server.model.testmodel.TestRootCategory; +import org.apache.qpid.server.model.testmodel.TestRootCategoryImpl; + +public class ConfigureObjectTypeRegistryTest extends TestCase +{ + private ConfiguredObjectTypeRegistry _typeRegistry; + + @Override + public void setUp() throws Exception + { + super.setUp(); + Model model = TestModel.getInstance(); + _typeRegistry = model.getTypeRegistry(); + } + + public void testAllTypesRegistered() + { + Collection<Class<? extends ConfiguredObject>> types = + _typeRegistry.getTypeSpecialisations(TestRootCategory.class); + + assertEquals(2, types.size()); + assertTrue(types.contains(TestRootCategoryImpl.class)); + + assertTrue(types.contains(Test2RootCategoryImpl.class)); + } + + public void testTypeSpecificAttributes() + { + Collection<ConfiguredObjectAttribute<?, ?>> special = + _typeRegistry.getTypeSpecificAttributes(Test2RootCategoryImpl.class); + assertEquals(1, special.size()); + ConfiguredObjectAttribute attr = special.iterator().next(); + assertEquals("derivedAttribute",attr.getName()); + assertTrue(attr.isDerived()); + + special = _typeRegistry.getTypeSpecificAttributes(TestRootCategoryImpl.class); + assertEquals(0, special.size()); + + } + + public void testDefaultedValues() + { + checkDefaultedValue(_typeRegistry.getAttributes((Class) TestRootCategoryImpl.class), + TestRootCategory.DEFAULTED_VALUE_DEFAULT); + + checkDefaultedValue(_typeRegistry.getAttributes((Class) Test2RootCategoryImpl.class), + Test2RootCategory.DEFAULTED_VALUE_DEFAULT); + } + + private void checkDefaultedValue(final Collection<ConfiguredObjectAttribute<?, ?>> attrs, + final String defaultedValueDefault) + { + boolean found = false; + for(ConfiguredObjectAttribute<?, ?> attr : attrs) + { + if(attr.getName().equals("defaultedValue")) + { + assertEquals(defaultedValueDefault, ((ConfiguredAutomatedAttribute)attr).defaultValue()); + found = true; + break; + } + + } + assertTrue("Could not find attribute defaultedValue", found); + } +} diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/Test2RootCategory.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/Test2RootCategory.java new file mode 100644 index 0000000000..e47c76cbbb --- /dev/null +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/Test2RootCategory.java @@ -0,0 +1,35 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.server.model.testmodel; + +import org.apache.qpid.server.model.DerivedAttribute; +import org.apache.qpid.server.model.ManagedAttribute; + +public interface Test2RootCategory<X extends Test2RootCategory<X>> extends TestRootCategory<X> +{ + String DEFAULTED_VALUE_DEFAULT = "differentDefault"; + @Override + @ManagedAttribute( defaultValue = DEFAULTED_VALUE_DEFAULT) + String getDefaultedValue(); + + @DerivedAttribute + public int getDerivedAttribute(); +} diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/Test2RootCategoryImpl.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/Test2RootCategoryImpl.java new file mode 100644 index 0000000000..022e0a256f --- /dev/null +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/Test2RootCategoryImpl.java @@ -0,0 +1,118 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ +package org.apache.qpid.server.model.testmodel; + +import java.util.Map; + +import org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor; +import org.apache.qpid.server.configuration.updater.TaskExecutor; +import org.apache.qpid.server.model.AbstractConfiguredObject; +import org.apache.qpid.server.model.ManagedAttributeField; +import org.apache.qpid.server.model.ManagedObject; +import org.apache.qpid.server.model.ManagedObjectFactoryConstructor; +import org.apache.qpid.server.model.State; + +@ManagedObject( category = false , type = "test2" ) +public class Test2RootCategoryImpl extends AbstractConfiguredObject<Test2RootCategoryImpl> + implements Test2RootCategory<Test2RootCategoryImpl> +{ + @ManagedAttributeField + private String _automatedPersistedValue; + + @ManagedAttributeField + private String _automatedNonPersistedValue; + + @ManagedAttributeField + private String _defaultedValue; + + @ManagedAttributeField + private String _stringValue; + + @ManagedAttributeField + private Map<String,String> _mapValue; + + @ManagedObjectFactoryConstructor + public Test2RootCategoryImpl(final Map<String, Object> attributes) + { + super(parentsMap(), attributes, newTaskExecutor(), TestModel.getInstance()); + } + + private static CurrentThreadTaskExecutor newTaskExecutor() + { + CurrentThreadTaskExecutor currentThreadTaskExecutor = new CurrentThreadTaskExecutor(); + currentThreadTaskExecutor.start(); + return currentThreadTaskExecutor; + } + + public Test2RootCategoryImpl(final Map<String, Object> attributes, + final TaskExecutor taskExecutor) + { + super(parentsMap(), attributes, taskExecutor); + } + + @Override + protected boolean setState(final State desiredState) + { + return false; + } + + @Override + public String getAutomatedPersistedValue() + { + return _automatedPersistedValue; + } + + @Override + public String getAutomatedNonPersistedValue() + { + return _automatedNonPersistedValue; + } + + @Override + public String getDefaultedValue() + { + return _defaultedValue; + } + + @Override + public int getDerivedAttribute() + { + return 0; + } + + @Override + public String getStringValue() + { + return _stringValue; + } + + @Override + public Map<String, String> getMapValue() + { + return _mapValue; + } + + @Override + public State getState() + { + return null; + } +} diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestModel.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestModel.java index a87ed710a4..fc98b51731 100644 --- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestModel.java +++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestModel.java @@ -27,7 +27,9 @@ import java.util.Collections; import org.apache.qpid.server.model.ConfiguredObject; import org.apache.qpid.server.model.ConfiguredObjectFactory; import org.apache.qpid.server.model.ConfiguredObjectFactoryImpl; +import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.Model; +import org.apache.qpid.server.plugin.ConfiguredObjectRegistration; public class TestModel extends Model { @@ -38,6 +40,7 @@ public class TestModel extends Model }; private final ConfiguredObjectFactory _objectFactory; + private ConfiguredObjectTypeRegistry _registry; private TestModel() { @@ -47,6 +50,21 @@ public class TestModel extends Model public TestModel(final ConfiguredObjectFactory objectFactory) { _objectFactory = objectFactory == null ? new ConfiguredObjectFactoryImpl(this) : objectFactory; + ConfiguredObjectRegistration configuredObjectRegistration = new ConfiguredObjectRegistration() + { + @Override + public Collection<Class<? extends ConfiguredObject>> getConfiguredObjectClasses() + { + return Arrays.<Class<? extends ConfiguredObject>>asList(TestRootCategoryImpl.class, Test2RootCategoryImpl.class); + } + + @Override + public String getType() + { + return "test"; + } + }; + _registry = new ConfiguredObjectTypeRegistry(Arrays.asList(configuredObjectRegistration), getSupportedCategories()); } @@ -92,6 +110,12 @@ public class TestModel extends Model return _objectFactory; } + @Override + public ConfiguredObjectTypeRegistry getTypeRegistry() + { + return _registry; + } + public static Model getInstance() { return INSTANCE; diff --git a/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java b/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java index 2c40e536be..e73d177599 100644 --- a/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java +++ b/qpid/java/broker-plugins/management-amqp/src/main/java/org/apache/qpid/server/management/amqp/ManagementNode.java @@ -52,7 +52,6 @@ import org.apache.qpid.server.message.internal.InternalMessage; import org.apache.qpid.server.message.internal.InternalMessageHeader; import org.apache.qpid.server.model.ConfigurationChangeListener; import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.ManagedObject; import org.apache.qpid.server.model.State; import org.apache.qpid.server.plugin.MessageConverter; @@ -236,7 +235,7 @@ class ManagementNode implements MessageSource, MessageDestination } } managedEntityType = new ManagedEntityType(clazz.getName(), parentSet.toArray(new ManagedEntityType[parentSet.size()]), - (String[])(ConfiguredObjectTypeRegistry.getAttributeNames( + (String[])(_managedObject.getModel().getTypeRegistry().getAttributeNames( clazz).toArray(new String[0])), opsList.toArray(new String[opsList.size()])); _entityTypes.put(clazz.getName(),managedEntityType); diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java index 0fefa93a81..55c2bf6901 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/MetaDataServlet.java @@ -82,7 +82,8 @@ public class MetaDataServlet extends AbstractServlet private Map<String,Map> processCategory(final Class<? extends ConfiguredObject> clazz) { Map<String, Map> typeToDataMap = new TreeMap<>(); - for(Class<? extends ConfiguredObject> type : ConfiguredObjectTypeRegistry.getTypeSpecialisations(clazz)) + ConfiguredObjectTypeRegistry typeRegistry = _instance.getTypeRegistry(); + for(Class<? extends ConfiguredObject> type : typeRegistry.getTypeSpecialisations(clazz)) { typeToDataMap.put(ConfiguredObjectTypeRegistry.getType(type), processType(type)); } @@ -99,7 +100,7 @@ public class MetaDataServlet extends AbstractServlet private Map<String,Map> processAttributes(final Class<? extends ConfiguredObject> type) { Collection<ConfiguredObjectAttribute<?, ?>> attributes = - ConfiguredObjectTypeRegistry.getAttributeTypes(type).values(); + _instance.getTypeRegistry().getAttributeTypes(type).values(); Map<String,Map> attributeDetails = new LinkedHashMap<>(); for(ConfiguredObjectAttribute<?, ?> attribute : attributes) diff --git a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java index 5d1e7cba21..c697603c6c 100644 --- a/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java +++ b/qpid/java/broker-plugins/management-http/src/main/java/org/apache/qpid/server/management/plugin/servlet/rest/action/AbstractSpecialisedAttributeLister.java @@ -42,15 +42,16 @@ abstract class AbstractSpecialisedAttributeLister<T extends ConfiguredObject> i @Override final public Object perform(Map<String, Object> request, Broker broker) { + ConfiguredObjectTypeRegistry typeRegistry = broker.getModel().getTypeRegistry(); Collection<Class<? extends ConfiguredObject>> groupProviderTypes = - ConfiguredObjectTypeRegistry.getTypeSpecialisations(getCategoryClass()); + typeRegistry.getTypeSpecialisations(getCategoryClass()); Map<String, Object> attributes = new TreeMap<String, Object>(); for (Class<? extends ConfiguredObject> groupProviderType : groupProviderTypes) { Collection<ConfiguredObjectAttribute<?, ?>> typeSpecificAttributes = - ConfiguredObjectTypeRegistry.getTypeSpecificAttributes(groupProviderType); + typeRegistry.getTypeSpecificAttributes(groupProviderType); Map<String, Object> data = new HashMap<String, Object>(); diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java index 3ae32a17ae..7b337580d3 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/Asserts.java @@ -35,8 +35,8 @@ import junit.framework.TestCase; import org.apache.qpid.client.AMQConnection; import org.apache.qpid.server.model.Binding; import org.apache.qpid.server.model.Broker; +import org.apache.qpid.server.model.BrokerModel; import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.Connection; import org.apache.qpid.server.model.Exchange; import org.apache.qpid.server.model.ExclusivityPolicy; @@ -68,7 +68,7 @@ public class Asserts { assertNotNull("Virtualhost " + virtualHostName + " data are not found", virtualHost); assertAttributesPresent(virtualHost, - ConfiguredObjectTypeRegistry.getAttributeNames(VirtualHost.class), + BrokerModel.getInstance().getTypeRegistry().getAttributeNames(VirtualHost.class), ConfiguredObject.CREATED_BY, ConfiguredObject.CREATED_TIME, ConfiguredObject.LAST_UPDATED_BY, @@ -117,7 +117,7 @@ public class Asserts { assertNotNull("Queue " + queueName + " is not found!", queueData); Asserts.assertAttributesPresent(queueData, - ConfiguredObjectTypeRegistry.getAttributeNames(Queue.class), + BrokerModel.getInstance().getTypeRegistry().getAttributeNames(Queue.class), Queue.CREATED_BY, Queue.CREATED_TIME, Queue.LAST_UPDATED_BY, @@ -224,7 +224,7 @@ public class Asserts { assertNotNull("Unexpected connection data", connectionData); assertAttributesPresent(connectionData, - ConfiguredObjectTypeRegistry.getAttributeNames(Connection.class), + BrokerModel.getInstance().getTypeRegistry().getAttributeNames(Connection.class), Connection.STATE, Connection.DURABLE, Connection.LIFETIME_POLICY, @@ -284,7 +284,7 @@ public class Asserts if ("AMQP".equals(port.get(ConfiguredObject.TYPE))) { assertAttributesPresent(port, - ConfiguredObjectTypeRegistry.getAttributeNames(Port.class), + BrokerModel.getInstance().getTypeRegistry().getAttributeNames(Port.class), ConfiguredObject.TYPE, ConfiguredObject.CREATED_BY, ConfiguredObject.CREATED_TIME, @@ -302,7 +302,7 @@ public class Asserts else { assertAttributesPresent(port, - ConfiguredObjectTypeRegistry.getAttributeNames(Port.class), + BrokerModel.getInstance().getTypeRegistry().getAttributeNames(Port.class), ConfiguredObject.TYPE, ConfiguredObject.CREATED_BY, ConfiguredObject.CREATED_TIME, @@ -340,7 +340,7 @@ public class Asserts public static void assertExchange(String exchangeName, String type, Map<String, Object> exchangeData) { assertNotNull("Exchange " + exchangeName + " is not found!", exchangeData); - assertAttributesPresent(exchangeData, ConfiguredObjectTypeRegistry.getAttributeNames(Exchange.class), + assertAttributesPresent(exchangeData, BrokerModel.getInstance().getTypeRegistry().getAttributeNames(Exchange.class), Exchange.ALTERNATE_EXCHANGE, ConfiguredObject.CREATED_BY, ConfiguredObject.CREATED_TIME, @@ -376,7 +376,7 @@ public class Asserts { assertNotNull("Binding map should not be null", binding); assertAttributesPresent(binding, - ConfiguredObjectTypeRegistry.getAttributeNames(Binding.class), + BrokerModel.getInstance().getTypeRegistry().getAttributeNames(Binding.class), Binding.STATE, ConfiguredObject.TYPE, ConfiguredObject.CREATED_BY, diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java index 57d75ecbae..2467705903 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/AuthenticationProviderRestTest.java @@ -28,8 +28,8 @@ import java.util.UUID; import org.apache.qpid.server.BrokerOptions; import org.apache.qpid.server.model.AuthenticationProvider; +import org.apache.qpid.server.model.BrokerModel; import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.ExternalFileBasedAuthenticationManager; import org.apache.qpid.server.model.LifetimePolicy; import org.apache.qpid.server.model.Port; @@ -307,7 +307,7 @@ public class AuthenticationProviderRestTest extends QpidRestTestCase private void assertProvider(boolean managesPrincipals, String type, Map<String, Object> provider) { - Asserts.assertAttributesPresent(provider, ConfiguredObjectTypeRegistry.getAttributeNames( + Asserts.assertAttributesPresent(provider, BrokerModel.getInstance().getTypeRegistry().getAttributeNames( AuthenticationProvider.class), AuthenticationProvider.DESCRIPTION, ConfiguredObject.CONTEXT, ConfiguredObject.DESIRED_STATE, ConfiguredObject.CREATED_BY, diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java index f59d9f797f..319cc1c9da 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestHttpsTest.java @@ -29,8 +29,8 @@ import java.util.HashMap; import java.util.Map; import org.apache.qpid.server.model.Broker; +import org.apache.qpid.server.model.BrokerModel; import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.Port; import org.apache.qpid.server.model.Protocol; import org.apache.qpid.server.model.Transport; @@ -63,7 +63,7 @@ public class BrokerRestHttpsTest extends QpidRestTestCase { Map<String, Object> brokerDetails = getRestTestHelper().getJsonAsSingletonList("broker"); - Asserts.assertAttributesPresent(brokerDetails, ConfiguredObjectTypeRegistry.getAttributeNames(Broker.class), + Asserts.assertAttributesPresent(brokerDetails, BrokerModel.getInstance().getTypeRegistry().getAttributeNames(Broker.class), Broker.PROCESS_PID, ConfiguredObject.TYPE, ConfiguredObject.CREATED_BY, diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java index 6faca2e32d..bae27b802c 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/BrokerRestTest.java @@ -34,8 +34,8 @@ import javax.jms.TextMessage; import org.apache.qpid.common.QpidProperties; import org.apache.qpid.server.model.Broker; +import org.apache.qpid.server.model.BrokerModel; import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.LifetimePolicy; import org.apache.qpid.server.model.Port; import org.apache.qpid.server.model.State; @@ -201,7 +201,8 @@ public class BrokerRestTest extends QpidRestTestCase protected void assertBrokerAttributes(Map<String, Object> brokerDetails) { - Asserts.assertAttributesPresent(brokerDetails, ConfiguredObjectTypeRegistry.getAttributeNames(Broker.class), + Asserts.assertAttributesPresent(brokerDetails, BrokerModel.getInstance().getTypeRegistry().getAttributeNames( + Broker.class), Broker.PROCESS_PID, ConfiguredObject.TYPE, ConfiguredObject.CREATED_BY, diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ConnectionRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ConnectionRestTest.java index ad4a370a04..8a7851e43d 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ConnectionRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/ConnectionRestTest.java @@ -32,12 +32,10 @@ import javax.jms.MessageConsumer; import javax.jms.MessageProducer; import javax.servlet.http.HttpServletResponse; -import org.junit.Assert; - import org.apache.qpid.client.AMQConnection; import org.apache.qpid.client.AMQSession; +import org.apache.qpid.server.model.BrokerModel; import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.Connection; import org.apache.qpid.server.model.Session; @@ -232,7 +230,8 @@ public class ConnectionRestTest extends QpidRestTestCase private void assertSession(Map<String, Object> sessionData, AMQSession<?, ?> session) { assertNotNull("Session map cannot be null", sessionData); - Asserts.assertAttributesPresent(sessionData, ConfiguredObjectTypeRegistry.getAttributeNames(Session.class), + Asserts.assertAttributesPresent(sessionData, BrokerModel.getInstance().getTypeRegistry().getAttributeNames( + Session.class), ConfiguredObject.TYPE, ConfiguredObject.CREATED_BY, ConfiguredObject.CREATED_TIME, diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java index 7bc2429942..4f1c1ad7a7 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/GroupProviderRestTest.java @@ -29,8 +29,8 @@ import java.util.Properties; import java.util.UUID; import org.apache.qpid.server.BrokerOptions; +import org.apache.qpid.server.model.BrokerModel; import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.Group; import org.apache.qpid.server.model.GroupProvider; import org.apache.qpid.server.model.LifetimePolicy; @@ -322,7 +322,8 @@ public class GroupProviderRestTest extends QpidRestTestCase private void assertProvider(String name, String type, Map<String, Object> provider) { - Asserts.assertAttributesPresent(provider, ConfiguredObjectTypeRegistry.getAttributeNames(GroupProvider.class), + Asserts.assertAttributesPresent(provider, BrokerModel.getInstance().getTypeRegistry().getAttributeNames( + GroupProvider.class), ConfiguredObject.TYPE, ConfiguredObject.CREATED_BY, ConfiguredObject.CREATED_TIME, diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java index 1d2b5d8bb5..6db204b9ca 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/PreferencesProviderRestTest.java @@ -28,8 +28,8 @@ import java.util.List; import java.util.Map; import org.apache.qpid.server.model.AuthenticationProvider; +import org.apache.qpid.server.model.BrokerModel; import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.ExternalFileBasedAuthenticationManager; import org.apache.qpid.server.model.LifetimePolicy; import org.apache.qpid.server.model.PreferencesProvider; @@ -163,7 +163,8 @@ public class PreferencesProviderRestTest extends QpidRestTestCase public void assertProviderCommonAttributes(Map<String, Object> provider) { Asserts.assertAttributesPresent(provider, - ConfiguredObjectTypeRegistry.getAttributeNames(PreferencesProvider.class), + BrokerModel.getInstance().getTypeRegistry().getAttributeNames( + PreferencesProvider.class), ConfiguredObject.CREATED_BY, ConfiguredObject.CREATED_TIME, ConfiguredObject.LAST_UPDATED_BY, diff --git a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java index db25b91236..baebc9a28e 100644 --- a/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java +++ b/qpid/java/systests/src/main/java/org/apache/qpid/systest/rest/QueueRestTest.java @@ -34,8 +34,8 @@ import javax.jms.MessageProducer; import javax.jms.Session; import org.apache.qpid.server.model.Binding; +import org.apache.qpid.server.model.BrokerModel; import org.apache.qpid.server.model.ConfiguredObject; -import org.apache.qpid.server.model.ConfiguredObjectTypeRegistry; import org.apache.qpid.server.model.Consumer; import org.apache.qpid.server.model.LifetimePolicy; import org.apache.qpid.server.model.Queue; @@ -206,7 +206,7 @@ public class QueueRestTest extends QpidRestTestCase { assertNotNull("Consumer map should not be null", consumer); Asserts.assertAttributesPresent(consumer, - ConfiguredObjectTypeRegistry.getAttributeNames(Consumer.class), Consumer.STATE, + BrokerModel.getInstance().getTypeRegistry().getAttributeNames(Consumer.class), Consumer.STATE, Consumer.SETTLEMENT_MODE, Consumer.EXCLUSIVE, Consumer.SELECTOR, Consumer.NO_LOCAL, ConfiguredObject.TYPE, |