geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jasonhu...@apache.org
Subject [1/7] incubator-geode git commit: GEODE-1062: Refactor of WANTestBase
Date Fri, 01 Apr 2016 17:32:09 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/develop 7c777b1b3 -> 65d7a6f1d


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/65d7a6f1/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
index 6602104..0220459 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialWANStatsDUnitTest.java
@@ -49,12 +49,10 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(
1 ));
     Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2,
lnPort ));
 
+    createCacheInVMs(nyPort, vm2);
     vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
 
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
 
     vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
         false, 100, 10, false, false, null, true ));
@@ -64,8 +62,7 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     vm2.invoke(() -> WANTestBase.createReplicatedRegion(
         testName + "_RR", null, isOffHeap()  ));
 
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    startSenderInVMs("ln", vm4, vm5);
 
     vm4.invoke(() -> WANTestBase.createReplicatedRegion(
         testName + "_RR", "ln", isOffHeap()  ));
@@ -98,15 +95,13 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
   }
   
   public void testReplicatedSerialPropagationWithMultipleDispatchers() throws Exception {
-	Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1
));
-	Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort
));
+	 Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1
));
+	 Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2,
lnPort ));
 
-	vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    createCacheInVMs(nyPort, vm2);
+    vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
 
-	vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-	vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-	vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-	vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
 
 	vm4.invoke(() -> WANTestBase.createSenderWithMultipleDispatchers( "ln", 2,
 		false, 100, 10, false, false, null, true, 2, OrderPolicy.KEY ));
@@ -116,10 +111,9 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
 	vm2.invoke(() -> WANTestBase.createReplicatedRegion(
 		testName + "_RR", null, isOffHeap()  ));
 
-	vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-	vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    startSenderInVMs("ln", vm4, vm5);
 
-	vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
 		testName + "_RR", "ln", isOffHeap()  ));
 	vm5.invoke(() -> WANTestBase.createReplicatedRegion(
 		testName + "_RR", "ln", isOffHeap()  ));
@@ -155,13 +149,12 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     Integer nyPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstRemoteLocator( 2,
lnPort ));
     Integer tkPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 3,
lnPort ));
 
+    createCacheInVMs(nyPort, vm2);
     vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    createCacheInVMs(tkPort, vm3);
     vm3.invoke(() -> WANTestBase.createReceiver( tkPort ));
 
-    vm4.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache(lnPort ));
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
 
     vm4.invoke(() -> WANTestBase.createSender( "lnSerial1",
         2, false, 100, 10, false, false, null, true ));
@@ -178,11 +171,8 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     vm3.invoke(() -> WANTestBase.createReplicatedRegion(
         testName + "_RR", null, isOffHeap()  ));
 
-    vm4.invoke(() -> WANTestBase.startSender( "lnSerial1" ));
-    vm5.invoke(() -> WANTestBase.startSender( "lnSerial1" ));
-
-    vm4.invoke(() -> WANTestBase.startSender( "lnSerial2" ));
-    vm5.invoke(() -> WANTestBase.startSender( "lnSerial2" ));
+    startSenderInVMs("lnSerial1", vm4, vm5);
+    startSenderInVMs("lnSerial2", vm4, vm5);
 
     vm4.invoke(() -> WANTestBase.createReplicatedRegion(
         testName + "_RR", "lnSerial1,lnSerial2", isOffHeap()  ));
@@ -229,6 +219,7 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(
1 ));
     Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2,
lnPort ));
 
+    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
     vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
 
     vm4.invoke(() -> WANTestBase.createCache(lnPort ));
@@ -244,8 +235,7 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     vm2.invoke(() -> WANTestBase.createReplicatedRegion(
         testName + "_RR", null, isOffHeap()  ));
 
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    startSenderInVMs("ln", vm4, vm5);
 
     vm4.invoke(() -> WANTestBase.createReplicatedRegion(
         testName + "_RR", "ln", isOffHeap()  ));
@@ -287,14 +277,11 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2,
lnPort ));
 
     //these are part of remote site
-    vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
-    vm3.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(nyPort, vm2, vm3);
 
     //these are part of local site
-    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
 
     //senders are created on local site
     vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
@@ -315,8 +302,7 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
         testName + "_RR_2", null, isOffHeap()  ));
     
     //start the senders on local site
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    startSenderInVMs("ln", vm4, vm5);
 
     //create one RR (RR_1) on local site
     vm4.invoke(() -> WANTestBase.createReplicatedRegion(
@@ -380,6 +366,7 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2,
lnPort ));
 
     //these are part of remote site
+    vm2.invoke(() -> WANTestBase.createCache( nyPort ));
     vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
 
     //these are part of local site
@@ -399,8 +386,7 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
         testName + "_RR_1", null, isOffHeap()  ));
 
     //start the senders on local site
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    startSenderInVMs("ln", vm4, vm5);
 
     //create one RR (RR_1) on local site
     vm4.invoke(() -> WANTestBase.createReplicatedRegion(
@@ -446,13 +432,10 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
     Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,lnPort
));
 
