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.
This commit is contained in:
Timothy Bish 2016-05-17 09:59:35 -04:00
parent 2a10e9900a
commit 1263dd8c43
1 changed files with 77 additions and 7 deletions

View File

@ -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");