You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by dr...@apache.org on 2015/08/19 01:18:40 UTC
[24/31] curator git commit: make test more rational by using a latch
make test more rational by using a latch
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/4ad09e7d
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4ad09e7d
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4ad09e7d
Branch: refs/heads/CURATOR-3.0
Commit: 4ad09e7d1d71acebba97bb5594205d96f76eba3c
Parents: 115611e
Author: randgalt <ra...@apache.org>
Authored: Tue May 19 19:38:24 2015 -0700
Committer: randgalt <ra...@apache.org>
Committed: Tue May 19 19:38:24 2015 -0700
----------------------------------------------------------------------
.../curator/framework/imps/TestWatcherRemovalManager.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/4ad09e7d/curator-framework/src/test/java/org/apache/curator/framework/imps/TestWatcherRemovalManager.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestWatcherRemovalManager.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestWatcherRemovalManager.java
index 9508f43..bf690fd 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestWatcherRemovalManager.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestWatcherRemovalManager.java
@@ -228,12 +228,16 @@ public class TestWatcherRemovalManager extends BaseClassForTests
{
WatcherRemoveCuratorFramework removerClient = client.newWatcherRemoveCuratorFramework();
+ final CountDownLatch latch = new CountDownLatch(1);
Watcher watcher = new Watcher()
{
@Override
public void process(WatchedEvent event)
{
- // NOP
+ if ( event.getType() == Event.EventType.DataWatchRemoved )
+ {
+ latch.countDown();
+ }
}
};
removerClient.checkExists().usingWatcher(watcher).forPath("/hey");
@@ -243,7 +247,7 @@ public class TestWatcherRemovalManager extends BaseClassForTests
removerClient.removeWatchers();
- new Timing().sleepABit();
+ Assert.assertTrue(new Timing().awaitLatch(latch));
existWatches = WatchersDebug.getExistWatches(client.getZookeeperClient().getZooKeeper());
Assert.assertEquals(existWatches.size(), 0);