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:
Jonas B. Lim 2006-03-01 13:06:55 +00:00
parent 2c440b40a4
commit 01b50e941b
1 changed files with 55 additions and 2 deletions

View File

@ -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 =