diff options
| author | Keith Wall <kwall@apache.org> | 2012-07-27 08:09:52 +0000 |
|---|---|---|
| committer | Keith Wall <kwall@apache.org> | 2012-07-27 08:09:52 +0000 |
| commit | 842f4529e77a474adb6c4c498aabc33710fb2590 (patch) | |
| tree | 4e02f8ad347b18a2261760e755dea6197dd3b501 /qpid/java/perftests | |
| parent | 5b4a2266079e2902ea6d2786c009c98ba1e76d9d (diff) | |
| download | qpid-python-842f4529e77a474adb6c4c498aabc33710fb2590.tar.gz | |
QPID-4143: modify perf test framework's queue management to allow non-Qpid implementations to be used.
Applied patch from Philip Harvey <phil@philharveyonline.com>
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1366305 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/perftests')
4 files changed, 73 insertions, 10 deletions
diff --git a/qpid/java/perftests/etc/perftests-jndi.properties b/qpid/java/perftests/etc/perftests-jndi.properties index 04a8ad9101..f33af6fdd5 100644 --- a/qpid/java/perftests/etc/perftests-jndi.properties +++ b/qpid/java/perftests/etc/perftests-jndi.properties @@ -15,12 +15,8 @@ # specific language governing permissions and limitations # under the License. -# this file is used for running system tests of the performance test framework, -# (i.e. not for running the performance tests themselves!) - java.naming.factory.initial = org.apache.qpid.jndi.PropertiesFileInitialContextFactory -# use QpidBrokerTestCase's default port connectionfactory.connectionfactory = amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672' destination.controllerqueue = direct://amq.direct//controllerqueue?autodelete='true' diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java index 69da409be5..c80e641e5c 100644 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/ControllerJmsDelegate.java @@ -48,11 +48,13 @@ public class ControllerJmsDelegate { private static final Logger LOGGER = LoggerFactory.getLogger(ControllerJmsDelegate.class); + private static final String QUEUE_CREATOR_CLASS_NAME_SYSTEM_PROPERTY = "qpid.disttest.queue.creator.class"; + private final Map<String, Destination> _clientNameToQueueMap = new ConcurrentHashMap<String, Destination>(); private final Connection _connection; private final Destination _controllerQueue; private final Session _session; - private final QueueCreator _queueCreator; + private QueueCreator _queueCreator; private List<CommandListener> _commandListeners = new CopyOnWriteArrayList<CommandListener>(); @@ -63,7 +65,39 @@ public class ControllerJmsDelegate _connection.start(); _controllerQueue = (Destination) context.lookup("controllerqueue"); _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE); - _queueCreator = new QpidQueueCreator(); + + createVendorSpecificQueueCreator(); + } + + private void createVendorSpecificQueueCreator() + { + String queueCreatorClassName = System.getProperty(QUEUE_CREATOR_CLASS_NAME_SYSTEM_PROPERTY); + if(queueCreatorClassName == null) + { + queueCreatorClassName = QpidQueueCreator.class.getName(); + } + else + { + LOGGER.info("Using overridden queue creator class " + queueCreatorClassName); + } + + try + { + Class<? extends QueueCreator> queueCreatorClass = (Class<? extends QueueCreator>) Class.forName(queueCreatorClassName); + _queueCreator = queueCreatorClass.newInstance(); + } + catch (ClassNotFoundException e) + { + throw new DistributedTestException("Unable to instantiate queue creator using class name " + queueCreatorClassName, e); + } + catch (InstantiationException e) + { + throw new DistributedTestException("Unable to instantiate queue creator using class name " + queueCreatorClassName, e); + } + catch (IllegalAccessException e) + { + throw new DistributedTestException("Unable to instantiate queue creator using class name " + queueCreatorClassName, e); + } } public void start() diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/NoOpQueueCreator.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/NoOpQueueCreator.java new file mode 100644 index 0000000000..4d4850eccf --- /dev/null +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/NoOpQueueCreator.java @@ -0,0 +1,37 @@ +/* + * 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.disttest.jms; + +import java.util.List; + +import javax.jms.Session; + +import org.apache.qpid.disttest.controller.config.QueueConfig; +public class NoOpQueueCreator implements QueueCreator +{ + @Override + public void createQueues(Session session, List<QueueConfig> configs) + { + } + + @Override + public void deleteQueues(Session session, List<QueueConfig> configs) + { + } +} diff --git a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java index bf98dd8513..6874abe7d4 100644 --- a/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java +++ b/qpid/java/perftests/src/main/java/org/apache/qpid/disttest/jms/QpidQueueCreator.java @@ -21,7 +21,6 @@ package org.apache.qpid.disttest.jms; import java.util.List; import javax.jms.Session; - import org.apache.qpid.client.AMQDestination; import org.apache.qpid.client.AMQSession; import org.apache.qpid.disttest.DistributedTestException; @@ -29,11 +28,9 @@ import org.apache.qpid.disttest.controller.config.QueueConfig; import org.apache.qpid.framing.FieldTable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - public class QpidQueueCreator implements QueueCreator { private static final Logger LOGGER = LoggerFactory.getLogger(QpidQueueCreator.class); - private static final FieldTable EMPTY_QUEUE_BIND_ARGUMENTS = new FieldTable(); @Override @@ -93,5 +90,4 @@ public class QpidQueueCreator implements QueueCreator throw new DistributedTestException("Failed to delete queue:" + queueConfig.getName(), e); } } - } |
