|
|
|
@ -23,10 +23,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
import com.fasterxml.jackson.databind.node.ObjectNode; |
|
|
|
import com.google.gson.JsonObject; |
|
|
|
import com.google.protobuf.AbstractMessage; |
|
|
|
import com.google.protobuf.Extension; |
|
|
|
import com.google.protobuf.InvalidProtocolBufferException; |
|
|
|
import com.google.protobuf.MessageLite; |
|
|
|
import com.google.protobuf.Parser; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.junit.After; |
|
|
|
import org.junit.Assert; |
|
|
|
@ -110,7 +108,6 @@ import java.util.Random; |
|
|
|
import java.util.UUID; |
|
|
|
import java.util.concurrent.TimeUnit; |
|
|
|
|
|
|
|
import static com.google.protobuf.Extension.*; |
|
|
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
@ -250,6 +247,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
|
|
|
EdgeConfiguration configuration = edgeImitator.getConfiguration(); |
|
|
|
Assert.assertNotNull(configuration); |
|
|
|
|
|
|
|
testAutoGeneratedCodeByProtobuf(configuration); |
|
|
|
|
|
|
|
UserId userId = edgeImitator.getUserId(); |
|
|
|
Assert.assertNotNull(userId); |
|
|
|
|
|
|
|
@ -275,6 +274,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
|
|
|
new TypeReference<TimePageData<Asset>>() {}, new TextPageLink(100)).getData(); |
|
|
|
Assert.assertTrue(edgeAssets.contains(asset)); |
|
|
|
|
|
|
|
testAutoGeneratedCodeByProtobuf(assetUpdateMsg); |
|
|
|
|
|
|
|
Optional<RuleChainUpdateMsg> optionalMsg3 = edgeImitator.findMessageByType(RuleChainUpdateMsg.class); |
|
|
|
Assert.assertTrue(optionalMsg3.isPresent()); |
|
|
|
RuleChainUpdateMsg ruleChainUpdateMsg = optionalMsg3.get(); |
|
|
|
@ -286,6 +287,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
|
|
|
new TypeReference<TimePageData<RuleChain>>() {}, new TextPageLink(100)).getData(); |
|
|
|
Assert.assertTrue(edgeRuleChains.contains(ruleChain)); |
|
|
|
|
|
|
|
testAutoGeneratedCodeByProtobuf(ruleChainUpdateMsg); |
|
|
|
|
|
|
|
log.info("Received data checked"); |
|
|
|
} |
|
|
|
|
|
|
|
@ -515,6 +518,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
|
|
|
Assert.assertEquals(dashboardUpdateMsg.getIdLSB(), savedDashboard.getUuidId().getLeastSignificantBits()); |
|
|
|
Assert.assertEquals(dashboardUpdateMsg.getTitle(), savedDashboard.getName()); |
|
|
|
|
|
|
|
testAutoGeneratedCodeByProtobuf(dashboardUpdateMsg); |
|
|
|
|
|
|
|
edgeImitator.expectMessageAmount(1); |
|
|
|
savedDashboard.setTitle("Updated Edge Test Dashboard"); |
|
|
|
doPost("/api/dashboard", savedDashboard, Dashboard.class); |
|
|
|
@ -737,6 +742,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
|
|
|
Assert.assertEquals(customerUpdateMsg.getIdLSB(), savedCustomer.getUuidId().getLeastSignificantBits()); |
|
|
|
Assert.assertEquals(customerUpdateMsg.getTitle(), savedCustomer.getTitle()); |
|
|
|
|
|
|
|
testAutoGeneratedCodeByProtobuf(customerUpdateMsg); |
|
|
|
|
|
|
|
edgeImitator.expectMessageAmount(1); |
|
|
|
doDelete("/api/customer/edge/" + edge.getId().getId().toString(), Edge.class); |
|
|
|
edgeImitator.waitForMessages(); |
|
|
|
@ -782,6 +789,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
|
|
|
Assert.assertEquals(widgetsBundleUpdateMsg.getAlias(), savedWidgetsBundle.getAlias()); |
|
|
|
Assert.assertEquals(widgetsBundleUpdateMsg.getTitle(), savedWidgetsBundle.getTitle()); |
|
|
|
|
|
|
|
testAutoGeneratedCodeByProtobuf(widgetsBundleUpdateMsg); |
|
|
|
|
|
|
|
WidgetType widgetType = new WidgetType(); |
|
|
|
widgetType.setName("Test Widget Type"); |
|
|
|
widgetType.setBundleAlias(savedWidgetsBundle.getAlias()); |
|
|
|
@ -1185,6 +1194,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
|
|
|
RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = (RuleChainMetadataUpdateMsg) latestMessage; |
|
|
|
Assert.assertEquals(ruleChainMetadataUpdateMsg.getRuleChainIdMSB(), edgeRootRuleChainId.getId().getMostSignificantBits()); |
|
|
|
Assert.assertEquals(ruleChainMetadataUpdateMsg.getRuleChainIdLSB(), edgeRootRuleChainId.getId().getLeastSignificantBits()); |
|
|
|
|
|
|
|
testAutoGeneratedCodeByProtobuf(ruleChainMetadataRequestMsg); |
|
|
|
} |
|
|
|
|
|
|
|
private void sendUserCredentialsRequest() throws Exception { |
|
|
|
@ -1210,6 +1221,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
|
|
|
UserCredentialsUpdateMsg userCredentialsUpdateMsg = (UserCredentialsUpdateMsg) latestMessage; |
|
|
|
Assert.assertEquals(userCredentialsUpdateMsg.getUserIdMSB(), userId.getId().getMostSignificantBits()); |
|
|
|
Assert.assertEquals(userCredentialsUpdateMsg.getUserIdLSB(), userId.getId().getLeastSignificantBits()); |
|
|
|
|
|
|
|
testAutoGeneratedCodeByProtobuf(userCredentialsUpdateMsg); |
|
|
|
} |
|
|
|
|
|
|
|
private void sendDeviceCredentialsRequest() throws Exception { |
|
|
|
|