Simple change, added wait barrier in a test
This commit is contained in:
@@ -174,21 +174,27 @@ public class ServerIntegrationTest {
|
||||
|
||||
public void published(String topic, byte[] message) {
|
||||
received = true;
|
||||
barrier.countDown();
|
||||
}
|
||||
});
|
||||
//never called because no notification is pending
|
||||
assertFalse(barrier.await(1, TimeUnit.SECONDS));
|
||||
|
||||
client.close();
|
||||
client.shutdown();
|
||||
server.stopServer();
|
||||
|
||||
server.startServer();
|
||||
|
||||
final CountDownLatch barrier2 = new CountDownLatch(1);
|
||||
|
||||
//Exercise that the client maintain the subscriptions
|
||||
client = new Client("localhost", Server.PORT, "CLID_123");
|
||||
client.register("/topic", new IPublishCallback() {
|
||||
|
||||
public void published(String topic, byte[] message) {
|
||||
received = true;
|
||||
barrier.countDown();
|
||||
barrier2.countDown();
|
||||
}
|
||||
});
|
||||
client.connect(false);
|
||||
@@ -196,7 +202,7 @@ public class ServerIntegrationTest {
|
||||
client.close();
|
||||
|
||||
//Verify
|
||||
barrier.await(1, TimeUnit.SECONDS);
|
||||
assertTrue(barrier2.await(1, TimeUnit.SECONDS));
|
||||
assertTrue(received);
|
||||
|
||||
//TearDown
|
||||
|
||||
Reference in New Issue
Block a user