geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From upthewatersp...@apache.org
Subject [27/63] [abbrv] incubator-geode git commit: Automatically converting calls of vm.invoke to lambdas
Date Fri, 19 Feb 2016 18:37:04 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
index 2774e35..fe2a62d 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationDUnitTest.java
@@ -66,14 +66,10 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
     client1 = host.getVM(2);
     client2 = host.getVM(3);
 
-    server1.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { serverExpectedExceptions });
-    server2.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { serverExpectedExceptions });
-    client1.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { clientExpectedExceptions });
-    client2.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { clientExpectedExceptions });
+    server1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
+    server2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
+    client1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
+    client2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
     SecurityTestUtil.registerExpectedExceptions(clientExpectedExceptions);
   }
 
@@ -194,10 +190,9 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
             opFlags), new Integer(expectedResult));
       }
       else {
-        clientVM.invoke(ClientAuthorizationTestBase.class, "doOp",
-            new Object[] { new Byte(opCode.toOrdinal()),
+        clientVM.invoke(() -> ClientAuthorizationTestBase.doOp( new Byte(opCode.toOrdinal()),
                 currentOp.getIndices(), new Integer(opFlags),
-                new Integer(expectedResult) });
+                new Integer(expectedResult) ));
       }
     }
   }
@@ -222,12 +217,10 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
       // Start servers with all required properties
       Properties serverProps = buildProperties(authenticator, accessor, false,
           extraAuthProps, extraAuthzProps);
-      Integer port1 = ((Integer)server1.invoke(
-          ClientAuthorizationTestBase.class, "createCacheServer", new Object[] {
-              SecurityTestUtil.getLocatorPort(), serverProps, javaProps }));
-      Integer port2 = ((Integer)server2.invoke(
-          ClientAuthorizationTestBase.class, "createCacheServer", new Object[] {
-              SecurityTestUtil.getLocatorPort(), serverProps, javaProps }));
+      Integer port1 = ((Integer)server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
+              SecurityTestUtil.getLocatorPort(), serverProps, javaProps )));
+      Integer port2 = ((Integer)server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
+              SecurityTestUtil.getLocatorPort(), serverProps, javaProps )));
 
       // Start client1 with valid CREATE credentials
       Properties createCredentials = gen.getAllowedCredentials(
@@ -237,9 +230,8 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
       LogWriterUtils.getLogWriter().info(
           "testAllowPutsGets: For first client credentials: "
               + createCredentials);
-      client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, createCredentials, javaProps, port1, port2,
-              null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, createCredentials, javaProps, port1, port2,
+              null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Start client2 with valid GET credentials
       Properties getCredentials = gen.getAllowedCredentials(
@@ -250,17 +242,16 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
           .info(
               "testAllowPutsGets: For second client credentials: "
                   + getCredentials);
-      client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, getCredentials, javaProps, port1, port2,
-              null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, getCredentials, javaProps, port1, port2,
+              null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Perform some put operations from client1
-      client1.invoke(SecurityTestUtil.class, "doPuts", new Object[] {
-          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> SecurityTestUtil.doPuts(
+          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Verify that the gets succeed
-      client2.invoke(SecurityTestUtil.class, "doGets", new Object[] {
-          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doGets(
+          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
   }
 
   public void testDisallowPutsGets() {
@@ -300,30 +291,26 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
       // Start servers with all required properties
       Properties serverProps = buildProperties(authenticator, accessor, false,
           extraAuthProps, extraAuthzProps);
-      Integer port1 = ((Integer)server1.invoke(
-          ClientAuthorizationTestBase.class, "createCacheServer", new Object[] {
-              SecurityTestUtil.getLocatorPort(), serverProps, javaProps }));
-      Integer port2 = ((Integer)server2.invoke(
-          ClientAuthorizationTestBase.class, "createCacheServer", new Object[] {
-              SecurityTestUtil.getLocatorPort(), serverProps, javaProps }));
+      Integer port1 = ((Integer)server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
+              SecurityTestUtil.getLocatorPort(), serverProps, javaProps )));
+      Integer port2 = ((Integer)server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
+              SecurityTestUtil.getLocatorPort(), serverProps, javaProps )));
 
       // Start client1 with valid CREATE credentials
-      client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, createCredentials, createJavaProps, port1,
-              port2, null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, createCredentials, createJavaProps, port1,
+              port2, null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Start client2 with invalid GET credentials
-      client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, getCredentials, getJavaProps, port1, port2,
-              null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, getCredentials, getJavaProps, port1, port2,
+              null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Perform some put operations from client1
-      client1.invoke(SecurityTestUtil.class, "doPuts", new Object[] {
-          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> SecurityTestUtil.doPuts(
+          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Gets as normal user should throw exception
-      client2.invoke(SecurityTestUtil.class, "doGets", new Object[] {
-          new Integer(2), new Integer(SecurityTestUtil.NOTAUTHZ_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doGets(
+          new Integer(2), new Integer(SecurityTestUtil.NOTAUTHZ_EXCEPTION) ));
 
       // Try to connect client2 with reader credentials
       getCredentials = gen.getAllowedCredentials(
@@ -333,17 +320,16 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
       LogWriterUtils.getLogWriter().info(
           "testDisallowPutsGets: For second client with GET credentials: "
               + getCredentials);
-      client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, getCredentials, getJavaProps, port1, port2,
-              null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, getCredentials, getJavaProps, port1, port2,
+              null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Verify that the gets succeed
-      client2.invoke(SecurityTestUtil.class, "doGets", new Object[] {
-          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doGets(
+          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Verify that the puts throw exception
-      client2.invoke(SecurityTestUtil.class, "doNPuts", new Object[] {
-          new Integer(2), new Integer(SecurityTestUtil.NOTAUTHZ_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doNPuts(
+          new Integer(2), new Integer(SecurityTestUtil.NOTAUTHZ_EXCEPTION) ));
   }
 
   public void testInvalidAccessor() {
@@ -363,9 +349,8 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
       // Start server1 with invalid accessor
       Properties serverProps = buildProperties(authenticator,
           "com.gemstone.none", false, extraAuthProps, extraAuthzProps);
-      Integer port1 = ((Integer)server1.invoke(
-          ClientAuthorizationTestBase.class, "createCacheServer", new Object[] {
-              SecurityTestUtil.getLocatorPort(), serverProps, javaProps }));
+      Integer port1 = ((Integer)server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
+              SecurityTestUtil.getLocatorPort(), serverProps, javaProps )));
       Integer port2 = new Integer(AvailablePort
           .getRandomAvailablePort(AvailablePort.SOCKET));
 
@@ -384,43 +369,38 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
       LogWriterUtils.getLogWriter().info(
           "testInvalidAccessor: For second client GET credentials: "
               + getCredentials);
-      client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, createCredentials, createJavaProps, port1,
+      client1.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, createCredentials, createJavaProps, port1,
               port2, null, Boolean.FALSE, Boolean.FALSE,
-              Integer.valueOf(SecurityTestUtil.NO_EXCEPTION) });
-      client1.invoke(SecurityTestUtil.class, "doPuts", new Object[] {
-          new Integer(1), new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) });
-      client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, getCredentials, getJavaProps, port1, port2,
+              Integer.valueOf(SecurityTestUtil.NO_EXCEPTION) ));
+      client1.invoke(() -> SecurityTestUtil.doPuts(
+          new Integer(1), new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) ));
+      client2.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, getCredentials, getJavaProps, port1, port2,
               null, Boolean.FALSE, Boolean.FALSE,
-              Integer.valueOf(SecurityTestUtil.NO_EXCEPTION) });
-      client2.invoke(SecurityTestUtil.class, "doPuts", new Object[] {
-          new Integer(1), new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) });
+              Integer.valueOf(SecurityTestUtil.NO_EXCEPTION) ));
+      client2.invoke(() -> SecurityTestUtil.doPuts(
+          new Integer(1), new Integer(SecurityTestUtil.AUTHFAIL_EXCEPTION) ));
 
       // Now start server2 that has valid accessor
       LogWriterUtils.getLogWriter().info("testInvalidAccessor: Using accessor: " + accessor);
       serverProps = buildProperties(authenticator, accessor, false,
           extraAuthProps, extraAuthzProps);
-      server2.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
-          new Object[] { SecurityTestUtil.getLocatorPort(), port2, serverProps,
-              javaProps });
-      server1.invoke(SecurityTestUtil.class, "closeCache");
+      server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer( SecurityTestUtil.getLocatorPort(), port2, serverProps,
+              javaProps ));
+      server1.invoke(() -> SecurityTestUtil.closeCache());
 
       // Client creation should be successful now
