geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject [1/2] incubator-geode git commit: GEODE-872: Removing duplicate code from ConcurrentSerialGatewaySenderOperationsDUnitTest
Date Thu, 28 Jan 2016 17:55:38 GMT
Repository: incubator-geode
Updated Branches:
  refs/heads/wan_cq_donation 68a85fed9 -> 441c29cdb


GEODE-872: Removing duplicate code from ConcurrentSerialGatewaySenderOperationsDUnitTest

This test was almost an exact copy of
SerialGatewaySenderOperationsDUnitTest, with a few lines changes. The
non concurrent test had already fixed the suspect string, but the
concurrent test did not. By throwing away the code from Concurrent* and
making it extend the non-concurrent test, this bug is fixed.

The test has also been tuned to do fewer operations and take less time.


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

Branch: refs/heads/wan_cq_donation
Commit: 22606309a2cb95db34d10fbd3000ca31755c8fad
Parents: 68a85fe
Author: Dan Smith <upthewaterspout@apache.org>
Authored: Wed Jan 27 15:05:58 2016 -0800
Committer: Dan Smith <upthewaterspout@apache.org>
Committed: Thu Jan 28 09:37:50 2016 -0800

----------------------------------------------------------------------
 .../gemfire/internal/cache/wan/WANTestBase.java |   8 +-
 ...tSerialGatewaySenderOperationsDUnitTest.java | 469 +---------
 .../SerialGatewaySenderOperationsDUnitTest.java | 901 ++++++++-----------
 3 files changed, 407 insertions(+), 971 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/22606309/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
index 3dd4742..a212baa 100644
--- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
+++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/WANTestBase.java
@@ -2239,10 +2239,14 @@ public class WANTestBase extends DistributedTestCase{
     }
   }
   
-  public static void startReceivers() throws IOException {
+  public static void startReceivers() {
     Set<GatewayReceiver> receivers = cache.getGatewayReceivers();
     for (GatewayReceiver receiver : receivers) {
-      receiver.start();
+      try {
+        receiver.start();
+      } catch (IOException e) {
+        throw new RuntimeException(e);
+      }
     }
   }
   

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/22606309/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java
index b709334..b2a9a3b 100644
--- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java
+++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentSerialGatewaySenderOperationsDUnitTest.java
@@ -19,16 +19,17 @@ package com.gemstone.gemfire.internal.cache.wan.concurrent;
 import java.util.Set;
 
 import com.gemstone.gemfire.cache.wan.GatewaySender;
+import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
 import com.gemstone.gemfire.internal.cache.wan.AbstractGatewaySender;
 import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
-import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.internal.cache.wan.serial.SerialGatewaySenderOperationsDUnitTest;
+import com.gemstone.gemfire.test.dunit.VM;
 
 /**
  * @author skumar
  *
  */
-public class ConcurrentSerialGatewaySenderOperationsDUnitTest  extends WANTestBase {
+public class ConcurrentSerialGatewaySenderOperationsDUnitTest  extends SerialGatewaySenderOperationsDUnitTest {
 
   private static final long serialVersionUID = 1L;
 
@@ -36,466 +37,24 @@ public class ConcurrentSerialGatewaySenderOperationsDUnitTest  extends WANTestBa
     super(name);
   }
 
-  public void setUp() throws Exception {
-    super.setUp();
-    addExpectedException("Broken pipe");
-    addExpectedException("Connection reset");
-    addExpectedException("Unexpected IOException");
+  protected void createSenderVM5() {
+    vm5.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, true, null, true, 5, OrderPolicy.KEY ));
   }
 
-  public void testSerialGatewaySenderOperationsWithoutStarting() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 5, OrderPolicy.KEY });
-    vm5.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 5, OrderPolicy.KEY });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        10000 });
-
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifyGatewaySenderOperations", new Object[] { "ln" });
-    vm5.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifyGatewaySenderOperations", new Object[] { "ln" });
-
+  protected void createSenderVM4() {
+    vm4.invoke(() -> WANTestBase.createConcurrentSender( "ln", 2,
+        false, 100, 10, false, true, null, true, 5, OrderPolicy.KEY ));
   }
 
