Repository: activemq Updated Branches: refs/heads/master b5b087d55 -> 667ea7c64
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 Project: http://git-wip-us.apache.org/repos/asf/activemq/repo Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/667ea7c6 Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/667ea7c6 Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/667ea7c6 Branch: refs/heads/master Commit: 667ea7c640dd0203b2ecdc83f74435e77cbe44ab Parents: b5b087d Author: Christopher L. Shannon (cshannon) <[email protected]> Authored: Thu Jul 7 18:23:50 2016 +0000 Committer: Christopher L. Shannon (cshannon) <[email protected]> Committed: Thu Jul 7 18:23:50 2016 +0000 ---------------------------------------------------------------------- .../activemq/transport/mqtt/MQTTPingReqTest.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq/blob/667ea7c6/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); + } + } }
