You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2012/02/23 23:10:58 UTC
svn commit: r1292982 -
/activemq/trunk/activemq-web-demo/src/test/java/org/apache/activemq/web/AjaxTest.java
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