-  
-  public void testStartPauseResumeSerialGatewaySender() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 5 , OrderPolicy.KEY});
-    vm5.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 5 , OrderPolicy.KEY});
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        10000 });
-
-    vm4.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" });
-
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderPausedState", new Object[] { "ln" });
-    vm5.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderPausedState", new Object[] { "ln" });
-
-    AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "doPuts",
-        new Object[] { testName + "_RR", 1000 });
-
-    vm4.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" });
-
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderResumedState", new Object[] { "ln" });
-    vm5.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderResumedState", new Object[] { "ln" });
-
-    try {
-      inv1.join();
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-      fail("Interrupted the async invocation.");
-    }
-
-    getLogWriter().info("Completed puts in the region");
-
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "validateQueueContentsForConcurrentSerialGatewaySender", new Object[] { "ln", 0 });
-    vm5.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "validateQueueContentsForConcurrentSerialGatewaySender", new Object[] { "ln", 0 });
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
-
-  }
-
-  public void testStopSerialGatewaySender() throws Throwable {
-    addExpectedException("Broken pipe");
-    addExpectedException("Connection reset");
-    addExpectedException("RegionDestroyedException");
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 3, OrderPolicy.KEY});
-    vm5.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 3, OrderPolicy.KEY });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        20 });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        20 });
-    
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 20 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 20 });
-    
-    vm2.invoke(WANTestBase.class, "stopReceivers");
-    vm3.invoke(WANTestBase.class, "stopReceivers");
-    
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        20 });
-    
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 20 });
-    vm5.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 20 });
-    
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-    vm5.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 0 });
-    vm5.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 0 });
-    /**
-     * Should have no effect on GatewaySenderState
-     */
-    vm4.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" });
-
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-    vm5.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-
-    AsyncInvocation vm4async = vm4.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" });
-    AsyncInvocation vm5async = vm5.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" });
-    int START_WAIT_TIME = 30000;
-    vm4async.getResult(START_WAIT_TIME);
-    vm5async.getResult(START_WAIT_TIME);
-    
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 20 });
-    vm5.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 20 });
-
-    vm5.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-      110 });
-    
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 130 });
-    vm5.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 130 });
-    
-    vm2.invoke(WANTestBase.class, "startReceivers");
-    vm3.invoke(WANTestBase.class, "startReceivers");
-
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderResumedState", new Object[] { "ln" });
-    vm5.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderResumedState", new Object[] { "ln" });
-    
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-      testName + "_RR", 110 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-      testName + "_RR", 110 });
-    
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 0 });
-    vm5.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 0 });
-  }
-
-
-  public void testStopOneSerialGatewaySenderBothPrimary() throws Throwable {
-    addExpectedException("Broken pipe");
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 4, OrderPolicy.KEY });
-    vm5.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 4, OrderPolicy.KEY });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        100 });
-
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-    
-    vm5.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        200 });
-    
-    getLogWriter().info("Completed puts in the region");
-
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 200 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 200 });
-    
-  //Do some puts while restarting a sender
-    AsyncInvocation asyncPuts = vm4.invokeAsync(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        2000 });
-    
-    Thread.sleep(10);
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    
-    asyncPuts.getResult();
-    getLogWriter().info("Completed puts in the region");
-    
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 2000 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 2000 });
-    
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 0 });
-  }
-
-  public void Bug46921_testStopOneSerialGatewaySender_PrimarySecondary() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 4, OrderPolicy.PARTITION });
-    vm5.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 4, OrderPolicy.PARTITION });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
-
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-    
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        10000 });
-    
-    getLogWriter().info("Completed puts in the region");
-
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
+  protected void validateQueueClosedVM4() {
+    vm4.invoke(() -> WANTestBase.validateQueueClosedForConcurrentSerialGatewaySender( "ln"));
   }
   
-  public void testStopOneSender_StartAnotherSender() {
-    addExpectedException("Broken pipe");
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm4.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 4, OrderPolicy.PARTITION });
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-      false, 100, 10, false, true, null, true, 4, OrderPolicy.PARTITION });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-      testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm5.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        10000 });
-    getLogWriter().info("Completed puts in the region");
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
+  private void validateQueueContents(VM vm, String site, int size) {
+    vm.invoke(() -> WANTestBase.validateQueueContentsForConcurrentSerialGatewaySender( site, size));
   }
 
