summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetectionQueueConfigurationTest.java66
-rw-r--r--java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java6
2 files changed, 72 insertions, 0 deletions
diff --git a/java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetectionQueueConfigurationTest.java b/java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetectionQueueConfigurationTest.java
new file mode 100644
index 0000000000..180573d625
--- /dev/null
+++ b/java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetectionQueueConfigurationTest.java
@@ -0,0 +1,66 @@
+/*
+ *
+ * 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.virtualhost.plugin;
+
+import junit.framework.TestCase;
+import org.apache.commons.configuration.CompositeConfiguration;
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.commons.configuration.XMLConfiguration;
+import org.apache.qpid.server.configuration.plugin.SlowConsumerDetectionQueueConfiguration;
+
+
+public class SlowConsumerDetectionQueueConfigurationTest extends TestCase
+{
+ public void setUp()
+ {
+
+ }
+
+
+ public void testConfigLoadingValidConfig()
+ {
+ SlowConsumerDetectionQueueConfiguration config = new SlowConsumerDetectionQueueConfiguration();
+
+ XMLConfiguration xmlconfig = new XMLConfiguration();
+
+ xmlconfig.addProperty("messageAge", "60000");
+ xmlconfig.addProperty("depth", "1024");
+ xmlconfig.addProperty("messageCount", "10");
+ xmlconfig.addProperty("policy.name", "TopicDelete");
+ xmlconfig.addProperty("policy.topicdelete", "");
+
+
+ // Create a CompositeConfiguration as this is what the broker uses
+ CompositeConfiguration composite = new CompositeConfiguration();
+ composite.addConfiguration(xmlconfig);
+
+ try
+ {
+ config.setConfiguration("", composite);
+ }
+ catch (ConfigurationException e)
+ {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
+}
diff --git a/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java b/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java
index c1eff5f8db..cba8dda425 100644
--- a/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java
+++ b/java/broker/src/main/java/org/apache/qpid/server/plugins/PluginManager.java
@@ -245,6 +245,12 @@ public class PluginManager implements Closeable
public <P extends PluginFactory> Map<String, P> getPlugins(Class<P> plugin)
{
+ // If plugins are not configured then return an empty set
+ if (_activator == null)
+ {
+ return new HashMap<String, P>();
+ }
+
ServiceTracker tracker = new ServiceTracker(_activator.getContext(), plugin.getName(), null);
tracker.open();