geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [geode] 07/15: GEODE-4876: Update RegionListenerDistributedTest use of VM and NetworkUtil
Date Thu, 29 Mar 2018 20:22:03 GMT
This is an automated email from the ASF dual-hosted git repository.

klund pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git

commit b069c1fa0121b4ce6a1ffbe206be699d89ade41f
Author: Kirk Lund <klund@apache.org>
AuthorDate: Mon Mar 26 17:32:50 2018 -0700

    GEODE-4876: Update RegionListenerDistributedTest use of VM and NetworkUtil
    
    * rename RegionListenerDUnitTest as RegionListenerDistributedTest
---
 ...Test.java => RegionListenerDistributedTest.java} | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 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/RegionListenerDistributedTest.java
similarity index 85%
rename from geode-core/src/test/java/org/apache/geode/internal/cache/RegionListenerDUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/cache/RegionListenerDistributedTest.java
index 1c1e821..46d2889 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/RegionListenerDistributedTest.java
@@ -14,9 +14,9 @@
  */
 package org.apache.geode.internal.cache;
 
+import static org.apache.geode.test.dunit.VM.getVM;
 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;
 import java.util.Set;
@@ -30,14 +30,14 @@ import org.junit.experimental.categories.Category;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionFactory;
 import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.rules.CacheRule;
 import org.apache.geode.test.dunit.rules.DistributedTestRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 
 @Category(DistributedTest.class)
-public class RegionListenerDUnitTest implements Serializable {
+@SuppressWarnings("serial")
+public class RegionListenerDistributedTest implements Serializable {
 
   @ClassRule
   public static DistributedTestRule distributedTestRule = new DistributedTestRule();
@@ -47,9 +47,8 @@ public class RegionListenerDUnitTest implements Serializable {
 
   @Test
   public void testCleanupFailedInitializationInvoked() {
-    Host host = Host.getHost(0);
-    VM vm0 = host.getVM(0);
-    VM vm1 = host.getVM(1);
+    VM vm0 = getVM(0);
+    VM vm1 = getVM(1);
 
     // Add RegionListener in both members
     vm0.invoke(() -> installRegionListener());
@@ -68,11 +67,11 @@ public class RegionListenerDUnitTest implements Serializable {
   }
 
   private void installRegionListener() {
-    this.cacheRule.getCache().addRegionListener(new TestRegionListener());
+    cacheRule.getCache().addRegionListener(new TestRegionListener());
   }
 
   private void createRegion(String regionName, boolean addAsyncEventQueueId) {
-    RegionFactory rf = this.cacheRule.getCache().createRegionFactory(RegionShortcut.REPLICATE);
+    RegionFactory rf = cacheRule.getCache().createRegionFactory(RegionShortcut.REPLICATE);
     if (addAsyncEventQueueId) {
       rf.addAsyncEventQueueId("aeqId");
     }
@@ -80,13 +79,13 @@ public class RegionListenerDUnitTest implements Serializable {
   }
 
   private void createRegion(String regionName, Class exception) {
-    RegionFactory rf = this.cacheRule.getCache().createRegionFactory(RegionShortcut.REPLICATE)
+    RegionFactory rf = cacheRule.getCache().createRegionFactory(RegionShortcut.REPLICATE)
         .addAsyncEventQueueId("aeqId");
     assertThatThrownBy(() -> rf.create(regionName)).isInstanceOf(exception);
   }
 
   private void verifyRegionListenerCleanupFailedInitializationInvoked() {
-    Set<RegionListener> listeners = this.cacheRule.getCache().getRegionListeners();
+    Set<RegionListener> listeners = cacheRule.getCache().getRegionListeners();
     assertThat(listeners.size()).isEqualTo(1);
     RegionListener listener = listeners.iterator().next();
     assertThat(listener).isInstanceOf(TestRegionListener.class);
@@ -104,7 +103,7 @@ public class RegionListenerDUnitTest implements Serializable {
     }
 
     public boolean getCleanupFailedInitializationInvoked() {
-      return this.cleanupFailedInitializationInvoked.get();
+      return cleanupFailedInitializationInvoked.get();
     }
   }
 }

-- 
To stop receiving notification emails like this one, please contact
klund@apache.org.

Mime
View raw message