diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java index e2b70a4490..0bdc221b1b 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/AbstractLwM2MIntegrationTest.java @@ -186,7 +186,7 @@ public abstract class AbstractLwM2MIntegrationTest extends AbstractWebsocketTest wsClient.registerWaitForUpdate(); this.endpoint = endpoint; - createNewClient (security, coapConfig); + createNewClient (security, coapConfig, false); String msg = wsClient.waitForUpdate(); EntityDataUpdate update = mapper.readValue(msg, EntityDataUpdate.class); @@ -256,12 +256,11 @@ public abstract class AbstractLwM2MIntegrationTest extends AbstractWebsocketTest this.endpoint = endpoint; } - public void createNewClient (Security security, NetworkConfig coapConfig) throws Exception { + public void createNewClient (Security security, NetworkConfig coapConfig, boolean isRpc) throws Exception { clientDestroy(); client = new LwM2MTestClient(this.executor, this.endpoint); int clientPort = SocketUtils.findAvailableTcpPort(); - client.init(security, coapConfig, clientPort); - client.start(); + client.init(security, coapConfig, clientPort, isRpc); } private void clientDestroy() { diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java index f4ef1463d5..1c62b2b79d 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/client/LwM2MTestClient.java @@ -46,7 +46,6 @@ import org.eclipse.leshan.core.request.RegisterRequest; import org.eclipse.leshan.core.request.UpdateRequest; import org.thingsboard.server.transport.lwm2m.utils.LwM2mValueConverterImpl; import org.junit.Assert; -import org.junit.Assert; import java.io.IOException; import java.net.InetSocketAddress; @@ -85,7 +84,7 @@ public class LwM2MTestClient { private LwM2MLocationParams locationParams; private LwM2mTemperatureSensor lwM2MTemperatureSensor; - public void init(Security security, NetworkConfig coapConfig, int port) throws InvalidDDFFileException, IOException { + public void init(Security security, NetworkConfig coapConfig, int port, boolean isRpc) throws InvalidDDFFileException, IOException { Assert.assertNull("client already initialized", client); List models = new ArrayList<>(); for (String resourceName : resources) { @@ -250,6 +249,9 @@ public class LwM2MTestClient { } }; this.client.addObserver(observer); + if (!isRpc) { + client.start(); + } } public void destroy() { diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/ota/sql/OtaLwM2MIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/ota/sql/OtaLwM2MIntegrationTest.java index de7c432564..68f8c98d6f 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/ota/sql/OtaLwM2MIntegrationTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/ota/sql/OtaLwM2MIntegrationTest.java @@ -137,7 +137,7 @@ public class OtaLwM2MIntegrationTest extends AbstractOtaLwM2MIntegrationTest { createDeviceProfile(transportConfiguration); NoSecClientCredentials credentials = createNoSecClientCredentials(endpoint); final Device device = createDevice(credentials); - createNewClient(SECURITY, COAP_CONFIG); + createNewClient(SECURITY, COAP_CONFIG, false); Thread.sleep(1000); @@ -164,7 +164,7 @@ public class OtaLwM2MIntegrationTest extends AbstractOtaLwM2MIntegrationTest { createDeviceProfile(OTA_TRANSPORT_CONFIGURATION); NoSecClientCredentials credentials = createNoSecClientCredentials(endpoint); final Device device = createDevice(credentials); - createNewClient(SECURITY, COAP_CONFIG); + createNewClient(SECURITY, COAP_CONFIG, false); Thread.sleep(1000); @@ -203,7 +203,7 @@ public class OtaLwM2MIntegrationTest extends AbstractOtaLwM2MIntegrationTest { createDeviceProfile(OTA_TRANSPORT_CONFIGURATION); NoSecClientCredentials credentials = createNoSecClientCredentials(endpoint); final Device device = createDevice(credentials); - createNewClient(SECURITY, COAP_CONFIG); + createNewClient(SECURITY, COAP_CONFIG, false); Thread.sleep(1000); diff --git a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationTest.java b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationTest.java index 56668bbe56..ab08379389 100644 --- a/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationTest.java +++ b/application/src/test/java/org/thingsboard/server/transport/lwm2m/rpc/AbstractRpcLwM2MIntegrationTest.java @@ -81,7 +81,7 @@ public abstract class AbstractRpcLwM2MIntegrationTest extends AbstractLwM2MInteg @Before public void beforeTest() throws Exception { init(); - createNewClient (SECURITY, COAP_CONFIG); + createNewClient (SECURITY, COAP_CONFIG, true); Thread.sleep(1000);