activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cshan...@apache.org
Subject activemq git commit: https://issues.apache.org/jira/browse/AMQ-6345
Date Thu, 07 Jul 2016 18:26:47 GMT
Repository: activemq
Updated Branches:
  refs/heads/activemq-5.13.x bad922c9e -> 7342b3760


https://issues.apache.org/jira/browse/AMQ-6345

disabling failed assertion for test as it is expected based on how this
test is usin the client

(cherry picked from commit 667ea7c640dd0203b2ecdc83f74435e77cbe44ab)


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

Branch: refs/heads/activemq-5.13.x
Commit: 7342b3760f4cc16c50f7477db13fdf4a48ddfc47
Parents: bad922c
Author: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Authored: Thu Jul 7 18:23:50 2016 +0000
Committer: Christopher L. Shannon (cshannon) <christopher.l.shannon@gmail.com>
Committed: Thu Jul 7 18:26:37 2016 +0000

----------------------------------------------------------------------
 .../activemq/transport/mqtt/MQTTPingReqTest.java   | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/7342b376/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTPingReqTest.java
----------------------------------------------------------------------
diff --git a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTPingReqTest.java
b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTPingReqTest.java
index 1029832..7e8f070 100644
--- a/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTPingReqTest.java
+++ b/activemq-mqtt/src/test/java/org/apache/activemq/transport/mqtt/MQTTPingReqTest.java
@@ -29,6 +29,8 @@ import java.util.concurrent.atomic.AtomicReference;
 
 import org.apache.activemq.util.Wait;
 import org.apache.activemq.util.Wait.Condition;
+import org.fusesource.hawtdispatch.DispatchQueue;
+import org.fusesource.hawtdispatch.internal.SerialDispatchQueue;
 import org.fusesource.hawtdispatch.transport.Transport;
 import org.fusesource.mqtt.client.BlockingConnection;
 import org.fusesource.mqtt.client.Callback;
@@ -46,6 +48,7 @@ import org.junit.rules.Timeout;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
 import org.junit.runners.Parameterized.Parameters;
+import org.mockito.Mockito;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -114,6 +117,8 @@ public class MQTTPingReqTest extends MQTTTestSupport {
             fail(error.get().getMessage());
         }
 
+        disableDispatchAssertion(transport.get());
+
         //Send a PINGREQ without a connect packet first
         final MQTTProtocolCodec codec = new MQTTProtocolCodec();
         codec.setTransport(transport.get());
@@ -153,6 +158,7 @@ public class MQTTPingReqTest extends MQTTTestSupport {
         BlockingConnection connection = new BlockingConnection(new FutureConnection(callbackConnection));
         connection.connect();
         Transport transport =  callbackConnection.transport();
+        disableDispatchAssertion(transport);
 
         //SEND a PINGREQ and wait for the response
         final MQTTProtocolCodec codec = new MQTTProtocolCodec();
@@ -162,4 +168,15 @@ public class MQTTPingReqTest extends MQTTTestSupport {
         //Wait for the response
         assertTrue(pingRespReceived.await(5, TimeUnit.SECONDS));
     }
+
+    private void disableDispatchAssertion(final Transport transport) {
+        //Since we are purposefully bypassing the normal way of sending a packet, turn off
the
+        //assertion
+        DispatchQueue dispatchQueue = transport.getDispatchQueue();
+        if (dispatchQueue instanceof SerialDispatchQueue) {
+            SerialDispatchQueue spyQueue = Mockito.spy((SerialDispatchQueue)dispatchQueue);
+            Mockito.doNothing().when(spyQueue).assertExecuting();
+            transport.setDispatchQueue(spyQueue);
+        }
+    }
 }


Mime
View raw message