From 551ac37ffc3b80c474d206026c6d39803e07aa70 Mon Sep 17 00:00:00 2001 From: nickAS21 Date: Tue, 12 Jul 2022 23:51:48 +0300 Subject: [PATCH] fix_bug_tests coap comments1 --- ...AbstractCoapAttributesIntegrationTest.java | 20 +++++++++---------- ...tractCoapServerSideRpcIntegrationTest.java | 6 ++---- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/application/src/test/java/org/thingsboard/server/transport/coap/attributes/AbstractCoapAttributesIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/coap/attributes/AbstractCoapAttributesIntegrationTest.java index a2754e055d..cd9ed239a5 100644 --- a/application/src/test/java/org/thingsboard/server/transport/coap/attributes/AbstractCoapAttributesIntegrationTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/coap/attributes/AbstractCoapAttributesIntegrationTest.java @@ -247,24 +247,24 @@ public abstract class AbstractCoapAttributesIntegrationTest extends AbstractCoap validateUpdateAttributesJsonResponse(callbackCoap, SHARED_ATTRIBUTES_PAYLOAD_ON_CURRENT_STATE_NOTIFICATION); } - int expectedObserveBeforeAddCnt = callbackCoap.getObserve().intValue() + 1; + int expectedObserveForAttributesUpdate = callbackCoap.getObserve().intValue() + 1; doPostAsync("/api/plugins/telemetry/DEVICE/" + savedDevice.getId().getId() + "/attributes/SHARED_SCOPE", SHARED_ATTRIBUTES_PAYLOAD, String.class, status().isOk()); awaitAlias = "await Json Test Subscribe To AttributesUpdates (add attributes)"; await(awaitAlias) .atMost(10, TimeUnit.SECONDS) .until(() -> CoAP.ResponseCode.CONTENT.equals(callbackCoap.getResponseCode()) && callbackCoap.getObserve() != null && - expectedObserveBeforeAddCnt == callbackCoap.getObserve().intValue()); + expectedObserveForAttributesUpdate == callbackCoap.getObserve().intValue()); validateUpdateAttributesJsonResponse(callbackCoap, SHARED_ATTRIBUTES_PAYLOAD); - int expectedObserveBeforeDeleteCnt = callbackCoap.getObserve().intValue() + 1; + int expectedObserveForAttributesDelete = callbackCoap.getObserve().intValue() + 1; doDelete("/api/plugins/telemetry/DEVICE/" + savedDevice.getId().getId() + "/SHARED_SCOPE?keys=sharedJson", String.class); awaitAlias = "await Json Test Subscribe To AttributesUpdates (deleted attributes)"; await(awaitAlias) .atMost(10, TimeUnit.SECONDS) .until(() -> CoAP.ResponseCode.CONTENT.equals(callbackCoap.getResponseCode()) && callbackCoap.getObserve() != null && - expectedObserveBeforeDeleteCnt == callbackCoap.getObserve().intValue()); + expectedObserveForAttributesDelete == callbackCoap.getObserve().intValue()); validateUpdateAttributesJsonResponse(callbackCoap, SHARED_ATTRIBUTES_DELETED_RESPONSE); observeRelation.proactiveCancel(); @@ -295,25 +295,25 @@ public abstract class AbstractCoapAttributesIntegrationTest extends AbstractCoap validateCurrentStateAttributesProtoResponse(callbackCoap); } - int expectedObserveBeforeAddCnt = callbackCoap.getObserve().intValue() + 1; + int expectedObserveForAttributesUpdate = callbackCoap.getObserve().intValue() + 1; doPostAsync("/api/plugins/telemetry/DEVICE/" + savedDevice.getId().getId() + "/attributes/SHARED_SCOPE", SHARED_ATTRIBUTES_PAYLOAD, String.class, status().isOk()); awaitAlias = "await Proto Test Subscribe To Attributes Updates (add attributes)"; await(awaitAlias) .atMost(10, TimeUnit.SECONDS) .until(() -> CoAP.ResponseCode.CONTENT.equals(callbackCoap.getResponseCode()) && callbackCoap.getObserve() != null && - expectedObserveBeforeAddCnt == callbackCoap.getObserve().intValue()); - validateUpdateProtoAttributesResponse(callbackCoap, expectedObserveBeforeAddCnt); + expectedObserveForAttributesUpdate == callbackCoap.getObserve().intValue()); + validateUpdateProtoAttributesResponse(callbackCoap, expectedObserveForAttributesUpdate); - int expectedObserveBeforeDeleteCnt = callbackCoap.getObserve().intValue() + 1; + int expectedObserveForAttributesDelete = callbackCoap.getObserve().intValue() + 1; doDelete("/api/plugins/telemetry/DEVICE/" + savedDevice.getId().getId() + "/SHARED_SCOPE?keys=sharedJson", String.class); awaitAlias = "await Proto Test Subscribe To Attributes Updates (deleted attributes)"; await(awaitAlias) .atMost(10, TimeUnit.SECONDS) .until(() -> CoAP.ResponseCode.CONTENT.equals(callbackCoap.getResponseCode()) && callbackCoap.getObserve() != null && - expectedObserveBeforeDeleteCnt == callbackCoap.getObserve().intValue()); - validateDeleteProtoAttributesResponse(callbackCoap, expectedObserveBeforeDeleteCnt); + expectedObserveForAttributesDelete == callbackCoap.getObserve().intValue()); + validateDeleteProtoAttributesResponse(callbackCoap, expectedObserveForAttributesDelete); observeRelation.proactiveCancel(); assertTrue(observeRelation.isCanceled()); diff --git a/application/src/test/java/org/thingsboard/server/transport/coap/rpc/AbstractCoapServerSideRpcIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/coap/rpc/AbstractCoapServerSideRpcIntegrationTest.java index e17f5b04c2..4ca6cb642c 100644 --- a/application/src/test/java/org/thingsboard/server/transport/coap/rpc/AbstractCoapServerSideRpcIntegrationTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/coap/rpc/AbstractCoapServerSideRpcIntegrationTest.java @@ -83,7 +83,7 @@ public abstract class AbstractCoapServerSideRpcIntegrationTest extends AbstractC callbackCoap.getObserve() != null && 0 == callbackCoap.getObserve().intValue()); validateCurrentStateNotification(callbackCoap); - int expectedObserveBeforeGpioRequestCnt = callbackCoap.getObserve().intValue() + 1; + int expectedObserveCountAfterGpioRequest = callbackCoap.getObserve().intValue() + 1; String setGpioRequest = "{\"method\":\"setGpio\",\"params\":{\"pin\": \"23\",\"value\": 1}}"; String deviceId = savedDevice.getId().getId().toString(); String result = doPostAsync("/api/rpc/oneway/" + deviceId, setGpioRequest, String.class, status().isOk()); @@ -92,7 +92,7 @@ public abstract class AbstractCoapServerSideRpcIntegrationTest extends AbstractC .atMost(10, TimeUnit.SECONDS) .until(() -> CoAP.ResponseCode.CONTENT.equals(callbackCoap.getResponseCode()) && callbackCoap.getObserve() != null && - expectedObserveBeforeGpioRequestCnt == callbackCoap.getObserve().intValue()); + expectedObserveCountAfterGpioRequest == callbackCoap.getObserve().intValue()); validateOneWayStateChangedNotification(callbackCoap, result); observeRelation.proactiveCancel(); @@ -124,8 +124,6 @@ public abstract class AbstractCoapServerSideRpcIntegrationTest extends AbstractC expectedObserveBeforeGpioRequestAddCnt1 == callbackCoap.getObserve().intValue()); validateTwoWayStateChangedNotification(callbackCoap, expectedResponseResult, actualResult); - validateTwoWayStateChangedNotification(callbackCoap, expectedResponseResult, actualResult); - int expectedObserveBeforeGpioRequestAddCnt2 = callbackCoap.getObserve().intValue() + 1; actualResult = doPostAsync("/api/rpc/twoway/" + deviceId, setGpioRequest, String.class, status().isOk()); awaitAlias = "await Two Way Rpc (setGpio(method, params, value) first";