|
|
|
@ -17,6 +17,7 @@ package org.thingsboard.server.controller; |
|
|
|
|
|
|
|
import com.datastax.oss.driver.api.core.uuid.Uuids; |
|
|
|
import com.fasterxml.jackson.core.type.TypeReference; |
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
|
|
import com.google.common.util.concurrent.Futures; |
|
|
|
import com.google.common.util.concurrent.ListenableFuture; |
|
|
|
import com.google.common.util.concurrent.ListeningExecutorService; |
|
|
|
@ -34,8 +35,10 @@ import org.springframework.context.annotation.Bean; |
|
|
|
import org.springframework.context.annotation.Primary; |
|
|
|
import org.springframework.test.context.ContextConfiguration; |
|
|
|
import org.springframework.test.context.TestPropertySource; |
|
|
|
import org.thingsboard.common.util.JacksonUtil; |
|
|
|
import org.thingsboard.common.util.ThingsBoardExecutors; |
|
|
|
import org.thingsboard.server.common.data.Customer; |
|
|
|
import org.thingsboard.server.common.data.DataConstants; |
|
|
|
import org.thingsboard.server.common.data.Device; |
|
|
|
import org.thingsboard.server.common.data.EntitySubtype; |
|
|
|
import org.thingsboard.server.common.data.StringUtils; |
|
|
|
@ -852,6 +855,11 @@ public class EdgeControllerTest extends AbstractControllerTest { |
|
|
|
|
|
|
|
Edge edge = doPost("/api/edge", constructEdge("Test Sync Edge", "test"), Edge.class); |
|
|
|
|
|
|
|
// simulate edge activation
|
|
|
|
ObjectNode attributes = JacksonUtil.newObjectNode(); |
|
|
|
attributes.put("active", true); |
|
|
|
doPost("/api/plugins/telemetry/EDGE/" + edge.getId() + "/attributes/" + DataConstants.SERVER_SCOPE, attributes); |
|
|
|
|
|
|
|
doPost("/api/edge/" + edge.getId().getId().toString() |
|
|
|
+ "/device/" + savedDevice.getId().getId().toString(), Device.class); |
|
|
|
doPost("/api/edge/" + edge.getId().getId().toString() |
|
|
|
@ -860,13 +868,12 @@ public class EdgeControllerTest extends AbstractControllerTest { |
|
|
|
EdgeImitator edgeImitator = new EdgeImitator(EDGE_HOST, EDGE_PORT, edge.getRoutingKey(), edge.getSecret()); |
|
|
|
edgeImitator.ignoreType(UserCredentialsUpdateMsg.class); |
|
|
|
|
|
|
|
edgeImitator.expectMessageAmount(25); |
|
|
|
edgeImitator.expectMessageAmount(24); |
|
|
|
edgeImitator.connect(); |
|
|
|
assertThat(edgeImitator.waitForMessages()).as("await for messages on first connect").isTrue(); |
|
|
|
|
|
|
|
verifyFetchersMsgs(edgeImitator); |
|
|
|
// verify queue msgs
|
|
|
|
Assert.assertTrue(popRuleChainMsg(edgeImitator.getDownlinkMsgs(), UpdateMsgType.ENTITY_UPDATED_RPC_MESSAGE, "Edge Root Rule Chain")); |
|
|
|
Assert.assertTrue(popDeviceProfileMsg(edgeImitator.getDownlinkMsgs(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "default")); |
|
|
|
Assert.assertTrue(popDeviceMsg(edgeImitator.getDownlinkMsgs(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "Test Sync Edge Device 1")); |
|
|
|
Assert.assertTrue(popAssetProfileMsg(edgeImitator.getDownlinkMsgs(), UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, "test")); |
|
|
|
|