-      client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, createCredentials, createJavaProps, port1,
-              port2, null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
-      client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, getCredentials, getJavaProps, port1, port2,
-              null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, createCredentials, createJavaProps, port1,
+              port2, null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
+      client2.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, getCredentials, getJavaProps, port1, port2,
+              null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Now perform some put operations from client1
-      client1.invoke(SecurityTestUtil.class, "doPuts", new Object[] {
-          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> SecurityTestUtil.doPuts(
+          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Verify that the gets succeed
-      client2.invoke(SecurityTestUtil.class, "doGets", new Object[] {
-          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doGets(
+          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
   }
 
   public void testPutsGetsWithFailover() {
@@ -443,9 +423,8 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
       // Start servers with all required properties
       Properties serverProps = buildProperties(authenticator, accessor, false,
           extraAuthProps, extraAuthzProps);
-      Integer port1 = ((Integer)server1.invoke(
-          ClientAuthorizationTestBase.class, "createCacheServer", new Object[] {
-              SecurityTestUtil.getLocatorPort(), serverProps, javaProps }));
+      Integer port1 = ((Integer)server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
+              SecurityTestUtil.getLocatorPort(), serverProps, javaProps )));
       // Get a port for second server but do not start it
       // This forces the clients to connect to the first server
       Integer port2 = new Integer(AvailablePort
@@ -459,9 +438,8 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
       LogWriterUtils.getLogWriter().info(
           "testPutsGetsWithFailover: For first client credentials: "
               + createCredentials);
-      client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, createCredentials, createJavaProps, port1,
-              port2, null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, createCredentials, createJavaProps, port1,
+              port2, null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Start client2 with valid GET credentials
       Properties getCredentials = gen.getAllowedCredentials(
@@ -471,29 +449,27 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
       LogWriterUtils.getLogWriter().info(
           "testPutsGetsWithFailover: For second client credentials: "
               + getCredentials);
-      client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, getCredentials, getJavaProps, port1, port2,
-              null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, getCredentials, getJavaProps, port1, port2,
+              null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Perform some put operations from client1
-      client1.invoke(SecurityTestUtil.class, "doPuts", new Object[] {
-          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> SecurityTestUtil.doPuts(
+          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
       // Verify that the puts succeeded
-      client2.invoke(SecurityTestUtil.class, "doGets", new Object[] {
-          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doGets(
+          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // start the second one and stop the first server to force a failover
-      server2.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
-          new Object[] { SecurityTestUtil.getLocatorPort(), port2, serverProps,
-              javaProps });
-      server1.invoke(SecurityTestUtil.class, "closeCache");
+      server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer( SecurityTestUtil.getLocatorPort(), port2, serverProps,
+              javaProps ));
+      server1.invoke(() -> SecurityTestUtil.closeCache());
 
       // Perform some put operations from client1
-      client1.invoke(SecurityTestUtil.class, "doNPuts", new Object[] {
-          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> SecurityTestUtil.doNPuts(
+          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
       // Verify that the puts succeeded
-      client2.invoke(SecurityTestUtil.class, "doNGets", new Object[] {
-          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doNGets(
+          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Now re-connect with credentials not allowed to do gets
       Properties noGetCredentials = gen.getDisallowedCredentials(
@@ -506,42 +482,39 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
               + noGetCredentials);
 
       // Re-connect client2 with invalid GET credentials
-      client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, noGetCredentials, getJavaProps, port1,
-              port2, null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, noGetCredentials, getJavaProps, port1,
+              port2, null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Perform some put operations from client1
-      client1.invoke(SecurityTestUtil.class, "doPuts", new Object[] {
-          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> SecurityTestUtil.doPuts(
+          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
       // Gets as normal user should throw exception
-      client2.invoke(SecurityTestUtil.class, "doGets", new Object[] {
-          new Integer(4), new Integer(SecurityTestUtil.NOTAUTHZ_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doGets(
+          new Integer(4), new Integer(SecurityTestUtil.NOTAUTHZ_EXCEPTION) ));
 
       // force a failover and do the drill again
-      server1.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
-          new Object[] { SecurityTestUtil.getLocatorPort(), port1, serverProps,
-              javaProps });
-      server2.invoke(SecurityTestUtil.class, "closeCache");
+      server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer( SecurityTestUtil.getLocatorPort(), port1, serverProps,
+              javaProps ));
+      server2.invoke(() -> SecurityTestUtil.closeCache());
 
       // Perform some put operations from client1
-      client1.invoke(SecurityTestUtil.class, "doNPuts", new Object[] {
-          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> SecurityTestUtil.doNPuts(
+          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
       // Gets as normal user should throw exception
-      client2.invoke(SecurityTestUtil.class, "doNGets", new Object[] {
-          new Integer(4), new Integer(SecurityTestUtil.NOTAUTHZ_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doNGets(
+          new Integer(4), new Integer(SecurityTestUtil.NOTAUTHZ_EXCEPTION) ));
 
       // Try to connect client2 with reader credentials
-      client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, getCredentials, getJavaProps, port1, port2,
-              null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, getCredentials, getJavaProps, port1, port2,
+              null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Verify that the gets succeed
-      client2.invoke(SecurityTestUtil.class, "doNGets", new Object[] {
-          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doNGets(
+          new Integer(4), new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Verify that the puts throw exception
-      client2.invoke(SecurityTestUtil.class, "doPuts", new Object[] {
-          new Integer(4), new Integer(SecurityTestUtil.NOTAUTHZ_EXCEPTION) });
+      client2.invoke(() -> SecurityTestUtil.doPuts(
+          new Integer(4), new Integer(SecurityTestUtil.NOTAUTHZ_EXCEPTION) ));
   }
 
   public void testUnregisterInterestWithFailover() {
@@ -652,20 +625,18 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
         // on the servers with/without failover
         if (opBlock.size() > 0) {
           // Start the first server and execute the operation block
-          server1.invoke(ClientAuthorizationTestBase.class,
-              "createCacheServer", new Object[] {
+          server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
                   SecurityTestUtil.getLocatorPort(), port1, serverProps,
-                  javaProps });
-          server2.invoke(SecurityTestUtil.class, "closeCache");
+                  javaProps ));
+          server2.invoke(() -> SecurityTestUtil.closeCache());
           executeRIOpBlock(opBlock, port1, port2, authInit, extraAuthProps,
               extraAuthzProps, javaProps);
           if (!currentOp.equals(OperationWithAction.OPBLOCK_NO_FAILOVER)) {
             // Failover to the second server and run the block again
-            server2.invoke(ClientAuthorizationTestBase.class,
-                "createCacheServer", new Object[] {
+            server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
                     SecurityTestUtil.getLocatorPort(), port2, serverProps,
-                    javaProps });
-            server1.invoke(SecurityTestUtil.class, "closeCache");
+                    javaProps ));
+            server1.invoke(() -> SecurityTestUtil.closeCache());
             executeRIOpBlock(opBlock, port1, port2, authInit, extraAuthProps,
                 extraAuthzProps, javaProps);
           }
@@ -787,11 +758,11 @@ public class ClientAuthorizationDUnitTest extends ClientAuthorizationTestBase {
   @Override
   protected final void preTearDown() throws Exception {
     // close the clients first
-    client1.invoke(SecurityTestUtil.class, "closeCache");
-    client2.invoke(SecurityTestUtil.class, "closeCache");
+    client1.invoke(() -> SecurityTestUtil.closeCache());
+    client2.invoke(() -> SecurityTestUtil.closeCache());
     SecurityTestUtil.closeCache();
     // then close the servers
-    server1.invoke(SecurityTestUtil.class, "closeCache");
-    server2.invoke(SecurityTestUtil.class, "closeCache");
+    server1.invoke(() -> SecurityTestUtil.closeCache());
+    server2.invoke(() -> SecurityTestUtil.closeCache());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
index 665867f..09dd49b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTestBase.java
@@ -798,10 +798,9 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
             opFlags), new Integer(expectedResult));
       }
       else {
-        clientVM.invoke(ClientAuthorizationTestBase.class, "doOp",
-            new Object[] { new Byte(opCode.toOrdinal()),
+        clientVM.invoke(() -> ClientAuthorizationTestBase.doOp( new Byte(opCode.toOrdinal()),
                 currentOp.getIndices(), new Integer(opFlags),
-                new Integer(expectedResult) });
+                new Integer(expectedResult) ));
       }
     }
   }
@@ -875,21 +874,19 @@ public class ClientAuthorizationTestBase extends DistributedTestCase {
           if (opBlock.size() > 0) {
             port1Keeper.release();
             // Start the first server and execute the operation block
-            server1.invoke(ClientAuthorizationTestBase.class,
-                "createCacheServer", new Object[] {
+            server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
                     SecurityTestUtil.getLocatorPort(), port1, serverProps,
-                    javaProps });
-            server2.invoke(SecurityTestUtil.class, "closeCache");
+                    javaProps ));
+            server2.invoke(() -> SecurityTestUtil.closeCache());
             executeOpBlock(opBlock, port1, port2, authInit, extraAuthProps,
                 extraAuthzProps, tgen, rnd);
             if (!currentOp.equals(OperationWithAction.OPBLOCK_NO_FAILOVER)) {
               // Failover to the second server and run the block again
               port2Keeper.release();
-              server2.invoke(ClientAuthorizationTestBase.class,
-                  "createCacheServer", new Object[] {
+              server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
                       SecurityTestUtil.getLocatorPort(), port2, serverProps,
-                      javaProps });
-              server1.invoke(SecurityTestUtil.class, "closeCache");
+                      javaProps ));
+              server1.invoke(() -> SecurityTestUtil.closeCache());
               executeOpBlock(opBlock, port1, port2, authInit, extraAuthProps,
                   extraAuthzProps, tgen, rnd);
             }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
index f175d98..fcf735c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/ClientMultiUserAuthzDUnitTest.java
@@ -53,12 +53,9 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
     client1 = host.getVM(2);
     client2 = host.getVM(3);
 
-    server1.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { serverExpectedExceptions });
-    server2.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { serverExpectedExceptions });
-    client2.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { clientExpectedExceptions });
+    server1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
+    server2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
+    client2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
     SecurityTestUtil.registerExpectedExceptions(clientExpectedExceptions);
   }
 
@@ -86,12 +83,10 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
           extraAuthProps, extraAuthzProps);
       Integer port1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
       Integer port2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-      server1.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
-          new Object[] {SecurityTestUtil.getLocatorPort(), port1, serverProps,
-              javaProps});
-      server2.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
-          new Object[] {SecurityTestUtil.getLocatorPort(), port2, serverProps,
-              javaProps});
+      server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(SecurityTestUtil.getLocatorPort(), port1, serverProps,
+              javaProps));
+      server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer(SecurityTestUtil.getLocatorPort(), port2, serverProps,
+              javaProps));
 
       if (!prepareClientsForOps(gen, cGen, new OperationCode[] {
           OperationCode.PUT, OperationCode.PUT}, new OperationCode[] {
@@ -316,7 +311,7 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
   }
 
   private void verifyGetAllInTX() {
-    server1.invoke(ClientMultiUserAuthzDUnitTest.class, "doPuts");
+    server1.invoke(() -> ClientMultiUserAuthzDUnitTest.doPuts());
     client1.invoke(SecurityTestUtil.class, "doMultiUserGetAll", new Object[] {
       Integer.valueOf(2),
       new Integer[] {SecurityTestUtil.NO_EXCEPTION,
@@ -324,7 +319,7 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
   }
 
   private void verifyGetAllRegionDestroys() {
-    server1.invoke(ClientMultiUserAuthzDUnitTest.class, "doPuts");
+    server1.invoke(() -> ClientMultiUserAuthzDUnitTest.doPuts());
     client1.invoke(SecurityTestUtil.class, "doMultiUserGetAll", new Object[] {
       Integer.valueOf(2),
       new Integer[] {SecurityTestUtil.NO_EXCEPTION,
@@ -364,12 +359,10 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
           extraAuthProps, extraAuthzProps);
       Integer port1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
       Integer port2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-      server1.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
-          new Object[] {SecurityTestUtil.getLocatorPort(), port1, serverProps,
-              javaProps});
-      server2.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
-          new Object[] {SecurityTestUtil.getLocatorPort(), port2, serverProps,
-              javaProps});
+      server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(SecurityTestUtil.getLocatorPort(), port1, serverProps,
+              javaProps));
+      server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer(SecurityTestUtil.getLocatorPort(), port2, serverProps,
+              javaProps));
 
       // Start client1 with valid/invalid QUERY credentials
       Properties[] client1Credentials = new Properties[] {
@@ -442,7 +435,7 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
           Boolean.FALSE});
 
       // Failover
-      server1.invoke(SecurityTestUtil.class, "closeCache");
+      server1.invoke(() -> SecurityTestUtil.closeCache());
       Thread.sleep(2000);
 
       client1.invoke(SecurityTestUtil.class, "doMultiUserPuts", new Object[] {
@@ -495,12 +488,10 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
           extraAuthProps, extraAuthzProps);
       Integer port1 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
       Integer port2 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-      server1.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
-          new Object[] {SecurityTestUtil.getLocatorPort(), port1, serverProps,
-              javaProps});
-      server2.invoke(ClientAuthorizationTestBase.class, "createCacheServer",
-          new Object[] {SecurityTestUtil.getLocatorPort(), port2, serverProps,
-              javaProps});
+      server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(SecurityTestUtil.getLocatorPort(), port1, serverProps,
+              javaProps));
+      server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer(SecurityTestUtil.getLocatorPort(), port2, serverProps,
+              javaProps));
 
       if (!prepareClientsForOps(gen, cGen, new OperationCode[] {
           OperationCode.PUT, OperationCode.PUT}, new OperationCode[] {
@@ -525,11 +516,11 @@ public class ClientMultiUserAuthzDUnitTest extends ClientAuthorizationTestBase {
   @Override
   protected final void preTearDown() throws Exception {
     // close the clients first
-    client1.invoke(SecurityTestUtil.class, "closeCache");
-    client2.invoke(SecurityTestUtil.class, "closeCache");
+    client1.invoke(() -> SecurityTestUtil.closeCache());
+    client2.invoke(() -> SecurityTestUtil.closeCache());
     SecurityTestUtil.closeCache();
     // then close the servers
-    server1.invoke(SecurityTestUtil.class, "closeCache");
-    server2.invoke(SecurityTestUtil.class, "closeCache");
+    server1.invoke(() -> SecurityTestUtil.closeCache());
+    server2.invoke(() -> SecurityTestUtil.closeCache());
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
index 2b44631..4408901 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientAuthorizationDUnitTest.java
@@ -106,24 +106,21 @@ public class DeltaClientAuthorizationDUnitTest extends
     client1 = host.getVM(2);
     client2 = host.getVM(3);
 
-    server1.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { serverExpectedExceptions });
-    server2.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { serverExpectedExceptions });
-    client2.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { clientExpectedExceptions });
+    server1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
+    server2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
+    client2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
     SecurityTestUtil.registerExpectedExceptions(clientExpectedExceptions);
   }
 
   @Override
   protected final void preTearDown() throws Exception {
     // close the clients first
-    client1.invoke(SecurityTestUtil.class, "closeCache");
-    client2.invoke(SecurityTestUtil.class, "closeCache");
+    client1.invoke(() -> SecurityTestUtil.closeCache());
+    client2.invoke(() -> SecurityTestUtil.closeCache());
     SecurityTestUtil.closeCache();
     // then close the servers
-    server1.invoke(SecurityTestUtil.class, "closeCache");
-    server2.invoke(SecurityTestUtil.class, "closeCache");
+    server1.invoke(() -> SecurityTestUtil.closeCache());
+    server2.invoke(() -> SecurityTestUtil.closeCache());
   }
 
   public void testAllowPutsGets() throws Exception {
@@ -144,12 +141,10 @@ public class DeltaClientAuthorizationDUnitTest extends
       // Start servers with all required properties
       Properties serverProps = buildProperties(authenticator, accessor, false,
           extraAuthProps, extraAuthzProps);
-      Integer port1 = ((Integer)server1.invoke(
-          ClientAuthorizationTestBase.class, "createCacheServer", new Object[] {
-              SecurityTestUtil.getLocatorPort(), serverProps, javaProps }));
-      Integer port2 = ((Integer)server2.invoke(
-          ClientAuthorizationTestBase.class, "createCacheServer", new Object[] {
-              SecurityTestUtil.getLocatorPort(), serverProps, javaProps }));
+      Integer port1 = ((Integer)server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
+              SecurityTestUtil.getLocatorPort(), serverProps, javaProps )));
+      Integer port2 = ((Integer)server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
+              SecurityTestUtil.getLocatorPort(), serverProps, javaProps )));
 
       // Start client1 with valid CREATE credentials
       Properties createCredentials = gen.getAllowedCredentials(
@@ -159,9 +154,8 @@ public class DeltaClientAuthorizationDUnitTest extends
       LogWriterUtils.getLogWriter().info(
           "testAllowPutsGets: For first client credentials: "
               + createCredentials);
-      client1.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, createCredentials, javaProps, port1, port2,
-              null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client1.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, createCredentials, javaProps, port1, port2,
+              null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Start client2 with valid GET credentials
       Properties getCredentials = gen.getAllowedCredentials(
@@ -172,19 +166,18 @@ public class DeltaClientAuthorizationDUnitTest extends
           .info(
               "testAllowPutsGets: For second client credentials: "
                   + getCredentials);
-      client2.invoke(ClientAuthenticationDUnitTest.class, "createCacheClient",
-          new Object[] { authInit, getCredentials, javaProps, port1, port2,
-              null, new Integer(SecurityTestUtil.NO_EXCEPTION) });
+      client2.invoke(() -> ClientAuthenticationDUnitTest.createCacheClient( authInit, getCredentials, javaProps, port1, port2,
+              null, new Integer(SecurityTestUtil.NO_EXCEPTION) ));
 
       // Perform some put operations from client1
-      client1.invoke(DeltaClientAuthorizationDUnitTest.class, "doPuts", new Object[] {
-          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION), Boolean.FALSE });
+      client1.invoke(() -> DeltaClientAuthorizationDUnitTest.doPuts(
+          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION), Boolean.FALSE ));
       Thread.sleep(5000);
-      assertTrue("Delta feature NOT used", (Boolean)client1.invoke(DeltaTestImpl.class, "toDeltaFeatureUsed"));
+      assertTrue("Delta feature NOT used", (Boolean)client1.invoke(() -> DeltaTestImpl.toDeltaFeatureUsed()));
 
       // Verify that the gets succeed
-      client2.invoke(DeltaClientAuthorizationDUnitTest.class, "doGets", new Object[] {
-          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION), Boolean.FALSE  });
+      client2.invoke(() -> DeltaClientAuthorizationDUnitTest.doGets(
+          new Integer(2), new Integer(SecurityTestUtil.NO_EXCEPTION), Boolean.FALSE  ));
   }
 
   public static void doPuts(Integer num, Integer expectedResult,

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientPostAuthorizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientPostAuthorizationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientPostAuthorizationDUnitTest.java
index fe3cec6..0e33a62 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientPostAuthorizationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/DeltaClientPostAuthorizationDUnitTest.java
@@ -68,24 +68,21 @@ public class DeltaClientPostAuthorizationDUnitTest extends
     client1 = host.getVM(2);
     client2 = host.getVM(3);
 
-    server1.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { serverExpectedExceptions });
-    server2.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { serverExpectedExceptions });
-    client2.invoke(SecurityTestUtil.class, "registerExpectedExceptions",
-        new Object[] { clientExpectedExceptions });
+    server1.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
+    server2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( serverExpectedExceptions ));
+    client2.invoke(() -> SecurityTestUtil.registerExpectedExceptions( clientExpectedExceptions ));
     SecurityTestUtil.registerExpectedExceptions(clientExpectedExceptions);
   }
 
   @Override
   protected final void preTearDown() throws Exception {
     // close the clients first
-    client1.invoke(SecurityTestUtil.class, "closeCache");
-    client2.invoke(SecurityTestUtil.class, "closeCache");
+    client1.invoke(() -> SecurityTestUtil.closeCache());
+    client2.invoke(() -> SecurityTestUtil.closeCache());
     SecurityTestUtil.closeCache();
     // then close the servers
-    server1.invoke(SecurityTestUtil.class, "closeCache");
-    server2.invoke(SecurityTestUtil.class, "closeCache");
+    server1.invoke(() -> SecurityTestUtil.closeCache());
+    server2.invoke(() -> SecurityTestUtil.closeCache());
   }
 
   public void testPutPostOpNotifications() throws Exception {
@@ -165,20 +162,18 @@ public class DeltaClientPostAuthorizationDUnitTest extends
           // on the servers with failover
           if (opBlock.size() > 0) {
             // Start the first server and execute the operation block
-            server1.invoke(ClientAuthorizationTestBase.class,
-                "createCacheServer", new Object[] {
+            server1.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
                     SecurityTestUtil.getLocatorPort(), port1, serverProps,
-                    javaProps });
-            server2.invoke(SecurityTestUtil.class, "closeCache");
+                    javaProps ));
+            server2.invoke(() -> SecurityTestUtil.closeCache());
             executeOpBlock(opBlock, port1, port2, authInit, extraAuthProps,
                 extraAuthzProps, tgen, rnd);
             if (!currentOp.equals(OperationWithAction.OPBLOCK_NO_FAILOVER)) {
               // Failover to the second server and run the block again
-              server2.invoke(ClientAuthorizationTestBase.class,
-                  "createCacheServer", new Object[] {
+              server2.invoke(() -> ClientAuthorizationTestBase.createCacheServer(
                       SecurityTestUtil.getLocatorPort(), port2, serverProps,
-                      javaProps });
-              server1.invoke(SecurityTestUtil.class, "closeCache");
+                      javaProps ));
+              server1.invoke(() -> SecurityTestUtil.closeCache());
               executeOpBlock(opBlock, port1, port2, authInit, extraAuthProps,
                   extraAuthzProps, tgen, rnd);
             }
@@ -289,10 +284,9 @@ public class DeltaClientPostAuthorizationDUnitTest extends
             opFlags), new Integer(expectedResult));
       }
       else {
-        clientVM.invoke(DeltaClientPostAuthorizationDUnitTest.class, "doOp",
-            new Object[] { new Byte(opCode.toOrdinal()),
+        clientVM.invoke(() -> DeltaClientPostAuthorizationDUnitTest.doOp( new Byte(opCode.toOrdinal()),
                 currentOp.getIndices(), new Integer(opFlags),
-                new Integer(expectedResult) });
+                new Integer(expectedResult) ));
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
index 07bd7c7..dd01b3b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
@@ -173,9 +173,9 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
             authInit);
     setProperty(props, DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME,
             authenticator);
-    locatorVM.invoke(SecurityTestUtil.class, "startLocator", new Object[]{
+    locatorVM.invoke(() -> SecurityTestUtil.startLocator(
             getUniqueName(), new Integer(port), props, javaProps,
-            expectedExceptions});
+            expectedExceptions));
 
     LogWriter dsLogger = LogWriterUtils.createLogWriter(props);
     SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
@@ -186,8 +186,8 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
       // success
     } finally {
       SecurityTestUtil.removeExpectedExceptions(expectedExceptions, dsLogger);
-      locatorVM.invoke(SecurityTestUtil.class, "stopLocator", new Object[]{
-              new Integer(port), expectedExceptions});
+      locatorVM.invoke(() -> SecurityTestUtil.stopLocator(
+              new Integer(port), expectedExceptions));
     }
 
   }
