summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/Pluggable.java4
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java6
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistryTest.java16
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/Test2RootCategoryImpl.java4
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategoryImpl.java3
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestModel.java2
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java2
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategoryImpl.java16
8 files changed, 44 insertions, 9 deletions
diff --git a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/Pluggable.java b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/Pluggable.java
index cc18e83f8e..84e4e211d8 100644
--- a/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/Pluggable.java
+++ b/qpid/java/broker-core/src/main/java/org/apache/qpid/server/plugin/Pluggable.java
@@ -1,4 +1,4 @@
-package org.apache.qpid.server.plugin;/*
+/*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
@@ -19,6 +19,8 @@ package org.apache.qpid.server.plugin;/*
*
*/
+package org.apache.qpid.server.plugin;
+
public interface Pluggable
{
String getType();
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java
index 3ffb4c42c2..d0477a3e34 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/AbstractConfiguredObjectTest.java
@@ -33,10 +33,12 @@ import java.util.concurrent.atomic.AtomicInteger;
import org.apache.qpid.server.configuration.IllegalConfigurationException;
import org.apache.qpid.server.model.testmodel.TestChildCategory;
+import org.apache.qpid.server.model.testmodel.TestChildCategoryImpl;
import org.apache.qpid.server.model.testmodel.TestConfiguredObject;
import org.apache.qpid.server.model.testmodel.TestEnum;
import org.apache.qpid.server.model.testmodel.TestModel;
import org.apache.qpid.server.model.testmodel.TestRootCategory;
+import org.apache.qpid.server.model.testmodel.TestRootCategoryImpl;
import org.apache.qpid.server.store.ConfiguredObjectRecord;
import org.apache.qpid.test.utils.QpidTestCase;
@@ -285,7 +287,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
attributes.put("intValue", "${contextVal}");
attributes.put("name", "child");
attributes.put("integerSet", "[ ]");
- attributes.put(ConfiguredObject.TYPE, "test");
+ attributes.put(ConfiguredObject.TYPE, TestChildCategoryImpl.TEST_CHILD_TYPE);
try
{
@@ -318,7 +320,7 @@ public class AbstractConfiguredObjectTest extends QpidTestCase
final Map<String, Object> attributes = new HashMap<>();
attributes.put("intValue", "1");
attributes.put("name", "child");
- attributes.put(ConfiguredObject.TYPE, "test");
+ attributes.put(ConfiguredObject.TYPE, TestChildCategoryImpl.TEST_CHILD_TYPE);
try
{
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistryTest.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistryTest.java
index 426526dbea..174966c4c0 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistryTest.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/ConfiguredObjectTypeRegistryTest.java
@@ -20,6 +20,10 @@
*/
package org.apache.qpid.server.model;
+import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -136,10 +140,20 @@ public class ConfiguredObjectTypeRegistryTest extends TestCase
assertEquals("Unexpected interfaces on class implementing 1 interface with annotation",
new HashSet<>(Arrays.asList(TestManagedInterface1.class)), typeRegistry.getManagedInterfaces(TestManagedClass2.class));
assertEquals("Unexpected interfaces on class implementing 2 interfaces with annotation",
- new HashSet<>(Arrays.asList(TestManagedInterface3.class, TestManagedInterface1.class)), typeRegistry.getManagedInterfaces(TestManagedClass3.class));
+ new HashSet<>(Arrays.asList(TestManagedInterface3.class, TestManagedInterface1.class)),
+ typeRegistry.getManagedInterfaces(TestManagedClass3.class));
}
+ public void testGetValidChildTypes()
+ {
+ Collection<String> validTypes = _typeRegistry.getValidChildTypes(TestRootCategory.class,
+ TestChildCategory.class);
+ assertThat(validTypes, hasItem("testchild"));
+ assertThat(validTypes.size(), is(1));
+ }
+
+
private ConfiguredObjectTypeRegistry createConfiguredObjectTypeRegistry(Class<? extends ConfiguredObject>... supportedTypes)
{
ConfiguredObjectRegistration configuredObjectRegistration = createConfiguredObjectRegistration(supportedTypes);
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
index 238863e708..3a415b9a4c 100644
--- 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
@@ -32,10 +32,12 @@ import org.apache.qpid.server.model.ManagedAttributeField;
import org.apache.qpid.server.model.ManagedObject;
import org.apache.qpid.server.model.ManagedObjectFactoryConstructor;
-@ManagedObject( category = false , type = "test2" )
+@ManagedObject( category = false , type = Test2RootCategoryImpl.TEST_ROOT_TYPE )
public class Test2RootCategoryImpl extends AbstractConfiguredObject<Test2RootCategoryImpl>
implements Test2RootCategory<Test2RootCategoryImpl>
{
+ public static final String TEST_ROOT_TYPE = "testroot2";
+
@ManagedAttributeField
private String _automatedPersistedValue;
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategoryImpl.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategoryImpl.java
index e12da63349..778d8e9cea 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategoryImpl.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestChildCategoryImpl.java
@@ -29,10 +29,11 @@ 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 = "test" )
+@ManagedObject( category = false, type = TestChildCategoryImpl.TEST_CHILD_TYPE )
public class TestChildCategoryImpl
extends AbstractConfiguredObject<TestChildCategoryImpl> implements TestChildCategory<TestChildCategoryImpl>
{
+ public static final String TEST_CHILD_TYPE = "testchild";
@ManagedAttributeField
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 ab9d753b7d..090c72762d 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
@@ -62,7 +62,7 @@ public class TestModel extends Model
@Override
public String getType()
{
- return "test";
+ return "org.apache.qpid.server.model.testmodel";
}
};
_registry = new ConfiguredObjectTypeRegistry(Arrays.asList(configuredObjectRegistration), getSupportedCategories());
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java
index cb47ee63cb..d8d26b86e6 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategory.java
@@ -31,7 +31,7 @@ import org.apache.qpid.server.model.ManagedAttribute;
import org.apache.qpid.server.model.ManagedContextDefault;
import org.apache.qpid.server.model.ManagedObject;
-@ManagedObject( defaultType = "test" )
+@ManagedObject( defaultType = TestRootCategoryImpl.TEST_ROOT_TYPE )
public interface TestRootCategory<X extends TestRootCategory<X>> extends ConfiguredObject<X>
{
String AUTOMATED_PERSISTED_VALUE = "automatedPersistedValue";
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategoryImpl.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategoryImpl.java
index 7e921866fa..bb5441b3a4 100644
--- a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategoryImpl.java
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodel/TestRootCategoryImpl.java
@@ -20,6 +20,9 @@
*/
package org.apache.qpid.server.model.testmodel;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Map;
import java.util.Set;
@@ -29,11 +32,16 @@ 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.VirtualHost;
-@ManagedObject( category = false , type = "test" )
+@ManagedObject( category = false,
+ type = TestRootCategoryImpl.TEST_ROOT_TYPE,
+ validChildTypes = "org.apache.qpid.server.model.testmodel.TestRootCategoryImpl#getSupportedChildTypes()")
public class TestRootCategoryImpl extends AbstractConfiguredObject<TestRootCategoryImpl>
implements TestRootCategory<TestRootCategoryImpl>
{
+ public static final String TEST_ROOT_TYPE = "testroot";
+
@ManagedAttributeField
private String _automatedPersistedValue;
@@ -126,4 +134,10 @@ public class TestRootCategoryImpl extends AbstractConfiguredObject<TestRootCateg
{
return _validValue;
}
+
+ @SuppressWarnings("unused")
+ public static Map<String, Collection<String>> getSupportedChildTypes()
+ {
+ return Collections.singletonMap(TestChildCategory.class.getSimpleName(), (Collection<String>)Collections.singleton(TestChildCategoryImpl.TEST_CHILD_TYPE));
+ }
}