Return-Path: X-Original-To: apmail-activemq-commits-archive@www.apache.org Delivered-To: apmail-activemq-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 03D5F17375 for ; Fri, 17 Oct 2014 16:22:33 +0000 (UTC) Received: (qmail 45267 invoked by uid 500); 17 Oct 2014 16:22:32 -0000 Delivered-To: apmail-activemq-commits-archive@activemq.apache.org Received: (qmail 45221 invoked by uid 500); 17 Oct 2014 16:22:32 -0000 Mailing-List: contact commits-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@activemq.apache.org Delivered-To: mailing list commits@activemq.apache.org Received: (qmail 45212 invoked by uid 99); 17 Oct 2014 16:22:32 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2014 16:22:32 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B2118939F83; Fri, 17 Oct 2014 16:22:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: tabish@apache.org To: commits@activemq.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: Restore test case removed last commit. Date: Fri, 17 Oct 2014 16:22:31 +0000 (UTC) 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 Authored: Fri Oct 17 12:22:11 2014 -0400 Committer: Timothy Bish 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; + } + })); + } }