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

This commit is contained in:
Ville Skyttä 2016-01-24 15:50:53 +02:00 committed by Clebert Suconic
parent 69dacb2851
commit 09a3f224cd
1 changed files with 52 additions and 0 deletions

View File

@ -1279,6 +1279,58 @@ public class StompTest extends StompTestBase {
sendFrame(frame);
}
@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 {