-    vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
-    vm3.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(nyPort, vm2, vm3);
 
-    vm4.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache(lnPort ));
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
 
     vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
         false, 100, 10, false, false,
@@ -470,8 +453,7 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     vm7.invoke(() -> WANTestBase.createPartitionedRegion(
         testName, "ln", 1, 100, isOffHeap()  ));
 
-    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
-    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    startSenderInVMs("ln", vm4, vm5);
 
     vm2.invoke(() -> WANTestBase.createPartitionedRegion(
         testName, null, 1, 100, isOffHeap()  ));
@@ -504,13 +486,10 @@ public class SerialWANStatsDUnitTest extends WANTestBase {
     Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(
1 ));
     Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2,
lnPort ));
 
-    vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
-    vm3.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    createCacheInVMs(nyPort, vm2, vm3);
+    createReceiverInVMs(nyPort, vm2, vm3);
 
-    vm4.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm5.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm6.invoke(() -> WANTestBase.createCache(lnPort ));
-    vm7.invoke(() -> WANTestBase.createCache(lnPort ));
+    createCacheInVMs(lnPort, vm4, vm5, vm6, vm7);
 
     vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
         false, 100, 10, true, false, null, true ));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/65d7a6f1/geode-wan/src/test/java/com/gemstone/gemfire/management/WANManagementDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/management/WANManagementDUnitTest.java
b/geode-wan/src/test/java/com/gemstone/gemfire/management/WANManagementDUnitTest.java
index 1f0f3bd..48aff88 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/management/WANManagementDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/management/WANManagementDUnitTest.java
@@ -79,12 +79,11 @@ public class WANManagementDUnitTest extends ManagementTestBase {
     puneSender.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() +
"_PR", "pn", 1, 100, false ));
     managing.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() + "_PR",
"pn", 1, 100, false ));
     
-    nyReceiver.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    nyReceiver.invoke(() -> WANTestBase.createCache( nyPort ));
     nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() +
"_PR", null, 1, 100, false ));
+    nyReceiver.invoke(() -> WANTestBase.createReceiver( nyPort ));
 
-    puneSender.invoke(() -> WANTestBase.startSender( "pn" ));
-    managing.invoke(() -> WANTestBase.startSender( "pn" ));
-
+    WANTestBase.startSenderInVMs("pn", puneSender, managing);
 
     // make sure all the senders are running before doing any puts
     puneSender.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));
@@ -122,9 +121,10 @@ public class WANManagementDUnitTest extends ManagementTestBase {
 
     puneSender.invoke(() -> WANTestBase.createCache( punePort ));
 
-    nyReceiver.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    nyReceiver.invoke(() -> WANTestBase.createCache( nyPort ));
     nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() +
"_PR", null, 1, 100, false ));
-    
+    nyReceiver.invoke(() -> WANTestBase.createReceiver( nyPort ));
+
     // keep a larger batch to minimize number of exception occurrences in the
     // log
     puneSender.invoke(() -> WANTestBase.createSender( "pn",
@@ -183,10 +183,10 @@ public class WANManagementDUnitTest extends ManagementTestBase {
     managing.invoke(() -> WANTestBase.createReplicatedRegionWithAsyncEventQueue(
       getTestMethodName() + "_RR", "pn", false ));
 
-    
-    nyReceiver.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    WANTestBase.createCacheInVMs(nyPort, nyReceiver);
     nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() +
"_PR", null, 1, 100, false ));
-    
+    nyReceiver.invoke(() -> WANTestBase.createReceiver( nyPort ));
+
     checkAsyncQueueMBean(puneSender);
     checkAsyncQueueMBean(managing);
     

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/65d7a6f1/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestRemoteClusterDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestRemoteClusterDUnitTest.java
b/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestRemoteClusterDUnitTest.java
index 672cbf7..1827fc1 100644
--- a/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestRemoteClusterDUnitTest.java
+++ b/geode-wan/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestRemoteClusterDUnitTest.java
@@ -83,11 +83,11 @@ public class TestRemoteClusterDUnitTest extends ManagementTestBase {
     managing.invoke(() -> WANTestBase.createPartitionedRegion(
         getTestMethodName() + "_PR", "pn", 1, 100, false ));
 
+    WANTestBase.createCacheInVMs(nyPort, nyReceiver);
     nyReceiver.invoke(() -> WANTestBase.createReceiver( nyPort ));
     nyReceiver.invoke(() -> WANTestBase.createPartitionedRegion( getTestMethodName() +
"_PR", null, 1, 100, false ));
 
-    puneSender.invoke(() -> WANTestBase.startSender( "pn" ));
-    managing.invoke(() -> WANTestBase.startSender( "pn" ));
+    WANTestBase.startSenderInVMs("pn", puneSender, managing);
 
     // make sure all the senders are running before doing any puts
     puneSender.invoke(() -> WANTestBase.waitForSenderRunningState( "pn" ));


Mime
View raw message