From db66f191097e2283a4e8337f13558aeea2aa73f5 Mon Sep 17 00:00:00 2001 From: andsel Date: Tue, 8 Dec 2015 19:46:43 +0100 Subject: [PATCH] Added sleep in integration tests to let MQTT clients finish it's job when we need a serial behaviour --- .../server/ServerIntegrationEmbeddedPublishTest.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/broker/src/test/java/io/moquette/server/ServerIntegrationEmbeddedPublishTest.java b/broker/src/test/java/io/moquette/server/ServerIntegrationEmbeddedPublishTest.java index f4538b43..dc16f54b 100644 --- a/broker/src/test/java/io/moquette/server/ServerIntegrationEmbeddedPublishTest.java +++ b/broker/src/test/java/io/moquette/server/ServerIntegrationEmbeddedPublishTest.java @@ -129,6 +129,8 @@ public class ServerIntegrationEmbeddedPublishTest { LOG.info("*** testClientSubscribeBeforeRetainedQoS0IsSent ***"); subscribeToWithQos("/topic", QoS.AT_MOST_ONCE); + //super ugly but we need the MQTT client lib finish it's job before us + Thread.sleep(1000); //Exercise internalPublishToWithQosAndRetained("/topic", QOSType.MOST_ONE, true); @@ -154,6 +156,8 @@ public class ServerIntegrationEmbeddedPublishTest { LOG.info("*** testClientSubscribeBeforeNotRetainedQoS1IsSent ***"); subscribeToWithQos("/topic", QoS.AT_LEAST_ONCE); + //super ugly but we need the MQTT client lib finish it's job before us + Thread.sleep(1000); //Exercise internalPublishToWithQosAndRetained("/topic", QOSType.LEAST_ONE, false); @@ -179,6 +183,8 @@ public class ServerIntegrationEmbeddedPublishTest { LOG.info("*** testClientSubscribeBeforeRetainedQoS1IsSent ***"); subscribeToWithQos("/topic", QoS.AT_LEAST_ONCE); + //super ugly but we need the MQTT client lib finish it's job before us + Thread.sleep(1000); //Exercise internalPublishToWithQosAndRetained("/topic", QOSType.LEAST_ONE, true); @@ -204,6 +210,8 @@ public class ServerIntegrationEmbeddedPublishTest { LOG.info("*** testClientSubscribeBeforeNotRetainedQoS2IsSent ***"); subscribeToWithQos("/topic", QoS.EXACTLY_ONCE); + //super ugly but we need the MQTT client lib finish it's job before us + Thread.sleep(1000); //Exercise internalPublishToWithQosAndRetained("/topic", QOSType.EXACTLY_ONCE, false); @@ -229,6 +237,8 @@ public class ServerIntegrationEmbeddedPublishTest { LOG.info("*** testClientSubscribeBeforeRetainedQoS2IsSent ***"); subscribeToWithQos("/topic", QoS.EXACTLY_ONCE); + //super ugly but we need the MQTT client lib finish it's job before us + Thread.sleep(1000); //Exercise internalPublishToWithQosAndRetained("/topic", QOSType.EXACTLY_ONCE, true);