@@ -211,9 +211,9 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
             authInit);
     setProperty(props, DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME,
             authenticator);
-    locatorVM.invoke(SecurityTestUtil.class, "startLocator", new Object[] {
+    locatorVM.invoke(() -> SecurityTestUtil.startLocator(
             getUniqueName(), new Integer(port), props, javaProps,
-            expectedExceptions });
+            expectedExceptions ));
 
     LogWriter dsLogger = LogWriterUtils.createLogWriter(props);
     SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
@@ -226,8 +226,8 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
     }
     finally {
       SecurityTestUtil.removeExpectedExceptions(expectedExceptions, dsLogger);
-      locatorVM.invoke(SecurityTestUtil.class, "stopLocator", new Object[] {
-              new Integer(port), expectedExceptions });
+      locatorVM.invoke(() -> SecurityTestUtil.stopLocator(
+              new Integer(port), expectedExceptions ));
     }
   }
 
@@ -251,9 +251,9 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
             authInit);
     setProperty(props, DistributionConfig.SECURITY_PEER_AUTHENTICATOR_NAME,
             authenticator);
-    locatorVM.invoke(SecurityTestUtil.class, "startLocator", new Object[] {
+    locatorVM.invoke(() -> SecurityTestUtil.startLocator(
             getUniqueName(), new Integer(port), props, javaProps,
-            expectedExceptions });
+            expectedExceptions ));
 
     LogWriter dsLogger = LogWriterUtils.createLogWriter(props);
     SecurityTestUtil.addExpectedExceptions(expectedExceptions, dsLogger);
