activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject activemq git commit: Fix failing test in CI. Subscribe should request receipts so that the subscription exists prior to initiating the event that triggers the advisory message sent to the Topic.
Date Tue, 17 May 2016 13:59:41 GMT
Repository: activemq
Updated Branches:
  refs/heads/master 2a10e9900 -> 1263dd8c4


Fix failing test in CI.  Subscribe should request receipts so that the
subscription exists prior to initiating the event that triggers the
advisory message sent to the Topic.

Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/1263dd8c
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/1263dd8c
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/1263dd8c

Branch: refs/heads/master
Commit: 1263dd8c4343fbe9412b377e10d84109e230fd5c
Parents: 2a10e99
Author: Timothy Bish <tabish121@gmail.com>
Authored: Tue May 17 09:59:35 2016 -0400
Committer: Timothy Bish <tabish121@gmail.com>
Committed: Tue May 17 09:59:35 2016 -0400

----------------------------------------------------------------------
 .../transport/stomp/StompAdvisoryTest.java      | 84 ++++++++++++++++++--
 1 file changed, 77 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/1263dd8c/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompAdvisoryTest.java
----------------------------------------------------------------------
diff --git a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompAdvisoryTest.java
b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompAdvisoryTest.java
index 4bef561..8290952 100644
--- a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompAdvisoryTest.java
+++ b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/StompAdvisoryTest.java
@@ -90,10 +90,18 @@ public class StompAdvisoryTest extends StompTestSupport {
 
     @Test(timeout = 60000)
     public void testConnectionAdvisory() throws Exception {
-
         stompConnect();
+
+        HashMap<String, String> subheaders = new HashMap<String, String>(1);
+        subheaders.put("receipt", "id-1");
+
         stompConnection.connect("system", "manager");
-        stompConnection.subscribe("/topic/ActiveMQ.Advisory.Connection", Stomp.Headers.Subscribe.AckModeValues.AUTO);
+        stompConnection.subscribe("/topic/ActiveMQ.Advisory.Connection",
+            Stomp.Headers.Subscribe.AckModeValues.AUTO, subheaders);
+
+        String frame = stompConnection.receiveFrame();
+        LOG.debug("Response to subscribe was: {}", frame);
+        assertTrue(frame.trim().startsWith("RECEIPT"));
 
         // Now connect via openwire and check we get the advisory
         Connection c = cf.createConnection("system", "manager");
@@ -122,11 +130,16 @@ public class StompAdvisoryTest extends StompTestSupport {
 
         HashMap<String, String> subheaders = new HashMap<String, String>(1);
         subheaders.put("transformation", Stomp.Transformations.JMS_JSON.toString());
+        subheaders.put("receipt", "id-1");
 
         stompConnection.connect("system", "manager");
         stompConnection.subscribe("/topic/ActiveMQ.Advisory.Connection",
                 Stomp.Headers.Subscribe.AckModeValues.AUTO, subheaders);
 
+        String frame = stompConnection.receiveFrame();
+        LOG.debug("Response to subscribe was: {}", frame);
+        assertTrue(frame.trim().startsWith("RECEIPT"));
+
         // Now connect via openwire and check we get the advisory
         Connection c = cf.createConnection("system", "manager");
         c.start();
@@ -154,11 +167,16 @@ public class StompAdvisoryTest extends StompTestSupport {
 
         HashMap<String, String> subheaders = new HashMap<String, String>(1);
         subheaders.put("transformation", Stomp.Transformations.JMS_XML.toString());
+        subheaders.put("receipt", "id-1");
 
         stompConnection.connect("system", "manager");
         stompConnection.subscribe("/topic/ActiveMQ.Advisory.Connection",
                 Stomp.Headers.Subscribe.AckModeValues.AUTO, subheaders);
 
+        String frame = stompConnection.receiveFrame();
+        LOG.debug("Response to subscribe was: {}", frame);
+        assertTrue(frame.trim().startsWith("RECEIPT"));
+
         // Now connect via openwire and check we get the advisory
         Connection c = cf.createConnection("system", "manager");
         c.start();
@@ -186,8 +204,16 @@ public class StompAdvisoryTest extends StompTestSupport {
 
         Destination dest = new ActiveMQQueue("testConsumerAdvisory");
 
+        HashMap<String, String> subheaders = new HashMap<String, String>(1);
+        subheaders.put("receipt", "id-1");
+
         stompConnection.connect("system", "manager");
-        stompConnection.subscribe("/topic/ActiveMQ.Advisory.Consumer.>", Stomp.Headers.Subscribe.AckModeValues.AUTO);
+        stompConnection.subscribe("/topic/ActiveMQ.Advisory.Consumer.>",
+            Stomp.Headers.Subscribe.AckModeValues.AUTO, subheaders);
+
+        String frame = stompConnection.receiveFrame();
+        LOG.debug("Response to subscribe was: {}", frame);
+        assertTrue(frame.trim().startsWith("RECEIPT"));
 
         // Now connect via openwire and check we get the advisory
         Connection c = cf.createConnection("system", "manager");
@@ -213,8 +239,16 @@ public class StompAdvisoryTest extends StompTestSupport {
 
         Destination dest = new ActiveMQQueue("testProducerAdvisory");
 
+        HashMap<String, String> subheaders = new HashMap<String, String>(1);
+        subheaders.put("receipt", "id-1");
+
         stompConnection.connect("system", "manager");
-        stompConnection.subscribe("/topic/ActiveMQ.Advisory.Producer.>", Stomp.Headers.Subscribe.AckModeValues.AUTO);
+        stompConnection.subscribe("/topic/ActiveMQ.Advisory.Producer.>",
+            Stomp.Headers.Subscribe.AckModeValues.AUTO, subheaders);
+
+        String frame = stompConnection.receiveFrame();
+        LOG.debug("Response to subscribe was: {}", frame);
+        assertTrue(frame.trim().startsWith("RECEIPT"));
 
         // Now connect via openwire and check we get the advisory
         Connection c = cf.createConnection("system", "manager");
@@ -243,11 +277,16 @@ public class StompAdvisoryTest extends StompTestSupport {
 
         HashMap<String, String> subheaders = new HashMap<String, String>(1);
         subheaders.put("transformation", Stomp.Transformations.JMS_ADVISORY_XML.toString());
+        subheaders.put("receipt", "id-1");
 
         stompConnection.connect("system", "manager");
         stompConnection.subscribe("/topic/ActiveMQ.Advisory.Producer.>",
                 Stomp.Headers.Subscribe.AckModeValues.AUTO, subheaders);
 
+        String frame = stompConnection.receiveFrame();
+        LOG.debug("Response to subscribe was: {}", frame);
+        assertTrue(frame.trim().startsWith("RECEIPT"));
+
         // Now connect via openwire and check we get the advisory
         Connection c = cf.createConnection("system", "manager");
         c.start();
@@ -275,11 +314,16 @@ public class StompAdvisoryTest extends StompTestSupport {
 
         HashMap<String, String> subheaders = new HashMap<String, String>(1);
         subheaders.put("transformation", Stomp.Transformations.JMS_ADVISORY_JSON.toString());
+        subheaders.put("receipt", "id-1");
 
         stompConnection.connect("system", "manager");
         stompConnection.subscribe("/topic/ActiveMQ.Advisory.Producer.>",
                 Stomp.Headers.Subscribe.AckModeValues.AUTO, subheaders);
 
+        String frame = stompConnection.receiveFrame();
+        LOG.debug("Response to subscribe was: {}", frame);
+        assertTrue(frame.trim().startsWith("RECEIPT"));
+
         // Now connect via openwire and check we get the advisory
         Connection c = cf.createConnection("system", "manager");
         c.start();
@@ -352,8 +396,17 @@ public class StompAdvisoryTest extends StompTestSupport {
         cf.setWatchTopicAdvisories(false);
 
         stompConnect();
+
+        HashMap<String, String> subheaders = new HashMap<String, String>(1);
+        subheaders.put("receipt", "id-1");
+
         stompConnection.connect("system", "manager");
-        stompConnection.subscribe("/topic/ActiveMQ.Advisory.TempQueue", Stomp.Headers.Subscribe.AckModeValues.AUTO);
+        stompConnection.subscribe("/topic/ActiveMQ.Advisory.TempQueue",
+            Stomp.Headers.Subscribe.AckModeValues.AUTO, subheaders);
+
+        String frame = stompConnection.receiveFrame();
+        LOG.debug("Response to subscribe was: {}", frame);
+        assertTrue(frame.trim().startsWith("RECEIPT"));
 
         // Now connect via openwire and check we get the advisory
         Connection connection = cf.createConnection("system", "manager");
@@ -374,8 +427,17 @@ public class StompAdvisoryTest extends StompTestSupport {
         cf.setWatchTopicAdvisories(false);
 
         stompConnect();
+
+        HashMap<String, String> subheaders = new HashMap<String, String>(1);
+        subheaders.put("receipt", "id-1");
+
         stompConnection.connect("system", "manager");
-        stompConnection.subscribe("/topic/ActiveMQ.Advisory.TempTopic", Stomp.Headers.Subscribe.AckModeValues.AUTO);
+        stompConnection.subscribe("/topic/ActiveMQ.Advisory.TempTopic",
+            Stomp.Headers.Subscribe.AckModeValues.AUTO, subheaders);
+
+        String frame = stompConnection.receiveFrame();
+        LOG.debug("Response to subscribe was: {}", frame);
+        assertTrue(frame.trim().startsWith("RECEIPT"));
 
         // Now connect via openwire and check we get the advisory
         Connection connection = cf.createConnection("system", "manager");
@@ -395,9 +457,17 @@ public class StompAdvisoryTest extends StompTestSupport {
 
         cf.setWatchTopicAdvisories(true);
 
+        HashMap<String, String> subheaders = new HashMap<String, String>(1);
+        subheaders.put("receipt", "id-1");
+
         stompConnect();
         stompConnection.connect("system", "manager");
-        stompConnection.subscribe("/topic/ActiveMQ.Advisory.TempTopic,/topic/ActiveMQ.Advisory.TempQueue",
Stomp.Headers.Subscribe.AckModeValues.AUTO);
+        stompConnection.subscribe("/topic/ActiveMQ.Advisory.TempTopic,/topic/ActiveMQ.Advisory.TempQueue",
+            Stomp.Headers.Subscribe.AckModeValues.AUTO, subheaders);
+
+        String frame = stompConnection.receiveFrame();
+        LOG.debug("Response to subscribe was: {}", frame);
+        assertTrue(frame.trim().startsWith("RECEIPT"));
 
         // Now connect via openwire and check we get the advisory
         Connection connection = cf.createConnection("system", "manager");


Mime
View raw message