geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [32/37] incubator-geode git commit: GEODE-1183: enhance the test case
Date Fri, 06 May 2016 21:41:03 GMT
GEODE-1183: enhance the test case


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/4ad4d63c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/4ad4d63c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/4ad4d63c

Branch: refs/heads/feature/GEODE-1276
Commit: 4ad4d63ca7b40c1450df1253ece0912f8529220f
Parents: aca7b28
Author: zhouxh <gzhou@pivotal.io>
Authored: Thu May 5 21:18:54 2016 -0700
Committer: zhouxh <gzhou@pivotal.io>
Committed: Thu May 5 21:19:50 2016 -0700

----------------------------------------------------------------------
 .../cache/wan/Simple2CacheServerDUnitTest.java  | 24 ++++----------------
 1 file changed, 5 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/4ad4d63c/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
index 684660b..4fdd88d 100755
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/Simple2CacheServerDUnitTest.java
@@ -17,6 +17,7 @@
 package com.gemstone.gemfire.internal.cache.wan;
 
 import java.util.Iterator;
+import java.util.concurrent.TimeUnit;
 
 import org.junit.experimental.categories.Category;
 
@@ -33,6 +34,7 @@ import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+import com.jayway.awaitility.Awaitility;
 
 public class Simple2CacheServerDUnitTest extends WANTestBase {
   private static final int NUM_KEYS = 10;
@@ -75,17 +77,11 @@ public class Simple2CacheServerDUnitTest extends WANTestBase {
     } else {
       vm2.invoke(() -> checkResultAndUnsetClientServerObserver());
     }
-    
-    boolean vm0_proxy = checkProxyIsPrimary(vm0);
-    boolean vm1_proxy = checkProxyIsPrimary(vm1);
-    assertTrue(vm1_proxy || vm0_proxy);
+    Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0)
|| checkProxyIsPrimary(vm1); });
     
     // close the current primary cache server, then re-test
     vm1.invoke(()-> CacheClientNotifierDUnitTest.closeACacheServer(serverPort2));
-    vm0_proxy = checkProxyIsPrimary(vm0);
-    vm1_proxy = checkProxyIsPrimary(vm1);
-    assertTrue(vm1_proxy || vm0_proxy);
-    
+    Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return checkProxyIsPrimary(vm0)
|| checkProxyIsPrimary(vm1); });
     disconnectAllFromDS();
   }
 
@@ -135,19 +131,9 @@ public class Simple2CacheServerDUnitTest extends WANTestBase {
       @Override
       public Object call() throws Exception {
         final CacheClientNotifier ccn = CacheClientNotifier.getInstance();
+        Awaitility.waitAtMost(20, TimeUnit.SECONDS).until(() -> { return (ccn.getClientProxies().size()
== 1); }); 
         
-        Wait.waitForCriterion(new WaitCriterion() {
-          public boolean done() {
-            return ccn.getClientProxies().size() == 1; 
-          }
-          public String description() {
-            return null;
-          }
-        }, 20000, 100, false);
-        assertEquals(1, ccn.getClientProxies().size());
-
         Iterator iter_prox = ccn.getClientProxies().iterator();
-        assertEquals(1, ccn.getClientProxies().size());
         CacheClientProxy proxy = (CacheClientProxy)iter_prox.next();
         return proxy.isPrimary();
       }


Mime
View raw message