@@ -266,8 +266,8 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
     }
     finally {
       SecurityTestUtil.removeExpectedExceptions(expectedExceptions, dsLogger);
-      locatorVM.invoke(SecurityTestUtil.class, "stopLocator", new Object[] {
-              new Integer(port), expectedExceptions });
+      locatorVM.invoke(() -> SecurityTestUtil.stopLocator(
+              new Integer(port), expectedExceptions ));
     }
   }
 
@@ -292,17 +292,17 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
     Properties credentials = gen.getValidCredentials(1);
     Properties javaProps = gen.getJavaProperties();
     props.putAll(credentials);
-    locatorVM.invoke(SecurityTestUtil.class, "startLocator", new Object[] {
+    locatorVM.invoke(() -> SecurityTestUtil.startLocator(
             getUniqueName(), new Integer(port), props, javaProps,
-            expectedExceptions });
+            expectedExceptions ));
     try {
       createDS(props, javaProps);
       verifyMembers(new Integer(2));
       disconnectFromDS();
 
     } finally {
-      locatorVM.invoke(SecurityTestUtil.class, "stopLocator", new Object[] {
-              new Integer(port), expectedExceptions });
+      locatorVM.invoke(() -> SecurityTestUtil.stopLocator(
+              new Integer(port), expectedExceptions ));
     }
   }
 
