Commit c0a5ae5e7b2b657ba49e11f7d5449429dbb214e2
Merge branch 'feature/edge' of github.com:volodymyr-babak/thingsboard into feature/edge
Showing
1 changed file
with
16 additions
and
3 deletions
... | ... | @@ -23,10 +23,8 @@ import com.fasterxml.jackson.databind.ObjectMapper; |
23 | 23 | import com.fasterxml.jackson.databind.node.ObjectNode; |
24 | 24 | import com.google.gson.JsonObject; |
25 | 25 | import com.google.protobuf.AbstractMessage; |
26 | -import com.google.protobuf.Extension; | |
27 | 26 | import com.google.protobuf.InvalidProtocolBufferException; |
28 | 27 | import com.google.protobuf.MessageLite; |
29 | -import com.google.protobuf.Parser; | |
30 | 28 | import lombok.extern.slf4j.Slf4j; |
31 | 29 | import org.junit.After; |
32 | 30 | import org.junit.Assert; |
... | ... | @@ -110,7 +108,6 @@ import java.util.Random; |
110 | 108 | import java.util.UUID; |
111 | 109 | import java.util.concurrent.TimeUnit; |
112 | 110 | |
113 | -import static com.google.protobuf.Extension.*; | |
114 | 111 | import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; |
115 | 112 | |
116 | 113 | @Slf4j |
... | ... | @@ -250,6 +247,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
250 | 247 | EdgeConfiguration configuration = edgeImitator.getConfiguration(); |
251 | 248 | Assert.assertNotNull(configuration); |
252 | 249 | |
250 | + testAutoGeneratedCodeByProtobuf(configuration); | |
251 | + | |
253 | 252 | UserId userId = edgeImitator.getUserId(); |
254 | 253 | Assert.assertNotNull(userId); |
255 | 254 | |
... | ... | @@ -275,6 +274,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
275 | 274 | new TypeReference<TimePageData<Asset>>() {}, new TextPageLink(100)).getData(); |
276 | 275 | Assert.assertTrue(edgeAssets.contains(asset)); |
277 | 276 | |
277 | + testAutoGeneratedCodeByProtobuf(assetUpdateMsg); | |
278 | + | |
278 | 279 | Optional<RuleChainUpdateMsg> optionalMsg3 = edgeImitator.findMessageByType(RuleChainUpdateMsg.class); |
279 | 280 | Assert.assertTrue(optionalMsg3.isPresent()); |
280 | 281 | RuleChainUpdateMsg ruleChainUpdateMsg = optionalMsg3.get(); |
... | ... | @@ -286,6 +287,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
286 | 287 | new TypeReference<TimePageData<RuleChain>>() {}, new TextPageLink(100)).getData(); |
287 | 288 | Assert.assertTrue(edgeRuleChains.contains(ruleChain)); |
288 | 289 | |
290 | + testAutoGeneratedCodeByProtobuf(ruleChainUpdateMsg); | |
291 | + | |
289 | 292 | log.info("Received data checked"); |
290 | 293 | } |
291 | 294 | |
... | ... | @@ -515,6 +518,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
515 | 518 | Assert.assertEquals(dashboardUpdateMsg.getIdLSB(), savedDashboard.getUuidId().getLeastSignificantBits()); |
516 | 519 | Assert.assertEquals(dashboardUpdateMsg.getTitle(), savedDashboard.getName()); |
517 | 520 | |
521 | + testAutoGeneratedCodeByProtobuf(dashboardUpdateMsg); | |
522 | + | |
518 | 523 | edgeImitator.expectMessageAmount(1); |
519 | 524 | savedDashboard.setTitle("Updated Edge Test Dashboard"); |
520 | 525 | doPost("/api/dashboard", savedDashboard, Dashboard.class); |
... | ... | @@ -737,6 +742,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
737 | 742 | Assert.assertEquals(customerUpdateMsg.getIdLSB(), savedCustomer.getUuidId().getLeastSignificantBits()); |
738 | 743 | Assert.assertEquals(customerUpdateMsg.getTitle(), savedCustomer.getTitle()); |
739 | 744 | |
745 | + testAutoGeneratedCodeByProtobuf(customerUpdateMsg); | |
746 | + | |
740 | 747 | edgeImitator.expectMessageAmount(1); |
741 | 748 | doDelete("/api/customer/edge/" + edge.getId().getId().toString(), Edge.class); |
742 | 749 | edgeImitator.waitForMessages(); |
... | ... | @@ -782,6 +789,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
782 | 789 | Assert.assertEquals(widgetsBundleUpdateMsg.getAlias(), savedWidgetsBundle.getAlias()); |
783 | 790 | Assert.assertEquals(widgetsBundleUpdateMsg.getTitle(), savedWidgetsBundle.getTitle()); |
784 | 791 | |
792 | + testAutoGeneratedCodeByProtobuf(widgetsBundleUpdateMsg); | |
793 | + | |
785 | 794 | WidgetType widgetType = new WidgetType(); |
786 | 795 | widgetType.setName("Test Widget Type"); |
787 | 796 | widgetType.setBundleAlias(savedWidgetsBundle.getAlias()); |
... | ... | @@ -1185,6 +1194,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
1185 | 1194 | RuleChainMetadataUpdateMsg ruleChainMetadataUpdateMsg = (RuleChainMetadataUpdateMsg) latestMessage; |
1186 | 1195 | Assert.assertEquals(ruleChainMetadataUpdateMsg.getRuleChainIdMSB(), edgeRootRuleChainId.getId().getMostSignificantBits()); |
1187 | 1196 | Assert.assertEquals(ruleChainMetadataUpdateMsg.getRuleChainIdLSB(), edgeRootRuleChainId.getId().getLeastSignificantBits()); |
1197 | + | |
1198 | + testAutoGeneratedCodeByProtobuf(ruleChainMetadataRequestMsg); | |
1188 | 1199 | } |
1189 | 1200 | |
1190 | 1201 | private void sendUserCredentialsRequest() throws Exception { |
... | ... | @@ -1210,6 +1221,8 @@ abstract public class BaseEdgeTest extends AbstractControllerTest { |
1210 | 1221 | UserCredentialsUpdateMsg userCredentialsUpdateMsg = (UserCredentialsUpdateMsg) latestMessage; |
1211 | 1222 | Assert.assertEquals(userCredentialsUpdateMsg.getUserIdMSB(), userId.getId().getMostSignificantBits()); |
1212 | 1223 | Assert.assertEquals(userCredentialsUpdateMsg.getUserIdLSB(), userId.getId().getLeastSignificantBits()); |
1224 | + | |
1225 | + testAutoGeneratedCodeByProtobuf(userCredentialsUpdateMsg); | |
1213 | 1226 | } |
1214 | 1227 | |
1215 | 1228 | private void sendDeviceCredentialsRequest() throws Exception { | ... | ... |