-  public void test_Bug44153_StopOneSender_StartAnotherSender_CheckQueueSize() {
-    addExpectedException("Broken pipe");
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm4.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true, 3, OrderPolicy.PARTITION });
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
-    vm4.invoke(WANTestBase.class, "validateQueueContentsForConcurrentSerialGatewaySender", new Object[] { "ln", 1000});
-
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createConcurrentSender", new Object[] { "ln", 2,
-      false, 100, 10, false, true, null, true, 3, OrderPolicy.PARTITION });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "validateQueueContentsForConcurrentSerialGatewaySender", new Object[] { "ln", 1000});
-
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-    vm4.invoke(ConcurrentSerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-    vm4.invoke(WANTestBase.class, "validateQueueClosedForConcurrentSerialGatewaySender", new Object[] { "ln"});
-
-
-    vm5.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        10000 });
-
-    vm5.invoke(WANTestBase.class, "validateQueueContentsForConcurrentSerialGatewaySender", new Object[] { "ln",
-        11000 });
-    vm4.invoke(WANTestBase.class, "validateQueueClosedForConcurrentSerialGatewaySender", new Object[] { "ln"});
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    getLogWriter().info("Completed puts in the region");
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
-  }
-  
   public static void verifySenderPausedState(String senderId) {
     Set<GatewaySender> senders = cache.getGatewaySenders();
     AbstractGatewaySender sender = null;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/22606309/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java
index d30289b..7f4535e 100644
--- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java
+++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/wan/serial/SerialGatewaySenderOperationsDUnitTest.java
@@ -27,6 +27,7 @@ import com.gemstone.gemfire.internal.cache.wan.GatewaySenderException;
 import com.gemstone.gemfire.internal.cache.wan.WANTestBase;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.dunit.RMIException;
+import com.gemstone.gemfire.test.dunit.VM;
 
 /**
  * @author skumar
@@ -42,11 +43,11 @@ public class SerialGatewaySenderOperationsDUnitTest extends WANTestBase {
 
   public void setUp() throws Exception {
     super.setUp();
-    addExpectedException("Connection reset");
     addExpectedException("Broken pipe");
+    addExpectedException("Connection reset");
+    addExpectedException("Unexpected IOException");
     addExpectedException("Connection refused");
     addExpectedException("could not get remote locator information");
-    addExpectedException("Unexpected IOException");
     
     //Stopping the gateway closed the region,
     //which causes this exception to get logged
@@ -54,111 +55,107 @@ public class SerialGatewaySenderOperationsDUnitTest extends WANTestBase {
   }
 
   public void testSerialGatewaySenderOperationsWithoutStarting() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-    vm5.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        10000 });
-
-    vm4.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifyGatewaySenderOperations", new Object[] { "ln" });
-    vm5.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifyGatewaySenderOperations", new Object[] { "ln" });
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createReceivers(nyPort);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        10 ));
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        100 ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifyGatewaySenderOperations( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifyGatewaySenderOperations( "ln" ));
+
+  }
+
+  protected void createSenderRegions() {
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap() ));
+    vm6.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap() ));
+    vm7.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap() ));
+  }
+
+  protected void createReceiverRegions() {
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", null, isOffHeap() ));
+    vm3.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", null, isOffHeap() ));
+  }
+
+  protected void createSenderCaches(Integer lnPort) {
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm6.invoke(() -> WANTestBase.createCache( lnPort ));
+    vm7.invoke(() -> WANTestBase.createCache( lnPort ));
+  }
+
+  protected void createReceivers(Integer nyPort) {
+    vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    vm3.invoke(() -> WANTestBase.createReceiver( nyPort ));
+  }
 
+  protected void createSenderVM5() {
+    vm5.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
+  }
+
+  protected void createSenderVM4() {
+    vm4.invoke(() -> WANTestBase.createSender( "ln", 2,
+        false, 100, 10, false, true, null, true ));
   }
 
   
   public void testStartPauseResumeSerialGatewaySender() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-    vm5.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        10000 });
-
-    vm4.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "pauseSender", new Object[] { "ln" });
-
-    vm4.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderPausedState", new Object[] { "ln" });
-    vm5.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderPausedState", new Object[] { "ln" });
-
-    AsyncInvocation inv1 = vm4.invokeAsync(WANTestBase.class, "doPuts",
-        new Object[] { testName + "_RR", 1000 });
-
-    vm4.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" });
-
-    vm4.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderResumedState", new Object[] { "ln" });
-    vm5.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderResumedState", new Object[] { "ln" });
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createReceivers(nyPort);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        10 ));
+
+    startSenders();
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        100 ));
+
+    vm4.invoke(() -> WANTestBase.pauseSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.pauseSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderPausedState( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderPausedState( "ln" ));
+
+    AsyncInvocation inv1 = vm4.invokeAsync(() -> WANTestBase.doPuts( testName + "_RR", 10 ));
+
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
 
     try {
       inv1.join();
@@ -169,456 +166,351 @@ public class SerialGatewaySenderOperationsDUnitTest extends WANTestBase {
 
     getLogWriter().info("Completed puts in the region");
     
-    vm4.invoke(WANTestBase.class,
-        "validateQueueContents", new Object[] { "ln", 0 });
-    vm5.invoke(WANTestBase.class,
-        "validateQueueContents", new Object[] { "ln", 0 });
-    
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
+    validateQueueContents(vm4, "ln", 0);
+    validateQueueContents(vm5, "ln", 0);
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 100 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 100 ));
 
   }
 
   public void testStopSerialGatewaySender() throws Throwable {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-    vm5.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        20 });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        20 });
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createReceivers(nyPort);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        20 ));
+
+    startSenders();
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        20 ));
     
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 20 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 20 });
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 20 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 20 ));
     
-    vm2.invoke(WANTestBase.class, "stopReceivers");
-    vm3.invoke(WANTestBase.class, "stopReceivers");
+    vm2.invoke(() -> WANTestBase.stopReceivers());
+    vm3.invoke(() -> WANTestBase.stopReceivers());
     
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        20 });
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        20 ));
     
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 20 });
-    vm5.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 20 });
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
     
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
 
-    vm4.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-    vm5.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
 
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 0 });
-    vm5.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 0 });
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
     /**
      * Should have no effect on GatewaySenderState
      */
-    vm4.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "resumeSender", new Object[] { "ln" });
+    vm4.invoke(() -> WANTestBase.resumeSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.resumeSender( "ln" ));
 