@@ -331,9 +331,9 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
     Properties credentials = gen.getValidCredentials(1);
     Properties javaProps = gen.getJavaProperties();
     props.putAll(credentials);
-    locatorVM.invoke(SecurityTestUtil.class, "startLocator", new Object[] {
+    locatorVM.invoke(() -> SecurityTestUtil.startLocator(
             getUniqueName(), new Integer(port), props, javaProps,
-            expectedExceptions });
+            expectedExceptions ));
     try {
       // invalid credentials for the peer
       credentials = gen.getInvalidCredentials(1);
@@ -361,8 +361,8 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
       disconnectFromDS();
 
     } finally {
-      locatorVM.invoke(SecurityTestUtil.class, "stopLocator", new Object[] {
-              new Integer(port), expectedExceptions });
+      locatorVM.invoke(() -> SecurityTestUtil.stopLocator(
+              new Integer(port), expectedExceptions ));
     }
   }
 
@@ -411,9 +411,9 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
     Properties javaProps = gen.getJavaProperties();
     props.putAll(credentials);
     props.putAll(extraProps);
-    locatorVM.invoke(SecurityTestUtil.class, "startLocator", new Object[] {
+    locatorVM.invoke(() -> SecurityTestUtil.startLocator(
         getUniqueName(), new Integer(port), props, javaProps,
-        expectedExceptions });
+        expectedExceptions ));
     try {
 
     // Start the first peer with different authenticator
@@ -442,51 +442,42 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
     javaProps = gen.getJavaProperties();
     props.putAll(credentials);
     props.putAll(extraProps);
-    peer2.invoke(P2PAuthenticationDUnitTest.class, "createDS", new Object[] {
-        props, javaProps });
+    peer2.invoke(() -> P2PAuthenticationDUnitTest.createDS(
+        props, javaProps ));
 
     // Start the third peer with the same authenticator as locator
-    peer3.invoke(P2PAuthenticationDUnitTest.class, "createDS", new Object[] {
-        props, javaProps });
+    peer3.invoke(() -> P2PAuthenticationDUnitTest.createDS(
+        props, javaProps ));
 
     // wait for view propagation
     Wait.pause(2000);
     // Verify the number of members on all peers and locator
-    locatorVM.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(4) });
+    locatorVM.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(4) ));
     verifyMembers(new Integer(2));
-    peer2.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(4) });
-    peer3.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(4) });
+    peer2.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(4) ));
+    peer3.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(4) ));
 
     // Disconnect the first peer and check again
     disconnectFromDS();
     Wait.pause(2000);
-    locatorVM.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(3) });
-    peer2.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(3) });
-    peer3.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(3) });
+    locatorVM.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(3) ));
+    peer2.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(3) ));
+    peer3.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(3) ));
 
     // Disconnect the second peer and check again
-    peer2.invoke(DistributedTestCase.class, "disconnectFromDS");
+    peer2.invoke(() -> DistributedTestCase.disconnectFromDS());
     Wait.pause(2000);
-    locatorVM.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(2) });
-    peer3.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(2) });
+    locatorVM.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(2) ));
+    peer3.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(2) ));
 
     // Same for last peer
-    peer3.invoke(DistributedTestCase.class, "disconnectFromDS");
+    peer3.invoke(() -> DistributedTestCase.disconnectFromDS());
     Wait.pause(2000);
-    locatorVM.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(1) });
+    locatorVM.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(1) ));
 
     } finally {
-    locatorVM.invoke(SecurityTestUtil.class, "stopLocator", new Object[] {
-        new Integer(port), expectedExceptions });
+    locatorVM.invoke(() -> SecurityTestUtil.stopLocator(
+        new Integer(port), expectedExceptions ));
     }
   }
 
@@ -525,9 +516,9 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
     Properties javaProps = gen.getJavaProperties();
     props.putAll(credentials);
     props.putAll(extraProps);
