activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r382007 - /incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
Date Wed, 01 Mar 2006 13:06:57 GMT
Author: jlim
Date: Wed Mar  1 05:06:55 2006
New Revision: 382007

URL: http://svn.apache.org/viewcvs?rev=382007&view=rev
Log:
added test to  verify that  messages sent are received in order.

Modified:
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java?rev=382007&r1=382006&r2=382007&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompTest.java
Wed Mar  1 05:06:55 2006
@@ -104,7 +104,8 @@
         } 
     }
 
-    
+
+
     public void sendMessage(String msg) throws Exception {
         sendMessage(msg, "foo", "xyz");
     }
@@ -213,7 +214,59 @@
             Stomp.NULL;
         sendFrame(frame);
     }
-    
+
+
+    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 {
 



Mime
View raw message