activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From clebertsuco...@apache.org
Subject [1/3] activemq-artemis git commit: small improvement on stomp test
Date Tue, 26 Jan 2016 02:33:45 GMT
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 8c90e5bb8 -> 065bd1678


small improvement on stomp test


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/af150b5b
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/af150b5b
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/af150b5b

Branch: refs/heads/master
Commit: af150b5beaf4b59950febb05196a4ed7b161d5da
Parents: 2c4312d
Author: Clebert Suconic <clebertsuconic@apache.org>
Authored: Mon Jan 25 21:27:18 2016 -0500
Committer: Clebert Suconic <clebertsuconic@apache.org>
Committed: Mon Jan 25 21:33:28 2016 -0500

----------------------------------------------------------------------
 .../tests/integration/stomp/v12/StompV12Test.java   | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/af150b5b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
----------------------------------------------------------------------
diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
index 6711643..246cc30 100644
--- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
+++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v12/StompV12Test.java
@@ -1038,7 +1038,7 @@ public class StompV12Test extends StompV11TestBase {
 
       Assert.assertEquals("ERROR", frame.getCommand());
 
-      Thread.sleep(1000);
+      waitDisconnect(connV12);
       Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
 
       //message still there.
@@ -1065,7 +1065,7 @@ public class StompV12Test extends StompV11TestBase {
 
       System.out.println("Receiver error: " + error);
 
-      Thread.sleep(1000);
+      waitDisconnect(connV12);
       Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
 
       //message should still there
@@ -1100,7 +1100,7 @@ public class StompV12Test extends StompV11TestBase {
 
       Assert.assertEquals("answer-me", error.getHeader("receipt-id"));
 
-      Thread.sleep(1000);
+      waitDisconnect(connV12);
       Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
 
       //message should still there
@@ -1135,7 +1135,7 @@ public class StompV12Test extends StompV11TestBase {
 
       Assert.assertEquals("answer-me", error.getHeader("receipt-id"));
 
-      Thread.sleep(1000);
+      waitDisconnect(connV12);
       Assert.assertFalse("Should be disconnected in STOMP 1.2 after ERROR", connV12.isConnected());
 
       //message should still there
@@ -1144,6 +1144,14 @@ public class StompV12Test extends StompV11TestBase {
       Assert.assertNotNull(message);
    }
 
+   protected void waitDisconnect(StompClientConnectionV12 connection) throws Exception {
+
+      long timeout = System.currentTimeMillis() + 10000;
+      while (timeout > System.currentTimeMillis() && connection.isConnected())
{
+         Thread.sleep(10);
+      }
+   }
+
    @Test
    public void testAckModeClient() throws Exception {
       connV12.connect(defUser, defPass);


Mime
View raw message