-    locatorVM.invoke(SecurityTestUtil.class, "startLocator", new Object[] {
+    locatorVM.invoke(() -> SecurityTestUtil.startLocator(
         getUniqueName(), new Integer(port), props, javaProps,
-        expectedExceptions });
+        expectedExceptions ));
     try {
 
     // Start the first peer with huge credentials
@@ -576,33 +567,30 @@ public class P2PAuthenticationDUnitTest extends DistributedTestCase {
     javaProps = gen.getJavaProperties();
     props.putAll(credentials);
     props.putAll(extraProps);
-    peer2.invoke(P2PAuthenticationDUnitTest.class, "createDS", new Object[] {
-        props, javaProps });
+    peer2.invoke(() -> P2PAuthenticationDUnitTest.createDS(
+        props, javaProps ));
 
     // Start the third peer with the same authenticator as locator
-    peer3.invoke(P2PAuthenticationDUnitTest.class, "createDS", new Object[] {
-        props, javaProps });
+    peer3.invoke(() -> P2PAuthenticationDUnitTest.createDS(
+        props, javaProps ));
 
     // wait for view propagation
     Wait.pause(2000);
     // Verify the number of members on all peers and locator
-    locatorVM.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(4) });
-    peer2.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(4) });
-    peer3.invoke(P2PAuthenticationDUnitTest.class, "verifyMembers",
-        new Object[] { new Integer(4) });
+    locatorVM.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(4) ));
+    peer2.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(4) ));
+    peer3.invoke(() -> P2PAuthenticationDUnitTest.verifyMembers( new Integer(4) ));
 
 
     // Disconnect the peers
     disconnectFromDS();
