mirror of https://github.com/apache/activemq.git
added test to verify that messages sent are received in order.
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@382007 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2c440b40a4
commit
01b50e941b
|
@ -105,6 +105,7 @@ public class StompTest extends CombinationTestSupport {
|
|||
}
|
||||
|
||||
|
||||
|
||||
public void sendMessage(String msg) throws Exception {
|
||||
sendMessage(msg, "foo", "xyz");
|
||||
}
|
||||
|
@ -215,6 +216,58 @@ public class StompTest extends CombinationTestSupport {
|
|||
}
|
||||
|
||||
|
||||
public void testMessagesAreInOrder() throws Exception {
|
||||
int ctr = 10;
|
||||
String[] data = new String[ctr];
|
||||
|
||||
String frame =
|
||||
"CONNECT\n" +
|
||||
"login: brianm\n" +
|
||||
"passcode: wombats\n\n" +
|
||||
Stomp.NULL;
|
||||
sendFrame(frame);
|
||||
|
||||
frame = receiveFrame(100000);
|
||||
assertTrue(frame.startsWith("CONNECTED"));
|
||||
|
||||
frame =
|
||||
"SUBSCRIBE\n" +
|
||||
"destination:/queue/" + getQueueName() + "\n" +
|
||||
"ack:auto\n\n" +
|
||||
Stomp.NULL;
|
||||
sendFrame(frame);
|
||||
|
||||
for (int i = 0; i < ctr; ++i) {
|
||||
data[i] = getName() + i;
|
||||
sendMessage(data[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < ctr; ++i) {
|
||||
frame = receiveFrame(1000);
|
||||
assertTrue("Message not in order", frame.indexOf(data[i]) >=0 );
|
||||
}
|
||||
|
||||
// sleep a while before publishing another set of messages
|
||||
waitForFrameToTakeEffect();
|
||||
|
||||
for (int i = 0; i < ctr; ++i) {
|
||||
data[i] = getName() + ":second:" + i;
|
||||
sendMessage(data[i]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < ctr; ++i) {
|
||||
frame = receiveFrame(1000);
|
||||
assertTrue("Message not in order", frame.indexOf(data[i]) >=0 );
|
||||
}
|
||||
|
||||
frame =
|
||||
"DISCONNECT\n" +
|
||||
"\n\n" +
|
||||
Stomp.NULL;
|
||||
sendFrame(frame);
|
||||
}
|
||||
|
||||
|
||||
public void testSubscribeWithAutoAckAndSelector() throws Exception {
|
||||
|
||||
String frame =
|
||||
|
|
Loading…
Reference in New Issue