diff --git a/application/src/test/java/org/thingsboard/server/transport/coap/CoapTestCallback.java b/application/src/test/java/org/thingsboard/server/transport/coap/CoapTestCallback.java index 07eadd731d..527846bc36 100644 --- a/application/src/test/java/org/thingsboard/server/transport/coap/CoapTestCallback.java +++ b/application/src/test/java/org/thingsboard/server/transport/coap/CoapTestCallback.java @@ -25,9 +25,9 @@ import org.eclipse.californium.core.coap.CoAP; @Data public class CoapTestCallback implements CoapHandler { - protected Integer observe; - protected byte[] payloadBytes; - protected CoAP.ResponseCode responseCode; + protected volatile Integer observe; + protected volatile byte[] payloadBytes; + protected volatile CoAP.ResponseCode responseCode; public Integer getObserve() { return observe; diff --git a/pom.xml b/pom.xml index ed62452870..5711f80fe5 100755 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ 3.11.14 31.1-jre 2.6.1 - 3.4 + 3.12.0 1.15 2.11.0 1.2 diff --git a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/rest/TbHttpClientTest.java b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/rest/TbHttpClientTest.java index d71d4aacbe..bd69939f94 100644 --- a/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/rest/TbHttpClientTest.java +++ b/rule-engine/rule-engine-components/src/test/java/org/thingsboard/rule/engine/rest/TbHttpClientTest.java @@ -18,7 +18,6 @@ package org.thingsboard.rule.engine.rest; import io.netty.channel.EventLoopGroup; import io.netty.channel.nio.NioEventLoopGroup; -import org.awaitility.Awaitility; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeEach; @@ -41,6 +40,7 @@ import org.thingsboard.server.common.msg.TbMsgMetaData; import java.net.URI; import java.util.List; import java.util.Map; +import java.util.concurrent.CountDownLatch; import java.util.concurrent.TimeUnit; import static org.assertj.core.api.Assertions.assertThatThrownBy; @@ -169,21 +169,20 @@ public class TbHttpClientTest { capturedData.capture() )).thenReturn(successMsg); + CountDownLatch latch = new CountDownLatch(1); + httpClient.processMessage(ctx, msg, - m -> ctx.tellSuccess(msg), - ctx::tellFailure); - - Awaitility.await() - .atMost(30, TimeUnit.SECONDS) - .until(() -> { - try { - verify(ctx, times(1)).tellSuccess(any()); - return true; - } catch (Exception e) { - return false; - } + m -> { + ctx.tellSuccess(msg); + latch.countDown(); + }, + (m, t) -> { + ctx.tellFailure(m, t); + latch.countDown(); }); + latch.await(5, TimeUnit.SECONDS); + verify(ctx, times(1)).tellSuccess(any()); verify(ctx, times(0)).tellFailure(any(), any()); Assertions.assertEquals(successResponseBody, capturedData.getValue());