You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2018/12/07 04:24:58 UTC
[3/3] curator git commit: CURATOR-490 block until connected to avoid
CONNECTION_RECONNECTED events
CURATOR-490 block until connected to avoid CONNECTION_RECONNECTED events
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9f12a189
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9f12a189
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9f12a189
Branch: refs/heads/CURATOR-490
Commit: 9f12a189ccc00b59cf8908524c729b1fba237ded
Parents: eaebdd9
Author: randgalt <ra...@apache.org>
Authored: Thu Dec 6 23:24:51 2018 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu Dec 6 23:24:51 2018 -0500
----------------------------------------------------------------------
.../framework/recipes/cache/TestPathChildrenCache.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/9f12a189/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
index d2f8cc0..ec1d4a1 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
@@ -56,6 +56,7 @@ public class TestPathChildrenCache extends BaseClassForTests
try
{
client.start();
+ client.blockUntilConnected(); // avoid PathChildrenCache connected events
final BlockingQueue<PathChildrenCacheEvent.Type> events = Queues.newLinkedBlockingQueue();
PathChildrenCacheListener listener = new PathChildrenCacheListener()
@@ -68,7 +69,6 @@ public class TestPathChildrenCache extends BaseClassForTests
};
cache.getListenable().addListener(listener);
cache.start(PathChildrenCache.StartMode.POST_INITIALIZED_EVENT);
- Assert.assertEquals(events.poll(timing.forWaiting().milliseconds(), TimeUnit.MILLISECONDS), PathChildrenCacheEvent.Type.CONNECTION_RECONNECTED);
Assert.assertEquals(events.poll(timing.forWaiting().milliseconds(), TimeUnit.MILLISECONDS), PathChildrenCacheEvent.Type.INITIALIZED);
client.create().forPath("/a/b/test/one");
@@ -190,11 +190,11 @@ public class TestPathChildrenCache extends BaseClassForTests
cache.getListenable().addListener(listener);
cache.start();
Assert.assertTrue(timing.awaitLatch(ensurePathLatch));
-
+
final CountDownLatch connectedLatch = new CountDownLatch(1);
client.getConnectionStateListenable().addListener(new ConnectionStateListener()
{
-
+
@Override
public void stateChanged(CuratorFramework client, ConnectionState newState)
{
@@ -206,7 +206,7 @@ public class TestPathChildrenCache extends BaseClassForTests
});
server = new TestingServer(serverPort, true);
-
+
Assert.assertTrue(timing.awaitLatch(connectedLatch));
client.create().creatingParentContainersIfNeeded().forPath("/baz", new byte[]{1, 2, 3});