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/17 18:22:31 UTC
git commit: Restore test case removed last commit.
Repository: activemq
Updated Branches:
refs/heads/trunk 1d39f08c1 -> 226e012d8
Restore test case removed last commit.
Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/226e012d
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/226e012d
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/226e012d
Branch: refs/heads/trunk
Commit: 226e012d88b1d5149433554e1473eed26e7c78a0
Parents: 1d39f08
Author: Timothy Bish <ta...@gmail.com>
Authored: Fri Oct 17 12:22:11 2014 -0400
Committer: Timothy Bish <ta...@gmail.com>
Committed: Fri Oct 17 12:22:27 2014 -0400
----------------------------------------------------------------------
.../activemq/transport/amqp/JMSClientTest.java | 45 ++++++++++++++++++++
1 file changed, 45 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/activemq/blob/226e012d/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 de0bca0..5a29ee2 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;
@@ -849,4 +850,48 @@ public class JMSClientTest extends JMSClientTestSupport {
assertEquals(messageSize, textMessage.getText().length());
assertEquals(messageText, textMessage.getText());
}
+
+ @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;
+ }
+ }));
+ }
}