Repository: qpid-jms Updated Branches: refs/heads/master 71abd4b00 -> 5636af006
QPIDJMS-200 test updates Workaround what appear to be some new issues with the 5.14.0 broker when running in CI. Project: http://git-wip-us.apache.org/repos/asf/qpid-jms/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-jms/commit/5636af00 Tree: http://git-wip-us.apache.org/repos/asf/qpid-jms/tree/5636af00 Diff: http://git-wip-us.apache.org/repos/asf/qpid-jms/diff/5636af00 Branch: refs/heads/master Commit: 5636af00663baebbed665f20b4b16562cb55b2a4 Parents: 71abd4b Author: Timothy Bish <[email protected]> Authored: Mon Aug 8 14:50:37 2016 -0400 Committer: Timothy Bish <[email protected]> Committed: Mon Aug 8 14:50:37 2016 -0400 ---------------------------------------------------------------------- .../jms/consumer/JmsDurableSubscriberTest.java | 44 +++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-jms/blob/5636af00/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/consumer/JmsDurableSubscriberTest.java ---------------------------------------------------------------------- diff --git a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/consumer/JmsDurableSubscriberTest.java b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/consumer/JmsDurableSubscriberTest.java index 81ab8b7..9c73973 100644 --- a/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/consumer/JmsDurableSubscriberTest.java +++ b/qpid-jms-interop-tests/qpid-jms-activemq-tests/src/test/java/org/apache/qpid/jms/consumer/JmsDurableSubscriberTest.java @@ -37,6 +37,8 @@ import javax.jms.TopicSubscriber; import org.apache.activemq.broker.jmx.BrokerViewMBean; import org.apache.activemq.broker.jmx.TopicViewMBean; +import org.apache.qpid.jms.JmsConnection; +import org.apache.qpid.jms.policy.JmsDefaultPresettlePolicy; import org.apache.qpid.jms.support.AmqpTestSupport; import org.apache.qpid.jms.support.Wait; import org.junit.Test; @@ -67,6 +69,9 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { connection.setClientID("DURABLE-AMQP"); connection.start(); + assertEquals(0, brokerService.getAdminView().getDurableTopicSubscribers().length); + assertEquals(0, brokerService.getAdminView().getInactiveDurableTopicSubscribers().length); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); assertNotNull(session); Topic topic = session.createTopic(name.getMethodName()); @@ -82,6 +87,8 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { assertEquals(0, brokerService.getAdminView().getDurableTopicSubscribers().length); assertEquals(1, brokerService.getAdminView().getInactiveDurableTopicSubscribers().length); + + session.unsubscribe(getSubscriptionName()); } @Test(timeout = 60000) @@ -90,6 +97,9 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { connection.setClientID("DURABLE-AMQP"); connection.start(); + assertEquals(0, brokerService.getAdminView().getDurableTopicSubscribers().length); + assertEquals(0, brokerService.getAdminView().getInactiveDurableTopicSubscribers().length); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); assertNotNull(session); Topic topic = session.createTopic(name.getMethodName()); @@ -110,6 +120,9 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { connection.setClientID("DURABLE-AMQP"); connection.start(); + assertEquals(0, brokerService.getAdminView().getDurableTopicSubscribers().length); + assertEquals(0, brokerService.getAdminView().getInactiveDurableTopicSubscribers().length); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); assertNotNull(session); @@ -130,6 +143,9 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { connection.setClientID("DURABLE-AMQP"); connection.start(); + assertEquals(0, brokerService.getAdminView().getDurableTopicSubscribers().length); + assertEquals(0, brokerService.getAdminView().getInactiveDurableTopicSubscribers().length); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); assertNotNull(session); Topic topic = session.createTopic(name.getMethodName()); @@ -166,6 +182,9 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { connection.setClientID("DURABLE-AMQP"); connection.start(); + assertEquals(0, brokerService.getAdminView().getDurableTopicSubscribers().length); + assertEquals(0, brokerService.getAdminView().getInactiveDurableTopicSubscribers().length); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); assertNotNull(session); Topic topic = session.createTopic(name.getMethodName()); @@ -186,6 +205,10 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { assertEquals(1, brokerService.getAdminView().getDurableTopicSubscribers().length); assertEquals(0, brokerService.getAdminView().getInactiveDurableTopicSubscribers().length); + + subscriber.close(); + + session.unsubscribe(getSubscriptionName()); } @Test(timeout = 60000) @@ -194,6 +217,9 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { connection.setClientID("DURABLE-AMQP"); connection.start(); + assertEquals(0, brokerService.getAdminView().getDurableTopicSubscribers().length); + assertEquals(0, brokerService.getAdminView().getInactiveDurableTopicSubscribers().length); + final int MSG_COUNT = 5; Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); @@ -234,6 +260,10 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { }); assertTrue("Only recieved messages: " + messages.getCount(), messages.await(30, TimeUnit.SECONDS)); + + subscriber.close(); + + session.unsubscribe(getSubscriptionName()); } @Test @@ -242,6 +272,12 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { connection.setClientID("DURABLE-AMQP"); connection.start(); + JmsConnection jmsConnection = (JmsConnection) connection; + ((JmsDefaultPresettlePolicy) jmsConnection.getPresettlePolicy()).setPresettleAll(true); + + assertEquals(0, brokerService.getAdminView().getDurableTopicSubscribers().length); + assertEquals(0, brokerService.getAdminView().getInactiveDurableTopicSubscribers().length); + Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Topic topic = session.createTopic(getDestinationName()); @@ -264,7 +300,7 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { // Durable noLocal=true subscription should not receive them { - Message message = durableSubscriber.receive(2000); + Message message = durableSubscriber.receive(250); assertNull(message); } @@ -303,7 +339,7 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { // Durable noLocal=false subscription should not receive them as the subscriptions should // have been removed and recreated to update the noLocal flag. { - Message message = durableSubscriber.receive(2000); + Message message = durableSubscriber.receive(250); assertNull(message); } @@ -315,6 +351,10 @@ public class JmsDurableSubscriberTest extends AmqpTestSupport { Message message = durableSubscriber.receive(5000); assertNotNull("Should get local messages now", message); } + + durableSubscriber.close(); + + session.unsubscribe(getSubscriptionName()); } private void publishToTopic(Session session, Topic destination) throws Exception { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
