Showing
1 changed file
with
8 additions
and
9 deletions
... | ... | @@ -455,22 +455,18 @@ public class BaseWebsocketApiTest extends AbstractWebsocketTest { |
455 | 455 | Assert.assertEquals(0, pageData.getData().get(0).getLatest().get(EntityKeyType.SERVER_ATTRIBUTE).get("serverAttributeKey").getTs()); |
456 | 456 | Assert.assertEquals("", pageData.getData().get(0).getLatest().get(EntityKeyType.SERVER_ATTRIBUTE).get("serverAttributeKey").getValue()); |
457 | 457 | |
458 | - AttributeKvEntry dataPoint1 = new BaseAttributeKvEntry(now - TimeUnit.MINUTES.toMillis(1), new LongDataEntry("serverAttributeKey", 42L)); | |
459 | - List<AttributeKvEntry> tsData = Arrays.asList(dataPoint1); | |
460 | - sendAttributes(device, TbAttributeSubscriptionScope.SERVER_SCOPE, tsData); | |
461 | 458 | |
459 | + wsClient.registerWaitForUpdate(); | |
462 | 460 | Thread.sleep(100); |
463 | 461 | |
464 | - cmd = new EntityDataCmd(1, edq, null, latestCmd, null); | |
465 | - wrapper = new TelemetryPluginCmdsWrapper(); | |
466 | - wrapper.setEntityDataCmds(Collections.singletonList(cmd)); | |
462 | + AttributeKvEntry dataPoint1 = new BaseAttributeKvEntry(now - TimeUnit.MINUTES.toMillis(1), new LongDataEntry("serverAttributeKey", 42L)); | |
463 | + List<AttributeKvEntry> tsData = Arrays.asList(dataPoint1); | |
464 | + sendAttributes(device, TbAttributeSubscriptionScope.SERVER_SCOPE, tsData); | |
467 | 465 | |
468 | - wsClient.send(mapper.writeValueAsString(wrapper)); | |
469 | - msg = wsClient.waitForReply(); | |
466 | + msg = wsClient.waitForUpdate(); | |
470 | 467 | update = mapper.readValue(msg, EntityDataUpdate.class); |
471 | 468 | |
472 | 469 | Assert.assertEquals(1, update.getCmdId()); |
473 | - | |
474 | 470 | List<EntityData> listData = update.getUpdate(); |
475 | 471 | Assert.assertNotNull(listData); |
476 | 472 | Assert.assertEquals(1, listData.size()); |
... | ... | @@ -483,6 +479,7 @@ public class BaseWebsocketApiTest extends AbstractWebsocketTest { |
483 | 479 | AttributeKvEntry dataPoint2 = new BaseAttributeKvEntry(now, new LongDataEntry("serverAttributeKey", 52L)); |
484 | 480 | |
485 | 481 | wsClient.registerWaitForUpdate(); |
482 | + Thread.sleep(100); | |
486 | 483 | sendAttributes(device, TbAttributeSubscriptionScope.SERVER_SCOPE, Arrays.asList(dataPoint2)); |
487 | 484 | msg = wsClient.waitForUpdate(); |
488 | 485 | |
... | ... | @@ -498,12 +495,14 @@ public class BaseWebsocketApiTest extends AbstractWebsocketTest { |
498 | 495 | |
499 | 496 | //Sending update from the past, while latest value has new timestamp; |
500 | 497 | wsClient.registerWaitForUpdate(); |
498 | + Thread.sleep(100); | |
501 | 499 | sendAttributes(device, TbAttributeSubscriptionScope.SERVER_SCOPE, Arrays.asList(dataPoint1)); |
502 | 500 | msg = wsClient.waitForUpdate(TimeUnit.SECONDS.toMillis(1)); |
503 | 501 | Assert.assertNull(msg); |
504 | 502 | |
505 | 503 | //Sending duplicate update again |
506 | 504 | wsClient.registerWaitForUpdate(); |
505 | + Thread.sleep(100); | |
507 | 506 | sendAttributes(device, TbAttributeSubscriptionScope.SERVER_SCOPE, Arrays.asList(dataPoint2)); |
508 | 507 | msg = wsClient.waitForUpdate(TimeUnit.SECONDS.toMillis(1)); |
509 | 508 | Assert.assertNull(msg); | ... | ... |