need to sleep a bit between setcounts so to avoid missing events

Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/96340af1
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/96340af1
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/96340af1

Branch: refs/heads/master
Commit: 96340af1d1525b2c5bf50adccc499c6917ff7563
Parents: 20a3db3
Author: randgalt <randg...@apache.org>
Authored: Thu Jul 20 12:17:35 2017 -0500
Committer: randgalt <randg...@apache.org>
Committed: Thu Jul 20 12:17:35 2017 -0500

----------------------------------------------------------------------
 .../curator/framework/recipes/shared/TestSharedCount.java      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/96340af1/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
----------------------------------------------------------------------
diff --git 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
index 6a0b7c2..822a01c 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
@@ -33,6 +33,7 @@ import org.apache.curator.retry.RetryNTimes;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.Timing;
+import org.apache.curator.test.compatibility.CuratorTestBase;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.WatchedEvent;
 import org.testng.Assert;
@@ -50,7 +51,7 @@ import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
-public class TestSharedCount extends BaseClassForTests
+public class TestSharedCount extends CuratorTestBase
 {
     @Test
     public void testMultiClients() throws Exception
@@ -191,8 +192,11 @@ public class TestSharedCount extends BaseClassForTests
             count.addListener(listener);
 
             Assert.assertTrue(count.trySetCount(1));
+            timing.sleepABit();
             Assert.assertTrue(count.trySetCount(2));
+            timing.sleepABit();
             Assert.assertTrue(count.trySetCount(10));
+            timing.sleepABit();
             Assert.assertEquals(count.getCount(), 10);
 
             Assert.assertTrue(new Timing().awaitLatch(setLatch));

Reply via email to