activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1292982 - /activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java
Date Thu, 23 Feb 2012 22:10:58 GMT
Author: tabish
Date: Thu Feb 23 22:10:58 2012
New Revision: 1292982

URL: http://svn.apache.org/viewvc?rev=1292982&view=rev
Log:
Fix the failing test case, was closing the stomp socket before the StompTransport had time
to read and dispatch incoming commands.

Modified:
    activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java

Modified: activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java?rev=1292982&r1=1292981&r2=1292982&view=diff
==============================================================================
--- activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java (original)
+++ activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java Thu
Feb 23 22:10:58 2012
@@ -16,23 +16,23 @@
  */
 package org.apache.activemq.web;
 
-import org.apache.activemq.transport.stomp.StompConnection;
-import org.apache.activemq.transport.stomp.StompFrame;
-
 import java.net.SocketTimeoutException;
+import java.util.HashMap;
+import java.util.concurrent.TimeUnit;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.commons.lang.StringUtils;
+import javax.jms.Message;
+import javax.jms.MessageProducer;
 
-import java.util.*;
-import org.eclipse.jetty.io.Buffer;
+import org.apache.activemq.transport.stomp.Stomp;
+import org.apache.activemq.transport.stomp.StompConnection;
+import org.apache.activemq.transport.stomp.StompFrame;
+import org.apache.commons.lang.StringUtils;
 import org.eclipse.jetty.client.ContentExchange;
 import org.eclipse.jetty.client.HttpClient;
+import org.eclipse.jetty.io.Buffer;
 import org.eclipse.jetty.io.ByteArrayBuffer;
-
-import javax.jms.MessageProducer;
-import javax.jms.Message;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class AjaxTest extends JettyTestSupport {
     private static final Logger LOG = LoggerFactory.getLogger(AjaxTest.class);
@@ -271,6 +271,13 @@ public class AjaxTest extends JettyTestS
         connection.send( "/queue/test", "message3", (String)null, headers );
         connection.send( "/queue/test", "message4", (String)null, headers );
         connection.send( "/queue/test", "message5", (String)null, headers );
+        String frame = "DISCONNECT\n" + "\n\n" + Stomp.NULL;
+        connection.sendFrame(frame);
+
+        // Need to let the transport have enough time to dispatch the incoming messages from
+        // the socket before we break the connection.
+        TimeUnit.SECONDS.sleep(5);
+
         connection.disconnect();
 
         // wait for poll to finish



Mime
View raw message