summaryrefslogtreecommitdiff
path: root/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestKitCarImpl.java
diff options
context:
space:
mode:
authorKeith Wall <kwall@apache.org>2014-12-29 17:08:20 +0000
committerKeith Wall <kwall@apache.org>2014-12-29 17:08:20 +0000
commit6c07f50f9e9a3f1c620a4ea7dee4f117507261d6 (patch)
tree138022a7576e5c06b827e58e4a7ed0ece818c5e1 /qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestKitCarImpl.java
parent1c420bf20a6902efb0256c881c8b777ccd211b4a (diff)
downloadqpid-python-6c07f50f9e9a3f1c620a4ea7dee4f117507261d6.tar.gz
QPID-6292: [Java Broker Tests] Refactor AbstractConfiguredObjects unit tests to use several smaller test models
We now have two test models: * 'singleton' with a single object - used for tests around the behaviour of attributes, context variables etc * 'hierarchy' with a hierarchy of objects - used to test parent/child interactions, supported child types, and managed interfaces. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1648393 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestKitCarImpl.java')
-rw-r--r--qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestKitCarImpl.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestKitCarImpl.java b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestKitCarImpl.java
new file mode 100644
index 0000000000..5785071e15
--- /dev/null
+++ b/qpid/java/broker-core/src/test/java/org/apache/qpid/server/model/testmodels/hierarchy/TestKitCarImpl.java
@@ -0,0 +1,56 @@
+/*
+ * 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.testmodels.hierarchy;
+
+import java.util.Map;
+
+import org.apache.qpid.server.configuration.updater.CurrentThreadTaskExecutor;
+import org.apache.qpid.server.model.AbstractConfiguredObject;
+import org.apache.qpid.server.model.ConfiguredObject;
+import org.apache.qpid.server.model.ManagedObject;
+import org.apache.qpid.server.model.ManagedObjectFactoryConstructor;
+
+@ManagedObject( category = false,
+ type = TestKitCarImpl.TEST_KITCAR_TYPE)
+public class TestKitCarImpl extends AbstractConfiguredObject<TestKitCarImpl>
+ implements TestKitCar<TestKitCarImpl>
+{
+ public static final String TEST_KITCAR_TYPE = "testkitcar";
+
+ @ManagedObjectFactoryConstructor
+ public TestKitCarImpl(final Map<String, Object> attributes)
+ {
+ super(parentsMap(), attributes, newTaskExecutor(), TestModel.getInstance());
+ }
+
+ @Override
+ public <C extends ConfiguredObject> C createChild(final Class<C> childClass,
+ final Map<String, Object> attributes,
+ final ConfiguredObject... otherParents)
+ {
+ return (C) getObjectFactory().create(childClass, attributes, this);
+ }
+
+ private static CurrentThreadTaskExecutor newTaskExecutor()
+ {
+ CurrentThreadTaskExecutor currentThreadTaskExecutor = new CurrentThreadTaskExecutor();
+ currentThreadTaskExecutor.start();
+ return currentThreadTaskExecutor;
+ }
+}