You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/10/16 22:11:47 UTC
git commit: Add a test case for durable topic unsubscribe.
Repository: activemq
Updated Branches:
refs/heads/trunk e90f1decb -> 41ca0d946
Add a test case for durable topic unsubscribe.
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/41ca0d94
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/41ca0d94
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/41ca0d94
Branch: refs/heads/trunk
Commit: 41ca0d94647ad303c22eb1e86796203fd69dbb44
Parents: e90f1de
Author: Timothy Bish <ta...@gmail.com>
Authored: Thu Oct 16 16:11:26 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Thu Oct 16 16:11:26 2014 -0400
----------------------------------------------------------------------
.../activemq/transport/amqp/JMSClientTest.java | 45 ++++++++++++++++++++
1 file changed, 45 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/41ca0d94/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
----------------------------------------------------------------------
diff --git a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
index 2122470..65ec92c 100644
--- a/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
+++ b/activemq-amqp/src/test/java/org/apache/activemq/transport/amqp/JMSClientTest.java
@@ -42,6 +42,7 @@ import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.Topic;
+import org.apache.activemq.broker.jmx.BrokerViewMBean;
import org.apache.activemq.broker.jmx.ConnectorViewMBean;
import org.apache.activemq.broker.jmx.QueueViewMBean;
import org.apache.activemq.transport.amqp.joram.ActiveMQAdmin;
@@ -629,6 +630,50 @@ public class JMSClientTest extends JMSClientTestSupport {
}
@Test(timeout=30000)
+ public void testDurableConsumerUnsubscribe() throws Exception {
+ ActiveMQAdmin.enableJMSFrameTracing();
+
+ final BrokerViewMBean broker = getProxyToBroker();
+
+ connection = createConnection();
+ connection.start();
+
+ Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
+ Topic topic = session.createTopic(getDestinationName());
+ MessageConsumer consumer = session.createDurableSubscriber(topic, "DurbaleTopic");
+
+ assertTrue(Wait.waitFor(new Wait.Condition() {
+
+ @Override
+ public boolean isSatisified() throws Exception {
+ return broker.getInactiveDurableTopicSubscribers().length == 0 &&
+ broker.getDurableTopicSubscribers().length == 1;
+ }
+ }));
+
+ consumer.close();
+
+ assertTrue(Wait.waitFor(new Wait.Condition() {
+
+ @Override
+ public boolean isSatisified() throws Exception {
+ return broker.getInactiveDurableTopicSubscribers().length == 1 &&
+ broker.getDurableTopicSubscribers().length == 0;
+ }
+ }));
+
+ session.unsubscribe("DurbaleTopic");
+ assertTrue(Wait.waitFor(new Wait.Condition() {
+
+ @Override
+ public boolean isSatisified() throws Exception {
+ return broker.getInactiveDurableTopicSubscribers().length == 0 &&
+ broker.getDurableTopicSubscribers().length == 0;
+ }
+ }));
+ }
+
+ @Test(timeout=30000)
public void testTopicConsumerAsync() throws Exception {
ActiveMQAdmin.enableJMSFrameTracing();
final CountDownLatch latch = new CountDownLatch(1);