Commit 31f0689f63e55abe2af8db7a26af7bea76a1b832

Authored by Igor Kulikov
1 parent 0894b23b

Websocket Api tests improvements

... ... @@ -445,6 +445,7 @@ public class BaseWebsocketApiTest extends AbstractWebsocketTest {
445 445
446 446 wsClient.send(mapper.writeValueAsString(wrapper));
447 447 String msg = wsClient.waitForReply();
  448 + Assert.assertNotNull(msg);
448 449 EntityDataUpdate update = mapper.readValue(msg, EntityDataUpdate.class);
449 450 Assert.assertEquals(1, update.getCmdId());
450 451 PageData<EntityData> pageData = update.getData();
... ... @@ -457,13 +458,14 @@ public class BaseWebsocketApiTest extends AbstractWebsocketTest {
457 458
458 459
459 460 wsClient.registerWaitForUpdate();
460   - Thread.sleep(100);
  461 + Thread.sleep(500);
461 462
462 463 AttributeKvEntry dataPoint1 = new BaseAttributeKvEntry(now - TimeUnit.MINUTES.toMillis(1), new LongDataEntry("serverAttributeKey", 42L));
463 464 List<AttributeKvEntry> tsData = Arrays.asList(dataPoint1);
464 465 sendAttributes(device, TbAttributeSubscriptionScope.SERVER_SCOPE, tsData);
465 466
466 467 msg = wsClient.waitForUpdate();
  468 + Assert.assertNotNull(msg);
467 469 update = mapper.readValue(msg, EntityDataUpdate.class);
468 470
469 471 Assert.assertEquals(1, update.getCmdId());
... ... @@ -479,9 +481,10 @@ public class BaseWebsocketApiTest extends AbstractWebsocketTest {
479 481 AttributeKvEntry dataPoint2 = new BaseAttributeKvEntry(now, new LongDataEntry("serverAttributeKey", 52L));
480 482
481 483 wsClient.registerWaitForUpdate();
482   - Thread.sleep(100);
  484 + Thread.sleep(500);
483 485 sendAttributes(device, TbAttributeSubscriptionScope.SERVER_SCOPE, Arrays.asList(dataPoint2));
484 486 msg = wsClient.waitForUpdate();
  487 + Assert.assertNotNull(msg);
485 488
486 489 update = mapper.readValue(msg, EntityDataUpdate.class);
487 490 Assert.assertEquals(1, update.getCmdId());
... ... @@ -495,14 +498,14 @@ public class BaseWebsocketApiTest extends AbstractWebsocketTest {
495 498
496 499 //Sending update from the past, while latest value has new timestamp;
497 500 wsClient.registerWaitForUpdate();
498   - Thread.sleep(100);
  501 + Thread.sleep(500);
499 502 sendAttributes(device, TbAttributeSubscriptionScope.SERVER_SCOPE, Arrays.asList(dataPoint1));
500 503 msg = wsClient.waitForUpdate(TimeUnit.SECONDS.toMillis(1));
501 504 Assert.assertNull(msg);
502 505
503 506 //Sending duplicate update again
504 507 wsClient.registerWaitForUpdate();
505   - Thread.sleep(100);
  508 + Thread.sleep(500);
506 509 sendAttributes(device, TbAttributeSubscriptionScope.SERVER_SCOPE, Arrays.asList(dataPoint2));
507 510 msg = wsClient.waitForUpdate(TimeUnit.SECONDS.toMillis(1));
508 511 Assert.assertNull(msg);
... ...