-    vm4.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-    vm5.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
 
-    AsyncInvocation vm4async = vm4.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" });
-    AsyncInvocation vm5async = vm5.invokeAsync(WANTestBase.class, "startSender", new Object[] { "ln" });
+    AsyncInvocation vm4async = vm4.invokeAsync(() -> WANTestBase.startSender( "ln" ));
+    AsyncInvocation vm5async = vm5.invokeAsync(() -> WANTestBase.startSender( "ln" ));
     int START_WAIT_TIME = 30000;
     vm4async.getResult(START_WAIT_TIME);
     vm5async.getResult(START_WAIT_TIME);
 
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 20 });
-    vm5.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 20 });
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 20 ));
 
-    vm5.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-      110 });
+    vm5.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+      110 ));
     
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 130 });
-    vm5.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 130 });
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 130 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 130 ));
     
-    vm2.invoke(WANTestBase.class, "startReceivers");
-    vm3.invoke(WANTestBase.class, "startReceivers");
+    vm2.invoke(() -> WANTestBase.startReceivers());
+    vm3.invoke(() -> WANTestBase.startReceivers());
 
-    vm4.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderResumedState", new Object[] { "ln" });
-    vm5.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderResumedState", new Object[] { "ln" });
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderResumedState( "ln" ));
     
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-      testName + "_RR", 110 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-      testName + "_RR", 110 });
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+      testName + "_RR", 110 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+      testName + "_RR", 110 ));
     
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 0 });
-    vm5.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 0 });
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+    vm5.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
+  }
+
+  protected void startSenders() {
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
   }
 
   public void testStopOneSerialGatewaySenderBothPrimary() throws Throwable {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-    vm5.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        100 });
-
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-
-    vm4.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createReceivers(nyPort);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    startSenders();
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        100 ));
+
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
     
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        200 });
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        200 ));
     
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 200 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 200 });
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 200 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 200 ));
     
     //Do some puts while restarting a sender
-    AsyncInvocation asyncPuts = vm4.invokeAsync(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        2000 });
+    AsyncInvocation asyncPuts = vm4.invokeAsync(() -> WANTestBase.doPuts( testName + "_RR",
+        300 ));
     
     Thread.sleep(10);
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
     
     asyncPuts.getResult();
     getLogWriter().info("Completed puts in the region");
     
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 2000 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 2000 });
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 300 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 300 ));
     
