Search in sources :

Example 6 with RuleChainMetadataUpdateMsg

use of org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg in project thingsboard by thingsboard.

the class RuleChainMsgConstructorTest method testConstructRuleChainMetadataUpdatedMsg_V_3_3_3.

@Test
public void testConstructRuleChainMetadataUpdatedMsg_V_3_3_3() throws JsonProcessingException {
    RuleChainId ruleChainId = new RuleChainId(UUID.randomUUID());
    RuleChainMsgConstructor constructor = new RuleChainMsgConstructor();
    RuleChainMetaData ruleChainMetaData = createRuleChainMetaData(ruleChainId, 3, createRuleNodes(ruleChainId), createConnections());
    RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = constructor.constructRuleChainMetadataUpdatedMsg(UpdateMsgType.ENTITY_CREATED_RPC_MESSAGE, ruleChainMetaData, EdgeVersion.V_3_3_3);
    Assert.assertEquals("First rule node index incorrect!", 3, ruleChainMetadataUpdateMsg.getFirstNodeIndex());
    Assert.assertEquals("Nodes count incorrect!", 12, ruleChainMetadataUpdateMsg.getNodesCount());
    Assert.assertEquals("Connections count incorrect!", 13, ruleChainMetadataUpdateMsg.getConnectionsCount());
    Assert.assertEquals("Rule chain connections count incorrect!", 0, ruleChainMetadataUpdateMsg.getRuleChainConnectionsCount());
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(3, 6, "Success"), ruleChainMetadataUpdateMsg.getConnections(0));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(3, 10, "Success"), ruleChainMetadataUpdateMsg.getConnections(1));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(3, 0, "Success"), ruleChainMetadataUpdateMsg.getConnections(2));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(4, 11, "Success"), ruleChainMetadataUpdateMsg.getConnections(3));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(5, 11, "Success"), ruleChainMetadataUpdateMsg.getConnections(4));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(6, 11, "Attributes Updated"), ruleChainMetadataUpdateMsg.getConnections(5));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(6, 7, "RPC Request from Device"), ruleChainMetadataUpdateMsg.getConnections(6));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(6, 4, "Post telemetry"), ruleChainMetadataUpdateMsg.getConnections(7));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(6, 5, "Post attributes"), ruleChainMetadataUpdateMsg.getConnections(8));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(6, 8, "Other"), ruleChainMetadataUpdateMsg.getConnections(9));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(6, 9, "RPC Request to Device"), ruleChainMetadataUpdateMsg.getConnections(10));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(7, 11, "Success"), ruleChainMetadataUpdateMsg.getConnections(11));
    compareNodeConnectionInfoAndProto(createNodeConnectionInfo(10, 9, "RPC"), ruleChainMetadataUpdateMsg.getConnections(12));
}
Also used : RuleChainMetadataUpdateMsg(org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg) RuleChainMetaData(org.thingsboard.server.common.data.rule.RuleChainMetaData) RuleChainId(org.thingsboard.server.common.data.id.RuleChainId) Test(org.junit.Test)

Aggregations

RuleChainId (org.thingsboard.server.common.data.id.RuleChainId)6 RuleChainMetadataUpdateMsg (org.thingsboard.server.gen.edge.v1.RuleChainMetadataUpdateMsg)6 Test (org.junit.Test)4 RuleChainMetaData (org.thingsboard.server.common.data.rule.RuleChainMetaData)4 AbstractMessage (com.google.protobuf.AbstractMessage)2 RuleChainConnectionInfoProto (org.thingsboard.server.gen.edge.v1.RuleChainConnectionInfoProto)2 RuleChainMetadataRequestMsg (org.thingsboard.server.gen.edge.v1.RuleChainMetadataRequestMsg)2 UplinkMsg (org.thingsboard.server.gen.edge.v1.UplinkMsg)2 UUID (java.util.UUID)1 RuleChain (org.thingsboard.server.common.data.rule.RuleChain)1 AbstractControllerTest (org.thingsboard.server.controller.AbstractControllerTest)1 DownlinkMsg (org.thingsboard.server.gen.edge.v1.DownlinkMsg)1