geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [20/50] [abbrv] incubator-geode git commit: GEODE-1311 Now in test every VM waits locator to become coordinator.
Date Thu, 28 Apr 2016 23:09:59 GMT
GEODE-1311 Now in test every VM waits locator to become coordinator.


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

Branch: refs/heads/feature/GEODE-1255
Commit: 32c9df6c27fef5a0056e39c666af836a7c750361
Parents: 39b9edc
Author: Hitesh Khamesra <hkhamesra@pivotal.io>
Authored: Wed Apr 27 09:31:12 2016 -0700
Committer: Hitesh Khamesra <hkhamesra@pivotal.io>
Committed: Wed Apr 27 09:45:11 2016 -0700

----------------------------------------------------------------------
 .../gemfire/distributed/LocatorDUnitTest.java   | 31 ++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/32c9df6c/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
index a62a317..3a06c1c 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/distributed/LocatorDUnitTest.java
@@ -1535,6 +1535,10 @@ public class LocatorDUnitTest extends DistributedTestCase {
           }
         };
         Wait.waitForCriterion(waitCriterion, 30 * 1000, 1000, true);
+        waitUntilLocatorBecomesCoordinator(vm1);
+        waitUntilLocatorBecomesCoordinator(vm2);
+        waitUntilLocatorBecomesCoordinator(vm3);
+        waitUntilLocatorBecomesCoordinator(vm4);
 
         int netviewId = vm1.invoke("Checking ViewCreator", () -> GMSJoinLeaveTestHelper.getViewId());
         assertEquals(netviewId, (int) vm2.invoke("checking ViewID", () -> GMSJoinLeaveTestHelper.getViewId()));
@@ -1559,6 +1563,33 @@ public class LocatorDUnitTest extends DistributedTestCase {
     } finally {
     }
   }
+  
+  private void waitUntilLocatorBecomesCoordinator(VM vm) {
+    SerializableRunnable sr = new SerializableRunnable("waitUntilLocatorBecomesCoordinator")
{
+
+      @Override
+      public void run() throws Exception {
+        final WaitCriterion waitCriterion = new WaitCriterion() {
+          public boolean done() {
+            try {
+              InternalDistributedMember c = GMSJoinLeaveTestHelper.getCurrentCoordinator();
+              return c.getVmKind() == DistributionManager.LOCATOR_DM_TYPE;
+            } catch (Exception e) {
+              e.printStackTrace();
+              com.gemstone.gemfire.test.dunit.Assert.fail("unexpected exception", e);
+            }
+            return false; // NOTREACHED
+          }
+
+          public String description() {
+            return null;
+          }
+        };
+        Wait.waitForCriterion(waitCriterion, 15 * 1000, 200, true);
+      }
+    };
+    vm.invoke(sr);
+  }
 
   private void startLocatorSync(VM vm, Object[] args) {
     vm.invoke(new SerializableRunnable("Starting locator process on " + args[0], args) {


Mime
View raw message