-    Thread.sleep(5000);
-    vm4.invoke(WANTestBase.class, "validateQueueSizeStat", new Object[] { "ln", 0 });
+    vm4.invoke(() -> WANTestBase.validateQueueSizeStat( "ln", 0 ));
     
     
   }
 
   public void testStopOneSerialGatewaySender_PrimarySecondary() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-    vm5.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
-
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-
-    vm4.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createReceivers(nyPort);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    startSenders();
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        10 ));
+
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
     
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        10000 });
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        100 ));
     
     getLogWriter().info("Completed puts in the region");
 
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
-    vm3.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 100 ));
+    vm3.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 100 ));
   }
   
   public void testStopOneSender_StartAnotherSender() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm4.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-    vm4.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-      false, 100, 10, false, true, null, true });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-      testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm5.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        10000 });
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", null, isOffHeap() ));
+
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    createSenderVM4();
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        10 ));
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    createSenderVM5();
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+      testName + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm5.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        100 ));
     getLogWriter().info("Completed puts in the region");
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 100 ));
   }
 
   public void test_Bug44153_StopOneSender_StartAnotherSender_CheckQueueSize() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm4.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
-    vm4.invoke(WANTestBase.class, "validateQueueContents", new Object[] { "ln",
-      1000 });
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-
-    vm4.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-      false, 100, 10, false, true, null, true });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm5.invoke(WANTestBase.class, "doPutsFrom", new Object[] { testName + "_RR", 1000, 11000 });
-
-    vm5.invoke(WANTestBase.class, "validateQueueContents", new Object[] { "ln",
-        10000 });
-    vm5.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-    vm5.invoke(SerialGatewaySenderOperationsDUnitTest.class,
-        "verifySenderStoppedState", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm4.invoke(WANTestBase.class, "validateQueueContents", new Object[] { "ln",
-      1000 });
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    vm4.invoke(() -> WANTestBase.createCache( lnPort ));
+    createSenderVM4();
+    vm4.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap() ));
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        10 ));
+    validateQueueContents(vm4, "ln", 10);
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm4.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+
+    vm5.invoke(() -> WANTestBase.createCache( lnPort ));
+    createSenderVM5();
+    vm5.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", "ln", isOffHeap() ));
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+
+    vm5.invoke(() -> WANTestBase.doPutsFrom( testName + "_RR", 10, 110 ));
+
+    validateQueueContents(vm5, "ln", 100);
+    validateQueueClosedVM4();
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> SerialGatewaySenderOperationsDUnitTest.verifySenderStoppedState( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    validateQueueContents(vm4, "ln", 10);
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm5.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm2.invoke(() -> WANTestBase.createReceiver( nyPort ));
+    vm2.invoke(() -> WANTestBase.createReplicatedRegion(
+        testName + "_RR", null, isOffHeap() ));
     getLogWriter().info("Completed puts in the region");
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 10000 });
-    vm5.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 11000 });
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 100 ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
+
+    vm4.invoke(() -> WANTestBase.startSender( "ln" ));
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 110 ));
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
   }
   
+  private void validateQueueClosedVM4() {
+    // TODO Auto-generated method stub
+    
+  }
+
+  private void validateQueueContents(VM vm, String site, int size) {
+    vm.invoke(() -> WANTestBase.validateQueueContents( site,
+        size ));
+  }
+
   /**
    * Destroy SerialGatewaySender on all the nodes.
    */
   public void testDestroySerialGatewaySenderOnAllNodes() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-    vm5.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createReceivers(nyPort);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    startSenders();
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        10 ));
     
     //before destroying, stop the sender
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
+    vm5.invoke(() -> WANTestBase.stopSender( "ln" ));
     
-    vm4.invoke(WANTestBase.class, "removeSenderFromTheRegion", new Object[] { "ln", testName + "_RR" });
-    vm5.invoke(WANTestBase.class, "removeSenderFromTheRegion", new Object[] { "ln", testName + "_RR" });
+    vm4.invoke(() -> WANTestBase.removeSenderFromTheRegion( "ln", testName + "_RR" ));
+    vm5.invoke(() -> WANTestBase.removeSenderFromTheRegion( "ln", testName + "_RR" ));
 