-    peer2.invoke(DistributedTestCase.class, "disconnectFromDS");
-    peer3.invoke(DistributedTestCase.class, "disconnectFromDS");
+    peer2.invoke(() -> DistributedTestCase.disconnectFromDS());
+    peer3.invoke(() -> DistributedTestCase.disconnectFromDS());
 
     } finally {
     // Stopping the locator
-    locatorVM.invoke(SecurityTestUtil.class, "stopLocator", new Object[] {
-        new Integer(port), expectedExceptions });
+    locatorVM.invoke(() -> SecurityTestUtil.stopLocator(
+        new Integer(port), expectedExceptions ));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/AsyncInvocation.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/AsyncInvocation.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/AsyncInvocation.java
index 544638e..a612f87 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/AsyncInvocation.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/AsyncInvocation.java
@@ -31,8 +31,8 @@ import com.gemstone.gemfire.SystemFailure;
  * <code>AsyncInvocation</code> can be used as follows:</P>
  *
  * <PRE>
- *   AsyncInvocation ai1 = vm.invokeAsync(Test.class, "method1");
- *   AsyncInvocation ai2 = vm.invokeAsync(Test.class, "method2");
+ *   AsyncInvocation ai1 = vm.invokeAsync(() -> Test.method1());
+ *   AsyncInvocation ai2 = vm.invokeAsync(() -> Test.method2());
  *
  *   ai1.join();
  *   ai2.join();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/RMIException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/RMIException.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/RMIException.java
index 1a5fac4..3e2915a 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/RMIException.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/RMIException.java
@@ -27,7 +27,7 @@ import com.gemstone.gemfire.GemFireException;
  * <PRE>
  *     VM vm0 = host0.getVM(0);
  *     try {
- *       vm.invoke(this.getClass(), "getUnknownObject");
+ *       vm.invoke(() -> this.getUnknownObject());
  *
  *     } catch (RMIException ex) {
  *       assertEquals(ex.getCause() instanceof ObjectException);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/BasicDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/BasicDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/BasicDUnitTest.java
index f9d033c..068e81b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/BasicDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/BasicDUnitTest.java
@@ -44,14 +44,14 @@ public class BasicDUnitTest extends DistributedTestCase {
   public void _testDontCatchRemoteException() {
     Host host = Host.getHost(0);
     VM vm = host.getVM(0);
-    vm.invoke(this.getClass(), "remoteThrowException");
+    vm.invoke(() -> this.remoteThrowException());
   }
 
   public void testRemoteInvocationWithException() {
     Host host = Host.getHost(0);
     VM vm = host.getVM(0);
     try {
-      vm.invoke(this.getClass(), "remoteThrowException");
+      vm.invoke(() -> this.remoteThrowException());
       fail("Should have thrown a BasicTestException");
 
     } catch (RMIException ex) {
@@ -113,16 +113,14 @@ public class BasicDUnitTest extends DistributedTestCase {
     String value = "Hello";
 
     AsyncInvocation ai =
-      vm.invokeAsync(this.getClass(), "remoteBind", 
-                     new Object[] { name, value });
+      vm.invokeAsync(() -> this.remoteBind( name, value ));
     ai.join();
     // TODO shouldn't we call fail() here?
     if (ai.exceptionOccurred()) {
       Assert.fail("remoteBind failed", ai.getException());
     }
 
-    ai = vm.invokeAsync(this.getClass(), "remoteValidateBind",
-                        new Object[] {name, value });
+    ai = vm.invokeAsync(() -> this.remoteValidateBind(name, value ));
     ai.join();
     if (ai.exceptionOccurred()) {
       Assert.fail("remoteValidateBind failed", ai.getException());
@@ -149,7 +147,7 @@ public class BasicDUnitTest extends DistributedTestCase {
 //    String value = "Hello";
 
     AsyncInvocation ai =
-      vm.invokeAsync(this.getClass(), "remoteThrowException");
+      vm.invokeAsync(() -> this.remoteThrowException());
     ai.join();
     assertTrue(ai.exceptionOccurred());
     Throwable ex = ai.getException();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/VMDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/VMDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/VMDUnitTest.java
index b9cce7f..9cea1cc 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/VMDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/VMDUnitTest.java
@@ -46,7 +46,7 @@ public class VMDUnitTest extends DistributedTestCase {
     Host host = Host.getHost(0);
     VM vm = host.getVM(0);
     try {
-      vm.invoke(VMDUnitTest.class, "nonExistentMethod");
+      vm.invoke(() -> VMDUnitTest.nonExistentMethod());
       fail("Should have thrown an RMIException");
 
     } catch (RMIException ex) {
@@ -68,7 +68,7 @@ public class VMDUnitTest extends DistributedTestCase {
     Host host = Host.getHost(0);
     VM vm = host.getVM(0);
     assertEquals(BOOLEAN_VALUE,
-                 vm.invokeBoolean(VMDUnitTest.class, "remoteBooleanMethod")); 
+                 vm.invoke(() -> VMDUnitTest.remoteBooleanMethod())); 
   }
 
   /**
@@ -83,7 +83,7 @@ public class VMDUnitTest extends DistributedTestCase {
     Host host = Host.getHost(0);
     VM vm = host.getVM(0);
     try {
-      vm.invokeBoolean(VMDUnitTest.class, "remoteByteMethod");
+      vm.invoke(() -> VMDUnitTest.remoteByteMethod());
       fail("Should have thrown an IllegalArgumentException");
 
     } catch (IllegalArgumentException ex) {
@@ -95,7 +95,7 @@ public class VMDUnitTest extends DistributedTestCase {
     Host host = Host.getHost(0);
     VM vm = host.getVM(0);
     assertEquals(LONG_VALUE,
-                 vm.invokeLong(VMDUnitTest.class, "remoteLongMethod")); 
+                 vm.invoke(() -> VMDUnitTest.remoteLongMethod())); 
   }
 
   /**
@@ -110,7 +110,7 @@ public class VMDUnitTest extends DistributedTestCase {
     Host host = Host.getHost(0);
     VM vm = host.getVM(0);
     try {
-      vm.invokeLong(VMDUnitTest.class, "remoteByteMethod");
+      vm.invoke(() -> VMDUnitTest.remoteByteMethod());
       fail("Should have thrown an IllegalArgumentException");
 
     } catch (IllegalArgumentException ex) {
@@ -212,19 +212,19 @@ public class VMDUnitTest extends DistributedTestCase {
     final Host host = Host.getHost(0);
     final VM vm = host.getVM(0);
     // Assert class static invocation works
-    AsyncInvocation a1 = vm.invokeAsync(getClass(), "getAndIncStaticCount");
+    AsyncInvocation a1 = vm.invokeAsync(() -> getAndIncStaticCount());
     a1.join();
     assertEquals(new Integer(0), a1.getReturnValue());
     // Assert class static invocation with args works
-    a1 = vm.invokeAsync(getClass(), "incrementStaticCount", new Object[] {new Integer(2)});
+    a1 = vm.invokeAsync(() -> incrementStaticCount(new Integer(2)));
     a1.join();
     assertEquals(new Integer(3), a1.getReturnValue());
     // Assert that previous values are not returned when invoking method w/ no return val
-    a1 = vm.invokeAsync(getClass(), "incStaticCount");
+    a1 = vm.invokeAsync(() -> incStaticCount());
     a1.join();
     assertNull(a1.getReturnValue());
     // Assert that previous null returns are over-written 
-    a1 = vm.invokeAsync(getClass(), "getAndIncStaticCount");
+    a1 = vm.invokeAsync(() -> getAndIncStaticCount());
     a1.join();
     assertEquals(new Integer(4), a1.getReturnValue());
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataDUnitTest.java
index 5850e6f..ebc6f53 100644
--- a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataDUnitTest.java
+++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataDUnitTest.java
@@ -94,8 +94,7 @@ public class CqDataDUnitTest extends CacheTestCase {
 
     cqDUnitTest.createServer(server);
 
-    final int port = server.invokeInt(CqQueryDUnitTest.class,
-        "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
 
     // Create client.
@@ -141,13 +140,13 @@ public class CqDataDUnitTest extends CacheTestCase {
     IgnoredException.addIgnoredException("Could not find any server");
     cqDUnitTest.createServer(server1);
     
-    final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server1.getHost());
     
     final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
     
     cqDUnitTest.createServer(server2, ports[0]);
-    final int port2 = server2.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port2 = server2.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
             
     // Create client - With 3 server endpoints and redundancy level set to 2.
     
@@ -206,7 +205,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     
     // UPDATE with stop.
     cqDUnitTest.createServer(server3, ports[1]);
-    server3.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    server3.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     Wait.pause(2 * 1000);
     
     cqDUnitTest.clearCQListenerEvents(client, "testCQHAWithState_0");
@@ -257,8 +256,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     VM client = host.getVM(1);
     VM producer = host.getVM(2);
     cqDUnitTest.createServer(server, 0, true);
-    final int port = server.invokeInt(CqQueryDUnitTest.class,
-        "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
 
     // Create client.
@@ -333,7 +331,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     
     /* Create Server and Client */
     cqDUnitTest.createServer(server);
-    final int port = server.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
     cqDUnitTest.createClient(client1, port, host0);
     cqDUnitTest.createClient(client2, port, host0);
@@ -402,7 +400,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
     cqDUnitTest.createServer(server2, 0, false, MirrorType.KEYS);
         
-    final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server1.getHost());
       
     cqDUnitTest.createClient(client, port1, host0);
@@ -478,7 +476,7 @@ public class CqDataDUnitTest extends CacheTestCase {
       }
     });
         
-    final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server1.getHost());
       
     cqDUnitTest.createClient(client, port1, host0);
@@ -520,7 +518,7 @@ public class CqDataDUnitTest extends CacheTestCase {
 
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
 
-    final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String serverHost = NetworkUtils.getServerHostName(server1.getHost());
 
     final String[] regions = cqDUnitTest.regions;
@@ -578,7 +576,7 @@ public class CqDataDUnitTest extends CacheTestCase {
 
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
 
-    final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String serverHost = NetworkUtils.getServerHostName(server1.getHost());
 
     final String[] regions = cqDUnitTest.regions;
@@ -633,7 +631,7 @@ public class CqDataDUnitTest extends CacheTestCase {
 
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
 
-    final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String serverHost = NetworkUtils.getServerHostName(server1.getHost());
 
     final String[] regions = cqDUnitTest.regions;
@@ -687,7 +685,7 @@ public class CqDataDUnitTest extends CacheTestCase {
 
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
 
-    final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String serverHost = NetworkUtils.getServerHostName(server1.getHost());
 
     final String[] regions = cqDUnitTest.regions;
@@ -752,7 +750,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     VM client = host.getVM(1);
     
     cqDUnitTest.createServer(server);
-    final int port = server.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
     
     cqDUnitTest.createClient(client, port, host0);
@@ -833,7 +831,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     VM client = host.getVM(1);
     final String cqName = "testEventsDuringQueryExecution_0";
     cqDUnitTest.createServer(server);
-    final int port = server.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
     
     // Initialize Client.
@@ -972,8 +970,7 @@ public class CqDataDUnitTest extends CacheTestCase {
 
     // initialize server and retreive host and port values
     cqDUnitTest.createServer(server);
-    final int port = server.invokeInt(CqQueryDUnitTest.class,
-        "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
 
     // Initialize Client.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataUsingPoolDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataUsingPoolDUnitTest.java
index 82d6279..a329a2b 100644
--- a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataUsingPoolDUnitTest.java
+++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataUsingPoolDUnitTest.java
@@ -112,8 +112,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
 
     cqDUnitTest.createServer(server);
 
-    final int port = server.invokeInt(CqQueryUsingPoolDUnitTest.class,
-        "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
 
     String poolName = "testClientWithFeederAndCQ";
@@ -160,13 +159,13 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     
     cqDUnitTest.createServer(server1);
     
-    final int port1 = server1.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server1.getHost());
     
     final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
     
     cqDUnitTest.createServer(server2, ports[0]);
-    final int port2 = server2.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    final int port2 = server2.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
             
     // Create client - With 3 server endpoints and redundancy level set to 2.
     
@@ -228,7 +227,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     
     // UPDATE with stop.
     cqDUnitTest.createServer(server3, ports[1]);
-    server3.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    server3.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     Wait.pause(2 * 1000);
     
     cqDUnitTest.clearCQListenerEvents(client, "testCQHAWithState_0");
@@ -278,8 +277,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     VM client = host.getVM(1);
     VM producer = host.getVM(2);
     cqDUnitTest.createServer(server, 0, true);
-    final int port = server.invokeInt(CqQueryUsingPoolDUnitTest.class,
-        "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
 
     String poolName = "testCQWithDestroysAndInvalidates";
@@ -358,7 +356,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     
     /* Create Server and Client */
     cqDUnitTest.createServer(server);
-    final int port = server.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
 
     String poolName1 = "testCQWithMultipleClients1";
@@ -434,7 +432,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
     cqDUnitTest.createServer(server2, 0, false, MirrorType.KEYS);
         
-    final int port1 = server1.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server1.getHost());
     
     String poolName = "testCQWithLoad";
@@ -516,7 +514,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
 
     cqDUnitTest.createServer(server2, 0, false, MirrorType.NONE);
         
-    final int port1 = server1.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server1.getHost());
       
     String poolName = "testCQWithEviction";
@@ -597,7 +595,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
 
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
 
-    final int port1 = server1.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    final int port1 = server1.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String serverHost = NetworkUtils.getServerHostName(server1.getHost());
 
 //    final String[] regions = cqDUnitTest.regions;
@@ -647,7 +645,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     VM client = host.getVM(1);
     
     cqDUnitTest.createServer(server);
-    final int port = server.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
     
     String poolName = "testRegionEvents";
@@ -731,7 +729,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     final String cqName = "testEventsDuringQueryExecution_0";
     cqDUnitTest.createServer(server);
     
-    final int port = server.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
  
     String poolName = "testEventsDuringQueryExecution";
@@ -869,17 +867,14 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     VM client2 = host.getVM(2);
  
     // Start server 1
-    final int server1Port = ((Integer) server.invoke(CacheServerTestUtil.class,
-        "createCacheServer", new Object[] {regionName, new Boolean(true)}))
+    final int server1Port = ((Integer) server.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true))))
         .intValue();
     
     // Start a  client
-    client.invoke(CacheServerTestUtil.class, "createCacheClient", 
-        new Object[] {getClientPool(NetworkUtils.getServerHostName(client.getHost()), server1Port), regionName});
+    client.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(client.getHost()), server1Port), regionName));
     
     // Start a pub client
-    client2.invoke(CacheServerTestUtil.class, "createCacheClient", 
-        new Object[] {getClientPool(NetworkUtils.getServerHostName(client2.getHost()), server1Port), regionName});
+    client2.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(client2.getHost()), server1Port), regionName));
     
     //client has thread that invokes new and remove cq over and over
     client.invokeAsync(new CacheSerializableRunnable("Register cq") {
@@ -929,9 +924,9 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
       }
     });
     
