summaryrefslogtreecommitdiff
path: root/java/broker-plugins/experimental
diff options
context:
space:
mode:
Diffstat (limited to 'java/broker-plugins/experimental')
-rw-r--r--java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/configuration/plugin/SlowConsumerDetectionQueueConfiguration.java2
-rw-r--r--java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java4
-rw-r--r--java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/policies/TopicDeletePolicy.java2
-rw-r--r--java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/systest/GlobalQueuesTest.java (renamed from java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/systest/SlowConsumerTest.java)115
-rw-r--r--java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/systest/GlobalTopicsTest.java36
5 files changed, 90 insertions, 69 deletions
diff --git a/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/configuration/plugin/SlowConsumerDetectionQueueConfiguration.java b/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/configuration/plugin/SlowConsumerDetectionQueueConfiguration.java
index c094c7eb6d..0949204a33 100644
--- a/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/configuration/plugin/SlowConsumerDetectionQueueConfiguration.java
+++ b/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/configuration/plugin/SlowConsumerDetectionQueueConfiguration.java
@@ -95,7 +95,7 @@ public class SlowConsumerDetectionQueueConfiguration extends ConfigurationPlugin
"('messageAge','depth' or 'messageCount') must be specified.");
}
- SlowConsumerDetectionPolicyConfiguration policyConfig = getConfiguration(SlowConsumerDetectionPolicyConfiguration.class);
+ SlowConsumerDetectionPolicyConfiguration policyConfig = getConfiguration(SlowConsumerDetectionPolicyConfiguration.class.getName());
PluginManager pluginManager = ApplicationRegistry.getInstance().getPluginManager();
Map<String, SlowConsumerPolicyPluginFactory> factories = pluginManager.getPlugins(SlowConsumerPolicyPluginFactory.class);
diff --git a/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java b/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java
index 77819f8dbf..cac52c2fdf 100644
--- a/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java
+++ b/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/SlowConsumerDetection.java
@@ -40,7 +40,7 @@ class SlowConsumerDetection extends VirtualHostHouseKeepingPlugin
{
public SlowConsumerDetection newInstance(VirtualHost vhost)
{
- SlowConsumerDetectionConfiguration config = vhost.getConfiguration().getConfiguration(SlowConsumerDetectionConfiguration.class);
+ SlowConsumerDetectionConfiguration config = vhost.getConfiguration().getConfiguration(SlowConsumerDetectionConfiguration.class.getName());
if (config == null)
{
@@ -74,7 +74,7 @@ class SlowConsumerDetection extends VirtualHostHouseKeepingPlugin
try
{
SlowConsumerDetectionQueueConfiguration config =
- q.getConfiguration().getConfiguration(SlowConsumerDetectionQueueConfiguration.class);
+ q.getConfiguration().getConfiguration(SlowConsumerDetectionQueueConfiguration.class.getName());
if (checkQueueStatus(q, config))
{
diff --git a/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/policies/TopicDeletePolicy.java b/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/policies/TopicDeletePolicy.java
index 3c67f6e6d7..c5275aa0bf 100644
--- a/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/policies/TopicDeletePolicy.java
+++ b/java/broker-plugins/experimental/slowconsumerdetection/src/main/java/org/apache/qpid/server/virtualhost/plugin/policies/TopicDeletePolicy.java
@@ -45,7 +45,7 @@ public class TopicDeletePolicy implements SlowConsumerPolicyPlugin
public TopicDeletePolicy newInstance(ConfigurationPlugin configuration) throws ConfigurationException
{
TopicDeletePolicyConfiguration config =
- configuration.getConfiguration(TopicDeletePolicyConfiguration.class);
+ configuration.getConfiguration(TopicDeletePolicyConfiguration.class.getName());
TopicDeletePolicy policy = new TopicDeletePolicy();
policy.configure(config);
diff --git a/java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/systest/SlowConsumerTest.java b/java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/systest/GlobalQueuesTest.java
index f0be3d2db0..513bafa8ad 100644
--- a/java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/systest/SlowConsumerTest.java
+++ b/java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/systest/GlobalQueuesTest.java
@@ -47,7 +47,7 @@ import java.util.concurrent.TimeUnit;
* Slow consumers should on a topic should expect to receive a
* 506 : Resource Error if the hit a predefined threshold.
*/
-public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionListener, ConnectionListener
+public class GlobalQueuesTest extends QpidBrokerTestCase implements ExceptionListener, ConnectionListener
{
Topic _destination;
private CountDownLatch _disconnectionLatch = new CountDownLatch(1);
@@ -59,6 +59,7 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
private Exception _publisherError = null;
private JMSException _connectionException = null;
private static final long JOIN_WAIT = 5000;
+ protected String CONFIG_SECTION = ".queues";
@Override
public void setUp() throws IOException, ConfigurationException, NamingException
@@ -71,32 +72,26 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
+ getConnectionURL().getVirtualHost().substring(1) +
".slow-consumer-detection.timeunit", "SECONDS");
- setConfigurationProperty("virtualhosts.virtualhost."
- + getConnectionURL().getVirtualHost().substring(1) +
- ".queues.slow-consumer-detection." +
- "policy.name", "TopicDelete");
-
-
/**
* Queue Configuration
<slow-consumer-detection>
- <!-- The depth before which the policy will be applied-->
- <depth>4235264</depth>
-
- <!-- The message age before which the policy will be applied-->
- <messageAge>600000</messageAge>
-
- <!-- The number of message before which the policy will be applied-->
- <messageCount>50</messageCount>
-
- <!-- Policies configuration -->
- <policy>
- <name>TopicDelete</name>
- <topicDelete>
- <delete-persistent/>
- </topicDelete>
- </policy>
+ <!-- The depth before which the policy will be applied-->
+ <depth>4235264</depth>
+
+ <!-- The message age before which the policy will be applied-->
+ <messageAge>600000</messageAge>
+
+ <!-- The number of message before which the policy will be applied-->
+ <messageCount>50</messageCount>
+
+ <!-- Policies configuration -->
+ <policy>
+ <name>TopicDelete</name>
+ <topicDelete>
+ <delete-persistent/>
+ </topicDelete>
+ </policy>
</slow-consumer-detection>
*/
@@ -105,8 +100,8 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
* VirtualHost Plugin Configuration
<slow-consumer-detection>
- <delay>1</delay>
- <timeunit>MINUTES</timeunit>
+ <delay>1</delay>
+ <timeunit>MINUTES</timeunit>
</slow-consumer-detection>
*/
@@ -132,6 +127,7 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
* Clients should not have to modify their code based on the protocol in use.
*
* @param ackMode @see javax.jms.Session
+ *
* @throws Exception
*/
public void topicConsumer(int ackMode, boolean durable) throws Exception
@@ -260,6 +256,27 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
}
+ public void setConfig(String property, String value, boolean deleteDurable) throws NamingException, IOException, ConfigurationException
+ {
+ setConfigurationProperty("virtualhosts.virtualhost."
+ + getConnectionURL().getVirtualHost().substring(1) +
+ CONFIG_SECTION + ".slow-consumer-detection." +
+ "policy.name", "TopicDelete");
+
+ setConfigurationProperty("virtualhosts.virtualhost." +
+ getConnectionURL().getVirtualHost().substring(1) +
+ CONFIG_SECTION + ".slow-consumer-detection." +
+ property, value);
+
+ if (deleteDurable)
+ {
+ setConfigurationProperty("virtualhosts.virtualhost."
+ + getConnectionURL().getVirtualHost().substring(1) +
+ CONFIG_SECTION + ".slow-consumer-detection." +
+ "policy.topicdelete.delete-persistent", "");
+ }
+ }
+
/**
* Test that setting messageCount takes affect on topics
*
@@ -271,10 +288,7 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
{
MAX_QUEUE_MESSAGE_COUNT = 10;
- setConfigurationProperty("virtualhosts.virtualhost." +
- getConnectionURL().getVirtualHost().substring(1) +
- ".queues.slow-consumer-detection." +
- "messageCount", String.valueOf(MAX_QUEUE_MESSAGE_COUNT - 1));
+ setConfig("messageCount", String.valueOf(MAX_QUEUE_MESSAGE_COUNT - 1), false);
//Start the broker
super.setUp();
@@ -295,10 +309,7 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
{
MAX_QUEUE_MESSAGE_COUNT = 10;
- setConfigurationProperty("virtualhosts.virtualhost." +
- getConnectionURL().getVirtualHost().substring(1) +
- ".queues.slow-consumer-detection." +
- "depth", String.valueOf(MESSAGE_SIZE * 9));
+ setConfig("depth", String.valueOf(MESSAGE_SIZE * 9), false);
//Start the broker
super.setUp();
@@ -321,10 +332,7 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
{
MAX_QUEUE_MESSAGE_COUNT = 10;
- setConfigurationProperty("virtualhosts.virtualhost." +
- getConnectionURL().getVirtualHost().substring(1) +
- ".queues.slow-consumer-detection." +
- "messageAge", String.valueOf(DISCONNECTION_WAIT / 2));
+ setConfig("messageAge", String.valueOf(DISCONNECTION_WAIT / 2), false);
//Start the broker
super.setUp();
@@ -346,15 +354,7 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
{
MAX_QUEUE_MESSAGE_COUNT = 10;
- setConfigurationProperty("virtualhosts.virtualhost." +
- getConnectionURL().getVirtualHost().substring(1) +
- ".queues.slow-consumer-detection." +
- "messageCount", String.valueOf(MAX_QUEUE_MESSAGE_COUNT - 1));
-
- setConfigurationProperty("virtualhosts.virtualhost."
- + getConnectionURL().getVirtualHost().substring(1) +
- ".queues.slow-consumer-detection." +
- "policy.topicdelete.delete-persistent", "");
+ setConfig("messageCount", String.valueOf(MAX_QUEUE_MESSAGE_COUNT - 1), true);
//Start the broker
super.setUp();
@@ -377,15 +377,7 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
{
MAX_QUEUE_MESSAGE_COUNT = 10;
- setConfigurationProperty("virtualhosts.virtualhost." +
- getConnectionURL().getVirtualHost().substring(1) +
- ".queues.slow-consumer-detection." +
- "depth", String.valueOf(MESSAGE_SIZE * 9));
-
- setConfigurationProperty("virtualhosts.virtualhost."
- + getConnectionURL().getVirtualHost().substring(1) +
- ".queues.slow-consumer-detection." +
- "policy.topicdelete.delete-persistent", "");
+ setConfig("depth", String.valueOf(MESSAGE_SIZE * 9), true);
//Start the broker
super.setUp();
@@ -395,7 +387,7 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
topicConsumer(Session.AUTO_ACKNOWLEDGE, true);
}
- /**
+ /**
* Test that setting messageAge has an effect on topics
*
* Ensure we set the delete-persistent option
@@ -410,15 +402,7 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
{
MAX_QUEUE_MESSAGE_COUNT = 10;
- setConfigurationProperty("virtualhosts.virtualhost." +
- getConnectionURL().getVirtualHost().substring(1) +
- ".queues.slow-consumer-detection." +
- "messageAge", String.valueOf(DISCONNECTION_WAIT / 5));
-
- setConfigurationProperty("virtualhosts.virtualhost."
- + getConnectionURL().getVirtualHost().substring(1) +
- ".queues.slow-consumer-detection." +
- "policy.topicdelete.delete-persistent", "");
+ setConfig("messageAge", String.valueOf(DISCONNECTION_WAIT / 5), true);
//Start the broker
super.setUp();
@@ -438,6 +422,7 @@ public class SlowConsumerTest extends QpidBrokerTestCase implements ExceptionLis
_disconnectionLatch.countDown();
}
+
/// Connection Listener
public void bytesSent(long count)
diff --git a/java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/systest/GlobalTopicsTest.java b/java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/systest/GlobalTopicsTest.java
new file mode 100644
index 0000000000..1f8103fa3c
--- /dev/null
+++ b/java/broker-plugins/experimental/slowconsumerdetection/src/test/java/org/apache/qpid/systest/GlobalTopicsTest.java
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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.systest;
+
+import org.apache.commons.configuration.ConfigurationException;
+
+import javax.naming.NamingException;
+import java.io.IOException;
+
+public class GlobalTopicsTest extends GlobalQueuesTest
+{
+ @Override
+ public void setUp() throws NamingException, IOException, ConfigurationException
+ {
+ CONFIG_SECTION = ".topics";
+ super.setUp();
+ }
+}