-    vm4.invoke(WANTestBase.class, "destroySender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "destroySender", new Object[] { "ln" });
+    vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
+    vm5.invoke(() -> WANTestBase.destroySender( "ln" ));
     
-    vm4.invoke(WANTestBase.class, "verifySenderDestroyed", new Object[] { "ln", false });
-    vm5.invoke(WANTestBase.class, "verifySenderDestroyed", new Object[] { "ln", false });
+    vm4.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", false ));
+    vm5.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", false ));
   }
 
   /**
    * Destroy SerialGatewaySender on a single node.
    */
   public void testDestroySerialGatewaySenderOnSingleNode() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-    vm5.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createReceivers(nyPort);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    startSenders();
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        10 ));
     
     //before destroying, stop the sender
-    vm4.invoke(WANTestBase.class, "stopSender", new Object[] { "ln" });
+    vm4.invoke(() -> WANTestBase.stopSender( "ln" ));
         
-    vm4.invoke(WANTestBase.class, "removeSenderFromTheRegion", new Object[] { "ln", testName + "_RR" });
+    vm4.invoke(() -> WANTestBase.removeSenderFromTheRegion( "ln", testName + "_RR" ));
     
-    vm4.invoke(WANTestBase.class, "destroySender", new Object[] { "ln" });
+    vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
     
-    vm4.invoke(WANTestBase.class, "verifySenderDestroyed", new Object[] { "ln", false });
-    vm5.invoke(WANTestBase.class, "verifySenderRunningState", new Object[] { "ln" });
+    vm4.invoke(() -> WANTestBase.verifySenderDestroyed( "ln", false ));
+    vm5.invoke(() -> WANTestBase.verifySenderRunningState( "ln" ));
   }
   
   /**
@@ -626,56 +518,37 @@ public class SerialGatewaySenderOperationsDUnitTest extends WANTestBase {
    * Hence, exception is thrown by the sender API.
    */
   public void testDestroySerialGatewaySenderExceptionScenario() {
-    Integer lnPort = (Integer)vm0.invoke(WANTestBase.class,
-        "createFirstLocatorWithDSId", new Object[] { 1 });
-    Integer nyPort = (Integer)vm1.invoke(WANTestBase.class,
-        "createFirstRemoteLocator", new Object[] { 2, lnPort });
-
-    vm2.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-    vm3.invoke(WANTestBase.class, "createReceiver", new Object[] { nyPort });
-
-    vm4.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm5.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm6.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-    vm7.invoke(WANTestBase.class, "createCache", new Object[] { lnPort });
-
-    vm4.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-    vm5.invoke(WANTestBase.class, "createSender", new Object[] { "ln", 2,
-        false, 100, 10, false, true, null, true });
-
-    vm2.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-    vm3.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", null, isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm5.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm6.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-    vm7.invoke(WANTestBase.class, "createReplicatedRegion", new Object[] {
-        testName + "_RR", "ln", isOffHeap() });
-
-    vm4.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-    vm5.invoke(WANTestBase.class, "startSender", new Object[] { "ln" });
-
-    vm4.invoke(WANTestBase.class, "doPuts", new Object[] { testName + "_RR",
-        1000 });
+    Integer lnPort = (Integer)vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId( 1 ));
+    Integer nyPort = (Integer)vm1.invoke(() -> WANTestBase.createFirstRemoteLocator( 2, lnPort ));
+
+    createReceivers(nyPort);
+
+    createSenderCaches(lnPort);
+
+    createSenderVM4();
+    createSenderVM5();
+
+    createReceiverRegions();
+
+    createSenderRegions();
+
+    startSenders();
+
+    vm4.invoke(() -> WANTestBase.doPuts( testName + "_RR",
+        10 ));
     
     try {
-      vm4.invoke(WANTestBase.class, "destroySender", new Object[] { "ln" });
+      vm4.invoke(() -> WANTestBase.destroySender( "ln" ));
     } catch (RMIException e) {
       assertTrue("Cause of the exception should be GatewaySenderException", e.getCause() instanceof GatewaySenderException);
     }
-    vm2.invoke(WANTestBase.class, "validateRegionSize", new Object[] {
-        testName + "_RR", 1000 });
+    vm2.invoke(() -> WANTestBase.validateRegionSize(
+        testName + "_RR", 10 ));
   }
   
   public static void verifySenderPausedState(String senderId) {
     Set<GatewaySender> senders = cache.getGatewaySenders();
-    GatewaySender sender = null;
+    AbstractGatewaySender sender = null;
     for (GatewaySender s : senders) {
       if (s.getId().equals(senderId)) {
         sender = (AbstractGatewaySender)s;


Mime
View raw message