geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From u..@apache.org
Subject [15/33] incubator-geode git commit: GEODE-1540: fix testAsyncStats
Date Wed, 15 Jun 2016 16:17:48 GMT
GEODE-1540: fix testAsyncStats

Test now uses awaitility and if a stat never does get to the expected
value will now fail with an assertion that shows the actual and expected
value of the stat.


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

Branch: refs/heads/feature/GEODE-420
Commit: de647cd7f9bce152481b397ea242d9ff8626c4b4
Parents: 6f70cd7
Author: Darrel Schneider <dschneider@pivotal.io>
Authored: Mon Jun 13 17:48:56 2016 -0700
Committer: Darrel Schneider <dschneider@pivotal.io>
Committed: Mon Jun 13 17:50:10 2016 -0700

----------------------------------------------------------------------
 .../gemfire/internal/cache/OplogJUnitTest.java  | 51 +++++---------------
 1 file changed, 13 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/de647cd7/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
index b283ec3..d8ef40c 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
@@ -2641,51 +2641,26 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
     region = DiskRegionHelperFactory.getAsyncOverFlowAndPersistRegion(cache,
         diskProps);
     final DiskStoreStats dss = ((LocalRegion)region).getDiskRegion().getDiskStore().getStats();
-    WaitCriterion evFull = new WaitCriterion() {
-      public boolean done() {
-        return dss.getQueueSize() == 100;
-      }
-      public String description() {
-        return null;
-      }
-    };
-    WaitCriterion ev = new WaitCriterion() {
-      public boolean done() {
-        return dss.getQueueSize() == 0;
-      }
-      public String description() {
-        return null;
-      }
-    };
-    WaitCriterion ev2 = new WaitCriterion() {
-      public boolean done() {
-        return dss.getFlushes() == 100;
-      }
-      public String description() {
-        return null;
-      }
-    };
-    WaitCriterion ev3 = new WaitCriterion() {
-      public boolean done() {
-        return dss.getFlushes() == 200;
-      }
-      public String description() {
-        return null;
-      }
-    };
 
     assertEquals(0, dss.getQueueSize());
     put100Int();
-    Wait.waitForCriterion(evFull, 2 * 1000, 200, true);
+    Awaitility.await().pollInterval(10, TimeUnit.MILLISECONDS).pollDelay(10, TimeUnit.MILLISECONDS).timeout(10,
TimeUnit.SECONDS)
+    .until(() -> assertEquals(100, dss.getQueueSize()));
+
     assertEquals(0, dss.getFlushes());
     region.writeToDisk();
-    Wait.waitForCriterion(ev, 2 * 1000, 200, true);
-    Wait.waitForCriterion(ev2, 1000, 200, true);
+    Awaitility.await().pollInterval(10, TimeUnit.MILLISECONDS).pollDelay(10, TimeUnit.MILLISECONDS).timeout(10,
TimeUnit.SECONDS)
+    .until(() -> assertEquals(0, dss.getQueueSize()));
+    Awaitility.await().pollInterval(10, TimeUnit.MILLISECONDS).pollDelay(10, TimeUnit.MILLISECONDS).timeout(10,
TimeUnit.SECONDS)
+    .until(() -> assertEquals(100, dss.getFlushes()));
     put100Int();
-    Wait.waitForCriterion(evFull, 2 * 1000, 200, true);
+    Awaitility.await().pollInterval(10, TimeUnit.MILLISECONDS).pollDelay(10, TimeUnit.MILLISECONDS).timeout(10,
TimeUnit.SECONDS)
+    .until(() -> assertEquals(100, dss.getQueueSize()));
     region.writeToDisk();
-    Wait.waitForCriterion(ev, 2 * 1000, 200, true);
-    Wait.waitForCriterion(ev3, 1000, 200, true);
+    Awaitility.await().pollInterval(10, TimeUnit.MILLISECONDS).pollDelay(10, TimeUnit.MILLISECONDS).timeout(10,
TimeUnit.SECONDS)
+    .until(() -> assertEquals(0, dss.getQueueSize()));
+    Awaitility.await().pollInterval(10, TimeUnit.MILLISECONDS).pollDelay(10, TimeUnit.MILLISECONDS).timeout(10,
TimeUnit.SECONDS)
+    .until(() -> assertEquals(200, dss.getFlushes()));
     closeDown();
   }
 


Mime
View raw message