-    client.invoke(CacheServerTestUtil.class, "closeCache");
-    client2.invoke(CacheServerTestUtil.class, "closeCache");
-    server.invoke(CacheServerTestUtil.class, "closeCache");
+    client.invoke(() -> CacheServerTestUtil.closeCache());
+    client2.invoke(() -> CacheServerTestUtil.closeCache());
+    server.invoke(() -> CacheServerTestUtil.closeCache());
   }
   
   public void testGetDurableCQsFromPoolOnly() throws Exception {
@@ -943,7 +938,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     
     /* Create Server and Client */
     cqDUnitTest.createServer(server);
-    final int port = server.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
   
     final String poolName1 = "pool1";
@@ -1082,7 +1077,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     
     /* Create Server and Client */
     cqDUnitTest.createServer(server);
-    final int port = server.invokeInt(CqQueryUsingPoolDUnitTest.class, "getCacheServerPort");
+    final int port = server.invoke(() -> CqQueryUsingPoolDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server.getHost());
   
     final String poolName1 = "pool1";
@@ -1125,17 +1120,14 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     VM client2 = host.getVM(2);
  
     // Start server 1
-    final int server1Port = ((Integer) server.invoke(CacheServerTestUtil.class,
-        "createCacheServer", new Object[] {regionName, new Boolean(true)}))
+    final int server1Port = ((Integer) server.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true))))
         .intValue();
     
     // Start client 1
-    client1.invoke(CacheServerTestUtil.class, "createClientCache", 
-        new Object[] {getClientPool(NetworkUtils.getServerHostName(client1.getHost()), server1Port), regionName});
+    client1.invoke(() -> CacheServerTestUtil.createClientCache(getClientPool(NetworkUtils.getServerHostName(client1.getHost()), server1Port), regionName));
     
     // Start client 2
-    client2.invoke(CacheServerTestUtil.class, "createClientCache", 
-        new Object[] {getClientPool(NetworkUtils.getServerHostName(client2.getHost()), server1Port), regionName});
+    client2.invoke(() -> CacheServerTestUtil.createClientCache(getClientPool(NetworkUtils.getServerHostName(client2.getHost()), server1Port), regionName));
     
     createClient1CqsAndDurableCqs(client1, regionName);
     createClient2CqsAndDurableCqs(client2, regionName);
@@ -1174,9 +1166,9 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
       }
     });
     
-    client1.invoke(CacheServerTestUtil.class, "closeCache");
-    client2.invoke(CacheServerTestUtil.class, "closeCache");
-    server.invoke(CacheServerTestUtil.class, "closeCache");
+    client1.invoke(() -> CacheServerTestUtil.closeCache());
+    client2.invoke(() -> CacheServerTestUtil.closeCache());
+    server.invoke(() -> CacheServerTestUtil.closeCache());
   }
   
   public void testGetDurableCqsFromServerCycleClients() {
@@ -1187,17 +1179,14 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     VM client2 = host.getVM(2);
     int timeout = 60000;
     // Start server 1
-    final int server1Port = ((Integer) server.invoke(CacheServerTestUtil.class,
-        "createCacheServer", new Object[] {regionName, new Boolean(true)}))
+    final int server1Port = ((Integer) server.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true))))
         .intValue();
     
     // Start client 1
-    client1.invoke(CacheServerTestUtil.class, "createClientCache", 
-        new Object[] {getClientPool(NetworkUtils.getServerHostName(client1.getHost()), server1Port), regionName, getDurableClientProperties("client1_dc", timeout)});
+    client1.invoke(() -> CacheServerTestUtil.createClientCache(getClientPool(NetworkUtils.getServerHostName(client1.getHost()), server1Port), regionName, getDurableClientProperties("client1_dc", timeout)));
     
     // Start client 2
-    client2.invoke(CacheServerTestUtil.class, "createClientCache", 
-        new Object[] {getClientPool(NetworkUtils.getServerHostName(client2.getHost()), server1Port), regionName, getDurableClientProperties("client2_dc", timeout)});
+    client2.invoke(() -> CacheServerTestUtil.createClientCache(getClientPool(NetworkUtils.getServerHostName(client2.getHost()), server1Port), regionName, getDurableClientProperties("client2_dc", timeout)));
     
     createClient1CqsAndDurableCqs(client1, regionName);
     createClient2CqsAndDurableCqs(client2, regionName);
@@ -1239,9 +1228,9 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
       }
     });
     
-    client1.invoke(CacheServerTestUtil.class, "closeCache");
-    client2.invoke(CacheServerTestUtil.class, "closeCache");
-    server.invoke(CacheServerTestUtil.class, "closeCache");
+    client1.invoke(() -> CacheServerTestUtil.closeCache());
+    client2.invoke(() -> CacheServerTestUtil.closeCache());
+    server.invoke(() -> CacheServerTestUtil.closeCache());
   }
   
   public void testGetDurableCqsFromServerCycleClientsAndMoreCqs() {
@@ -1252,17 +1241,14 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
     VM client2 = host.getVM(2);
     int timeout = 60000;
     // Start server 1
-    final int server1Port = ((Integer) server.invoke(CacheServerTestUtil.class,
-        "createCacheServer", new Object[] {regionName, new Boolean(true)}))
+    final int server1Port = ((Integer) server.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true))))
         .intValue();
     
     // Start client 1
-    client1.invoke(CacheServerTestUtil.class, "createClientCache", 
-        new Object[] {getClientPool(NetworkUtils.getServerHostName(client1.getHost()), server1Port), regionName, getDurableClientProperties("client1_dc", timeout)});
+    client1.invoke(() -> CacheServerTestUtil.createClientCache(getClientPool(NetworkUtils.getServerHostName(client1.getHost()), server1Port), regionName, getDurableClientProperties("client1_dc", timeout)));
     
     // Start client 2
-    client2.invoke(CacheServerTestUtil.class, "createClientCache", 
-        new Object[] {getClientPool(NetworkUtils.getServerHostName(client2.getHost()), server1Port), regionName, getDurableClientProperties("client2_dc", timeout)});
+    client2.invoke(() -> CacheServerTestUtil.createClientCache(getClientPool(NetworkUtils.getServerHostName(client2.getHost()), server1Port), regionName, getDurableClientProperties("client2_dc", timeout)));
     
     //create the test cqs
     createClient1CqsAndDurableCqs(client1, regionName);
@@ -1375,9 +1361,9 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
       }
     });
     
-    client1.invoke(CacheServerTestUtil.class, "closeCache");
-    client2.invoke(CacheServerTestUtil.class, "closeCache");
-    server.invoke(CacheServerTestUtil.class, "closeCache");
+    client1.invoke(() -> CacheServerTestUtil.closeCache());
+    client2.invoke(() -> CacheServerTestUtil.closeCache());
+    server.invoke(() -> CacheServerTestUtil.closeCache());
   }
   
   private Properties getDurableClientProperties(String durableClientId, int durableClientTimeout) {
@@ -1462,8 +1448,7 @@ public class CqDataUsingPoolDUnitTest extends CacheTestCase {
       }
     });
     
-    client.invoke(CacheServerTestUtil.class, "createClientCache", 
-        new Object[] {getClientPool(NetworkUtils.getServerHostName(client.getHost()), serverPort), regionName, getDurableClientProperties(dcName, durableClientTimeout)});
+    client.invoke(() -> CacheServerTestUtil.createClientCache(getClientPool(NetworkUtils.getServerHostName(client.getHost()), serverPort), regionName, getDurableClientProperties(dcName, durableClientTimeout)));
   }
   
 


Mime
View raw message