geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [39/50] [abbrv] incubator-geode git commit: GEODE-510 added cache-server port to 0 and added wait for client queue to pause
Date Tue, 03 May 2016 21:52:28 GMT
GEODE-510 added cache-server port to 0 and added wait for client queue to pause


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

Branch: refs/heads/feature/GEODE-1255
Commit: 15b1e70e7de5c8cb27508fc0e7d9973722013170
Parents: 29fde0d
Author: Hitesh Khamesra <hiteshk25@yahoo.com>
Authored: Fri Apr 29 15:57:50 2016 -0700
Committer: Hitesh Khamesra <hiteshk25@yahoo.com>
Committed: Fri Apr 29 15:57:50 2016 -0700

----------------------------------------------------------------------
 .../internal/cache/ha/Bug48571DUnitTest.java    | 34 ++++++++++++++++++--
 1 file changed, 31 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/15b1e70e/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/Bug48571DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/Bug48571DUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/Bug48571DUnitTest.java
index a81d9c1..02f7014 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/Bug48571DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ha/Bug48571DUnitTest.java
@@ -16,6 +16,8 @@
  */
 package com.gemstone.gemfire.internal.cache.ha;
 
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.Properties;
 
 import org.junit.experimental.categories.Category;
@@ -90,7 +92,32 @@ public class Bug48571DUnitTest extends DistributedTestCase {
     }
   }
 
-  @Category(FlakyTest.class) // GEODE-510: random ports, async actions, AsyncInvocation orphan
+  private static void verifyProxyHasBeenPaused() {
+    WaitCriterion criterion = new WaitCriterion() {
+      @Override
+      public boolean done() {
+        CacheClientNotifier ccn = CacheClientNotifier.getInstance();
+        Collection<CacheClientProxy> ccProxies = ccn.getClientProxies();
+
+        Iterator<CacheClientProxy> itr = ccProxies.iterator();
+
+        while (itr.hasNext()) {
+          CacheClientProxy ccp = itr.next();
+          System.out.println("proxy status " + ccp.getState());
+          if (ccp.isPaused())
+            return true;
+        }
+        return false;
+      }
+      @Override
+      public String description() {
+        // TODO Auto-generated method stub
+        return "Proxy has not paused yet";
+      }
+    };
+    Wait.waitForCriterion(criterion, 15 * 1000, 200, true);
+  }
+  
   public void testStatsMatchWithSize() throws Exception {
     IgnoredException.addIgnoredException("Unexpected IOException||Connection reset");
     // start a server
@@ -101,6 +128,8 @@ public class Bug48571DUnitTest extends DistributedTestCase {
     server.invoke(() -> Bug48571DUnitTest.doPuts());
     // close durable client
     client.invoke(() -> Bug48571DUnitTest.closeClientCache());
+    
+    server.invoke("verifyProxyHasBeenPaused", () -> verifyProxyHasBeenPaused() );
     // resume puts on server, add another 100.
     server.invokeAsync(() -> Bug48571DUnitTest.resumePuts()); // TODO: join or await result
     // start durable client
@@ -131,9 +160,8 @@ public class Bug48571DUnitTest extends DistributedTestCase {
     rf.setConcurrencyChecksEnabled(false);
     rf.create(region);
 
-    int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     CacheServer server1 = cache.addCacheServer();
-    server1.setPort(port);
+    server1.setPort(0);
     server1.start();
     return server1.getPort();
   }


Mime
View raw message