You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bo...@apache.org on 2017/10/17 23:02:27 UTC

[geode] branch feature/GEODE-3026 updated: GEODE-3026: Updated dunit test

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 <bo...@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" <co...@geode.apache.org>'].