geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bogle...@apache.org
Subject [geode] branch feature/GEODE-3026 updated: GEODE-3026: Updated dunit test
Date Tue, 17 Oct 2017 23:02:27 GMT
This is an automated email from the ASF dual-hosted git repository.

boglesby pushed a commit to branch feature/GEODE-3026
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/feature/GEODE-3026 by this push:
     new 4c13906  GEODE-3026: Updated dunit test
4c13906 is described below

commit 4c13906555f212594cd6c03bf2ea04c4bdd14ae4
Author: Barry Oglesby <boglesby@pivotal.io>
AuthorDate: Tue Oct 17 16:02:05 2017 -0700

    GEODE-3026: Updated dunit test
---
 .../geode/internal/cache/RegionListenerDUnitTest.java   | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/RegionListenerDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/internal/cache/RegionListenerDUnitTest.java
index be40db4..1c1e821 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/RegionListenerDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/RegionListenerDUnitTest.java
@@ -15,6 +15,7 @@
 package org.apache.geode.internal.cache;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.fail;
 
 import java.io.Serializable;
@@ -58,13 +59,9 @@ public class RegionListenerDUnitTest implements Serializable {
     String regionName = "testCleanupFailedInitializationInvoked";
     vm0.invoke(() -> createRegion(regionName, false));
 
-    // Attempt to create the region with incompatible configuration in another member
-    try {
-      vm1.invoke(() -> createRegion(regionName, true));
-      fail("should not have succeeded in creating region");
-    } catch (Exception e) {
-      assertThat(e.getCause()).isInstanceOf(IllegalStateException.class);
-    }
+    // Attempt to create the region with incompatible configuration in another member. Verify
that
+    // it throws an IllegalStateException.
+    vm1.invoke(() -> createRegion(regionName, IllegalStateException.class));
 
     // Verify the RegionListener cleanupFailedInitialization callback was invoked
     vm1.invoke(() -> verifyRegionListenerCleanupFailedInitializationInvoked());
@@ -82,6 +79,12 @@ public class RegionListenerDUnitTest implements Serializable {
     rf.create(regionName);
   }
 
+  private void createRegion(String regionName, Class exception) {
+    RegionFactory rf = this.cacheRule.getCache().createRegionFactory(RegionShortcut.REPLICATE)
+        .addAsyncEventQueueId("aeqId");
+    assertThatThrownBy(() -> rf.create(regionName)).isInstanceOf(exception);
+  }
+
   private void verifyRegionListenerCleanupFailedInitializationInvoked() {
     Set<RegionListener> listeners = this.cacheRule.getCache().getRegionListeners();
     assertThat(listeners.size()).isEqualTo(1);

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <commits@geode.apache.org>'].

Mime
View raw message