Repository: incubator-geode
Updated Branches:
  refs/heads/feature/GEODE-409 e39b30874 -> 8cb3cf7ad


GEODE-398: fix race in TXExpiryJUnitTest


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

Branch: refs/heads/feature/GEODE-409
Commit: 8cb3cf7ad0ac9a8cdd965240218705f5e2bc8ee4
Parents: e39b308
Author: Darrel Schneider <[email protected]>
Authored: Mon Oct 19 11:47:45 2015 -0700
Committer: Darrel Schneider <[email protected]>
Committed: Mon Oct 19 13:30:22 2015 -0700

----------------------------------------------------------------------
 .../com/gemstone/gemfire/TXExpiryJUnitTest.java     | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/8cb3cf7a/gemfire-core/src/test/java/com/gemstone/gemfire/TXExpiryJUnitTest.java
----------------------------------------------------------------------
diff --git 
a/gemfire-core/src/test/java/com/gemstone/gemfire/TXExpiryJUnitTest.java 
b/gemfire-core/src/test/java/com/gemstone/gemfire/TXExpiryJUnitTest.java
index ae94002..514d45b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/TXExpiryJUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/TXExpiryJUnitTest.java
@@ -185,7 +185,7 @@ public class TXExpiryJUnitTest {
       }
       assertTrue(!exprReg.containsKey("key0"));
       // key1 is the canary for the rest of the entries
-      assertTrue(!exprReg.containsKey("key1"));
+      waitForEntryToBeDestroyed(exprReg, "key1");
 
       // rollback and failed commit test, ensure expiration continues
       for(int j=0; j<2; j++) {
@@ -222,7 +222,7 @@ public class TXExpiryJUnitTest {
         }
         assertTrue(!exprReg.containsKey("key0"));
         // key1 is the canary for the rest of the entries
-        assertTrue(!exprReg.containsKey("key1"));
+        waitForEntryToBeDestroyed(exprReg, "key1");
       }
     } finally {
       mutator.removeCacheListener(cl);
@@ -230,6 +230,18 @@ public class TXExpiryJUnitTest {
     }
   }
   
+  private void waitForEntryToBeDestroyed(final Region r, final String key) {
+    WaitCriterion waitForExpire = new WaitCriterion() {
+      public boolean done() {
+        return r.getEntry(key) == null;
+      }
+      public String description() {
+        return "never saw entry destroy of " + key;
+      }
+    };
+    DistributedTestCase.waitForCriterion(waitForExpire, 3000, 10, true);
+  }
+  
   private void waitForEntryExpiration(LocalRegion lr, String key) {
     try {
       ExpirationDetector detector;

Reply via email to