You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/01/25 17:20:18 UTC

[2/2] activemq-artemis git commit: ARTEMIS-358 test case for topic disappearing on disconnect without unsubscribe

ARTEMIS-358 test case for topic disappearing on disconnect without unsubscribe


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

Branch: refs/heads/master
Commit: 09a3f224cdcb7202fbf88bd114e16d5beb9c9c53
Parents: 69dacb2
Author: Ville Skyttä <vi...@iki.fi>
Authored: Sun Jan 24 15:50:53 2016 +0200
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Jan 25 11:19:54 2016 -0500

----------------------------------------------------------------------
 .../tests/integration/stomp/StompTest.java      | 52 ++++++++++++++++++++
 1 file changed, 52 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/09a3f224/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
index ac9934e..2ad2b9d 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTest.java
@@ -1280,6 +1280,58 @@ public class StompTest extends StompTestBase {
    }
 
    @Test
+   public void testTopicExistsAfterNoUnsubscribeDisconnect() throws Exception {
+
+      String frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL;
+      sendFrame(frame);
+
+      frame = receiveFrame(100000);
+      Assert.assertTrue(frame.startsWith("CONNECTED"));
+
+      frame = "SUBSCRIBE\n" + "destination:" +
+         getTopicPrefix() +
+         getTopicName() +
+         "\n" +
+         "receipt: 12\n" +
+         "\n\n" +
+         Stomp.NULL;
+      sendFrame(frame);
+      // wait for SUBSCRIBE's receipt
+      frame = receiveFrame(10000);
+      Assert.assertTrue(frame.startsWith("RECEIPT"));
+
+      // disconnect, _without unsubscribing_
+      frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
+      sendFrame(frame);
+      waitForFrameToTakeEffect();
+
+      // connect again
+      reconnect();
+      frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL;
+      sendFrame(frame);
+
+      frame = receiveFrame(100000);
+      Assert.assertTrue(frame.startsWith("CONNECTED"));
+
+      // send a receipted message to the topic
+      frame = "SEND\n" + "destination:" + getTopicPrefix() + getTopicName() + "\nreceipt:42\n\n\n" + "Hello World" + Stomp.NULL;
+      sendFrame(frame);
+
+      // the topic should exist and receive the message, and we should get the requested receipt
+      frame = receiveFrame(2000);
+      log.info("Received frame: " + frame);
+      Assert.assertTrue(frame.startsWith("RECEIPT"));
+
+      // ...and nothing else
+      frame = receiveFrame(2000);
+      log.info("Received frame: " + frame);
+      Assert.assertNull(frame);
+
+      frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
+      sendFrame(frame);
+   }
+
+   @Test
    public void testClientAckNotPartOfTransaction() throws Exception {
 
       String frame = "CONNECT\n" + "login: brianm\n" + "passcode: wombats\n\n" + Stomp.NULL;