http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientTestCase.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientTestCase.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientTestCase.java index f9d73e0..3be13ec 100755 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientTestCase.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/DurableClientTestCase.java @@ -110,10 +110,10 @@ public class DurableClientTestCase extends DistributedTestCase { protected final void preTearDown() throws Exception { preTearDownDurableClientTestCase(); - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache"); - this.publisherClientVM.invoke(CacheServerTestUtil.class, "closeCache"); - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); - this.server2VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache()); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.closeCache()); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); + this.server2VM.invoke(() -> CacheServerTestUtil.closeCache()); } protected void preTearDownDurableClientTestCase() throws Exception { @@ -124,15 +124,13 @@ public class DurableClientTestCase extends DistributedTestCase { */ public void testSimpleDurableClient() { // Start a server - int serverPort = ((Integer) this.server1VM.invoke(CacheServerTestUtil.class, - "createCacheServer", new Object[] {regionName, new Boolean(true)})) + int serverPort = ((Integer) this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true)))) .intValue(); // Start a durable client that is not kept alive on the server when it // stops normally final String durableClientId = getName() + "_client"; - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId)}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId))); // Send clientReady message this.durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -164,7 +162,7 @@ public class DurableClientTestCase extends DistributedTestCase { this.verifySimpleDurableClient(); // Stop the server - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); this.closeDurableClient(); @@ -181,14 +179,13 @@ public class DurableClientTestCase extends DistributedTestCase { try { // Start a server - int serverPort = ((Integer) this.server1VM.invoke(CacheServerTestUtil.class, "createCacheServer", new Object[] { regionName, new Boolean(true) })).intValue(); + int serverPort = ((Integer) this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServer( regionName, new Boolean(true) ))).intValue(); // Start a durable client that is not kept alive on the server when it // stops normally final String durableClientId = getName() + "_client"; - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] { getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId), new Boolean(false), jp }); + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient( getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId), new Boolean(false), jp )); // Send clientReady message this.durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -228,13 +225,12 @@ public class DurableClientTestCase extends DistributedTestCase { this.verifySimpleDurableClient(); // Stop the server - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); this.closeDurableClient(); } finally { - this.durableClientVM.invoke(CacheServerTestUtil.class, "unsetJavaSystemProperties", - new Object[] {jp}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.unsetJavaSystemProperties(jp)); } } @@ -251,7 +247,7 @@ public class DurableClientTestCase extends DistributedTestCase { public void disconnectDurableClient(boolean keepAlive) { printClientProxyState("Before"); - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache",new Object[] {new Boolean(keepAlive)}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache(new Boolean(keepAlive))); Wait.pause(1000); printClientProxyState("after"); } @@ -311,8 +307,7 @@ public class DurableClientTestCase extends DistributedTestCase { */ public void testStartStopStartDurableClient() { // Start a server - int serverPort = ((Integer) this.server1VM.invoke(CacheServerTestUtil.class, - "createCacheServer", new Object[] {regionName, new Boolean(true)})) + int serverPort = ((Integer) this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true)))) .intValue(); // Start a durable client that is kept alive on the server when it stops @@ -320,8 +315,7 @@ public class DurableClientTestCase extends DistributedTestCase { final String durableClientId = getName() + "_client"; final int durableClientTimeout = 60; // keep the client alive for 60 seconds //final boolean durableClientKeepAlive = true; // keep the client alive when it stops normally - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout)}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout))); // Send clientReady message this.durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -381,10 +375,10 @@ public class DurableClientTestCase extends DistributedTestCase { }); // Stop the durable client - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the server - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); } /** @@ -394,8 +388,7 @@ public class DurableClientTestCase extends DistributedTestCase { */ public void test39630() { // Start a server - int serverPort = ((Integer) this.server1VM.invoke(CacheServerTestUtil.class, - "createCacheServer", new Object[] {regionName, new Boolean(true)})) + int serverPort = ((Integer) this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true)))) .intValue(); // Start a durable client that is kept alive on the server when it stops @@ -403,8 +396,7 @@ public class DurableClientTestCase extends DistributedTestCase { final String durableClientId = getName() + "_client"; final int durableClientTimeout = 60; // keep the client alive for 60 seconds //final boolean durableClientKeepAlive = true; // keep the client alive when it stops normally - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout)}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout))); // // Send clientReady message // this.durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -459,10 +451,10 @@ public class DurableClientTestCase extends DistributedTestCase { durableClientTimeout) }); // Stop the durable client - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the server - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); } public void restartDurableClient(Object[] args) @@ -483,8 +475,7 @@ public class DurableClientTestCase extends DistributedTestCase { */ public void testStartStopTimeoutDurableClient() { // Start a server - int serverPort = ((Integer) this.server1VM.invoke(CacheServerTestUtil.class, - "createCacheServer", new Object[] {regionName, new Boolean(true)})) + int serverPort = ((Integer) this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true)))) .intValue(); // Start a durable client that is kept alive on the server when it stops @@ -492,8 +483,7 @@ public class DurableClientTestCase extends DistributedTestCase { final String durableClientId = getName() + "_client"; final int durableClientTimeout = 5; // keep the client alive for 5 seconds //final boolean durableClientKeepAlive = true; // keep the client alive when it stops normally - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout)}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout))); // Send clientReady message this.durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -555,10 +545,10 @@ public class DurableClientTestCase extends DistributedTestCase { durableClientTimeout) }); // Stop the durable client - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the server - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); } /** @@ -566,8 +556,7 @@ public class DurableClientTestCase extends DistributedTestCase { */ public void testDurableClientPrimaryUpdate() { // Start a server - int serverPort = ((Integer) this.server1VM.invoke(CacheServerTestUtil.class, - "createCacheServer", new Object[] {regionName, new Boolean(true)})) + int serverPort = ((Integer) this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true)))) .intValue(); // Start a durable client that is kept alive on the server when it stops @@ -575,8 +564,7 @@ public class DurableClientTestCase extends DistributedTestCase { final String durableClientId = getName() + "_client"; final int durableClientTimeout = 120; // keep the client alive for 60 seconds //final boolean durableClientKeepAlive = true; // keep the client alive when it stops normally - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout), Boolean.TRUE}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout), Boolean.TRUE)); // Send clientReady message this.durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -598,8 +586,7 @@ public class DurableClientTestCase extends DistributedTestCase { }); // Start normal publisher client - this.publisherClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(publisherClientVM.getHost()), serverPort, false), regionName}); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(publisherClientVM.getHost()), serverPort, false), regionName)); // Publish some entries final int numberOfEntries = 1; @@ -723,13 +710,13 @@ public class DurableClientTestCase extends DistributedTestCase { this.verifyListenerUpdates(numberOfEntries, numberOfEntries); // Stop the publisher client - this.publisherClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the durable client VM - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the server - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); } /** @@ -737,8 +724,7 @@ public class DurableClientTestCase extends DistributedTestCase { */ public void testStartStopStartDurableClientUpdate() { // Start a server - int serverPort = ((Integer) this.server1VM.invoke(CacheServerTestUtil.class, - "createCacheServer", new Object[] {regionName, new Boolean(true)})) + int serverPort = ((Integer) this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true)))) .intValue(); // Start a durable client that is kept alive on the server when it stops @@ -746,8 +732,7 @@ public class DurableClientTestCase extends DistributedTestCase { final String durableClientId = getName() + "_client"; final int durableClientTimeout = 60; // keep the client alive for 60 seconds //final boolean durableClientKeepAlive = true; // keep the client alive when it stops normally - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout), Boolean.TRUE}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId, durableClientTimeout), Boolean.TRUE)); // Send clientReady message this.durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -769,8 +754,7 @@ public class DurableClientTestCase extends DistributedTestCase { }); // Start normal publisher client - this.publisherClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(publisherClientVM.getHost()), serverPort, false), regionName}); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(publisherClientVM.getHost()), serverPort, false), regionName)); // Publish some entries final int numberOfEntries = 1; @@ -879,13 +863,13 @@ public class DurableClientTestCase extends DistributedTestCase { this.verifyListenerUpdates(numberOfEntries, numberOfEntries); // Stop the publisher client - this.publisherClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the durable client VM - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the server - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); } public void verifyListenerUpdates(int numEntries) @@ -954,15 +938,13 @@ public class DurableClientTestCase extends DistributedTestCase { public void testDurableClientConnectServerStopStart() { // Start a server // Start server 1 - Integer[] ports = ((Integer[]) this.server1VM.invoke(CacheServerTestUtil.class, - "createCacheServerReturnPorts", new Object[] {regionName, new Boolean(true)})); + Integer[] ports = ((Integer[]) this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServerReturnPorts(regionName, new Boolean(true)))); final int serverPort = ports[0].intValue(); // Start a durable client that is not kept alive on the server when it // stops normally final String durableClientId = getName() + "_client"; - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId), Boolean.TRUE}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort, true), regionName, getClientDistributedSystemProperties(durableClientId), Boolean.TRUE)); // Send clientReady message this.durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -999,12 +981,11 @@ public class DurableClientTestCase extends DistributedTestCase { }); // Stop the server - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); // Re-start the server - this.server1VM.invoke(CacheServerTestUtil.class, "createCacheServer", - new Object[] {regionName, new Boolean(true), - new Integer(serverPort)}); + this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true), + new Integer(serverPort))); // Pause 10 seconds to allow client to reconnect to server // no need for the explicit pause since checkNumberOfClientProxies @@ -1027,8 +1008,7 @@ public class DurableClientTestCase extends DistributedTestCase { }); // Start a publisher - this.publisherClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(publisherClientVM.getHost()), serverPort, false), regionName}); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(publisherClientVM.getHost()), serverPort, false), regionName)); // Publish some messages // Publish some entries @@ -1063,13 +1043,13 @@ public class DurableClientTestCase extends DistributedTestCase { }); // Stop the durable client - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the publisher client - this.publisherClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the server - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); } @Ignore("This test is failing inconsistently, see bug 51258") @@ -1096,17 +1076,15 @@ public class DurableClientTestCase extends DistributedTestCase { public void durableFailover(int redundancyLevel) throws InterruptedException { // Start server 1 - Integer[] ports = ((Integer[]) this.server1VM.invoke(CacheServerTestUtil.class, - "createCacheServerReturnPorts", new Object[] {regionName, new Boolean(true)})); + Integer[] ports = ((Integer[]) this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServerReturnPorts(regionName, new Boolean(true)))); final int server1Port = ports[0].intValue(); // Start server 2 using the same mcast port as server 1 - final int server2Port = ((Integer) this.server2VM.invoke(CacheServerTestUtil.class, - "createCacheServer", new Object[] {regionName, new Boolean(true)})) + final int server2Port = ((Integer) this.server2VM.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true)))) .intValue(); // Stop server 2 - this.server2VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server2VM.invoke(() -> CacheServerTestUtil.closeCache()); // Start a durable client final String durableClientId = getName() + "_client"; @@ -1119,10 +1097,9 @@ public class DurableClientTestCase extends DistributedTestCase { clientPool = getClientPool(NetworkUtils.getServerHostName(Host.getHost(0)), server1Port, server2Port, true, 0); } - this.durableClientVM.invoke(CacheServerTestUtil.class, "disableShufflingOfEndpoints"); - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {clientPool, regionName, - getClientDistributedSystemProperties(durableClientId, durableClientTimeout), Boolean.TRUE}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.disableShufflingOfEndpoints()); + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(clientPool, regionName, + getClientDistributedSystemProperties(durableClientId, durableClientTimeout), Boolean.TRUE)); // Send clientReady message this.durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -1144,13 +1121,11 @@ public class DurableClientTestCase extends DistributedTestCase { }); // Re-start server2 - this.server2VM.invoke(CacheServerTestUtil.class, "createCacheServer", - new Object[] { regionName, new Boolean(true), - new Integer(server2Port)}); + this.server2VM.invoke(() -> CacheServerTestUtil.createCacheServer( regionName, new Boolean(true), + new Integer(server2Port))); // Start normal publisher client - this.publisherClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(publisherClientVM.getHost()), server1Port, server2Port, false), regionName}); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(publisherClientVM.getHost()), server1Port, server2Port, false), regionName)); // Publish some entries final int numberOfEntries = 1; @@ -1245,7 +1220,7 @@ public class DurableClientTestCase extends DistributedTestCase { setPrimaryRecoveryCheck(); // Stop server 1 - publisher will put 10 entries during shutdown/primary identification - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); this.durableClientVM.invoke(new CacheSerializableRunnable("Get") { public void run2() throws CacheException { @@ -1277,13 +1252,13 @@ public class DurableClientTestCase extends DistributedTestCase { this.verifyListenerUpdates(numberOfEntries+2, numberOfEntries); // Stop the durable client - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the publisher client - this.publisherClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop server 2 - this.server2VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server2VM.invoke(() -> CacheServerTestUtil.closeCache()); } @@ -1292,14 +1267,12 @@ public class DurableClientTestCase extends DistributedTestCase { // Start server 1 - Integer[] ports = ((Integer[]) this.server1VM.invoke(CacheServerTestUtil.class, - "createCacheServerReturnPorts", new Object[] {regionName, new Boolean(true)})); + Integer[] ports = ((Integer[]) this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServerReturnPorts(regionName, new Boolean(true)))); final int server1Port = ports[0].intValue(); final int mcastPort = ports[1].intValue(); // Start server 2 using the same mcast port as server 1 - final int server2Port = ((Integer) this.server2VM.invoke(CacheServerTestUtil.class, - "createCacheServer", new Object[] {regionName, new Boolean(true), new Integer(mcastPort)})) + final int server2Port = ((Integer) this.server2VM.invoke(() -> CacheServerTestUtil.createCacheServer(regionName, new Boolean(true), new Integer(mcastPort)))) .intValue(); // Start a durable client @@ -1313,10 +1286,9 @@ public class DurableClientTestCase extends DistributedTestCase { clientPool = getClientPool(NetworkUtils.getServerHostName(Host.getHost(0)), server1Port, server2Port, true, 0); } - this.durableClientVM.invoke(CacheServerTestUtil.class, "disableShufflingOfEndpoints"); - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {clientPool, regionName, - getClientDistributedSystemProperties(durableClientId, durableClientTimeout), Boolean.TRUE}); + this.durableClientVM.invoke(() -> CacheServerTestUtil.disableShufflingOfEndpoints()); + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(clientPool, regionName, + getClientDistributedSystemProperties(durableClientId, durableClientTimeout), Boolean.TRUE)); // Send clientReady message this.durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -1338,8 +1310,7 @@ public class DurableClientTestCase extends DistributedTestCase { }); // Start normal publisher client - this.publisherClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] {getClientPool(NetworkUtils.getServerHostName(publisherClientVM.getHost()), server1Port, server2Port, false), regionName}); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(getClientPool(NetworkUtils.getServerHostName(publisherClientVM.getHost()), server1Port, server2Port, false), regionName)); // Publish some entries final int numberOfEntries = 1; @@ -1383,7 +1354,7 @@ public class DurableClientTestCase extends DistributedTestCase { this.disconnectDurableClient(true); // Stop server 1 - publisher will put 10 entries during shutdown/primary identification - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); // Publish updates during client downtime this.publisherClientVM.invoke(new CacheSerializableRunnable("Publish entries") { @@ -1477,13 +1448,13 @@ public class DurableClientTestCase extends DistributedTestCase { } // Stop the durable client - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop the publisher client - this.publisherClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.publisherClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop server 2 - this.server2VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server2VM.invoke(() -> CacheServerTestUtil.closeCache()); } @@ -2012,54 +1983,39 @@ public class DurableClientTestCase extends DistributedTestCase { } protected void startDurableClient(VM vm, String durableClientId, int serverPort1, String regionName, int durableTimeoutInSeconds) { - vm.invoke( - CacheServerTestUtil.class, - "createCacheClient", - new Object[] { + vm.invoke(() -> CacheServerTestUtil.createCacheClient( getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort1, true), regionName, getClientDistributedSystemProperties(durableClientId, durableTimeoutInSeconds), - Boolean.TRUE }); + Boolean.TRUE )); } protected void startDurableClient(VM vm, String durableClientId, int serverPort1, String regionName) { - vm.invoke( - CacheServerTestUtil.class, - "createCacheClient", - new Object[] { + vm.invoke(() -> CacheServerTestUtil.createCacheClient( getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), serverPort1, true), regionName, getClientDistributedSystemProperties(durableClientId), - Boolean.TRUE }); + Boolean.TRUE )); } protected void startDurableClient(VM vm, String durableClientId, int serverPort1, int serverPort2, String regionName) { - vm.invoke( - CacheServerTestUtil.class, - "createCacheClient", - new Object[] { + vm.invoke(() -> CacheServerTestUtil.createCacheClient( getClientPool(NetworkUtils.getServerHostName(vm.getHost()), serverPort1, serverPort2, true), regionName, getClientDistributedSystemProperties(durableClientId), - Boolean.TRUE }); + Boolean.TRUE )); } protected void startClient(VM vm, int serverPort1, String regionName) { - vm.invoke( - CacheServerTestUtil.class, - "createCacheClient", - new Object[] { + vm.invoke(() -> CacheServerTestUtil.createCacheClient( getClientPool(NetworkUtils.getServerHostName(vm.getHost()), - serverPort1, false), regionName }); + serverPort1, false), regionName )); } protected void startClient(VM vm, int serverPort1, int serverPort2, String regionName) { - vm.invoke( - CacheServerTestUtil.class, - "createCacheClient", - new Object[] { + vm.invoke(() -> CacheServerTestUtil.createCacheClient( getClientPool(NetworkUtils.getServerHostName(vm.getHost()), - serverPort1, serverPort2, false), regionName }); + serverPort1, serverPort2, false), regionName )); } protected void verifyDurableClientOnServer(VM server, final String durableClientId) { @@ -2095,6 +2051,6 @@ public class DurableClientTestCase extends DistributedTestCase { } protected void closeCache(VM vm) { - vm.invoke(CacheServerTestUtil.class, "closeCache"); + vm.invoke(() -> CacheServerTestUtil.closeCache()); } }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java index b4e589f..64bbe0c 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/CacheServerManagementDUnitTest.java @@ -120,8 +120,7 @@ public class CacheServerManagementDUnitTest extends LocatorTestBase { verifyCacheServer(server,serverPort); - final int port = server.invokeInt(CqQueryDUnitTest.class, - "getCacheServerPort"); + final int port = server.invoke(() -> CqQueryDUnitTest.getCacheServerPort()); final String host0 = NetworkUtils.getServerHostName(server.getHost()); // Create client. http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java index c77ab2b..12b11e3 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/ClientCommandsDUnitTest.java @@ -1438,9 +1438,9 @@ private void setUpNonSubscribedClient() throws Exception { @Override protected final void postTearDownCacheTestCase() throws Exception { - Host.getHost(0).getVM(0).invoke(CacheServerTestUtil.class, "closeCache"); - Host.getHost(0).getVM(1).invoke(CacheServerTestUtil.class, "closeCache"); - Host.getHost(0).getVM(2).invoke(CacheServerTestUtil.class, "closeCache"); - Host.getHost(0).getVM(3).invoke(CacheServerTestUtil.class, "closeCache"); + Host.getHost(0).getVM(0).invoke(() -> CacheServerTestUtil.closeCache()); + Host.getHost(0).getVM(1).invoke(() -> CacheServerTestUtil.closeCache()); + Host.getHost(0).getVM(2).invoke(() -> CacheServerTestUtil.closeCache()); + Host.getHost(0).getVM(3).invoke(() -> CacheServerTestUtil.closeCache()); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java index d8e65d9..bb97cf3 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/cli/commands/DurableClientCommandsDUnitTest.java @@ -429,8 +429,8 @@ public class DurableClientCommandsDUnitTest extends CliCommandTestBase { @Override protected final void postTearDownCacheTestCase() throws Exception { - Host.getHost(0).getVM(0).invoke(CacheServerTestUtil.class, "closeCache"); - Host.getHost(0).getVM(1).invoke(CacheServerTestUtil.class, "closeCache"); - Host.getHost(0).getVM(2).invoke(CacheServerTestUtil.class, "closeCache"); + Host.getHost(0).getVM(0).invoke(() -> CacheServerTestUtil.closeCache()); + Host.getHost(0).getVM(1).invoke(() -> CacheServerTestUtil.closeCache()); + Host.getHost(0).getVM(2).invoke(() -> CacheServerTestUtil.closeCache()); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestCQDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestCQDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestCQDUnitTest.java index 4ba48df..a8dcf59 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestCQDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestCQDUnitTest.java @@ -89,8 +89,7 @@ public class TestCQDUnitTest extends ManagementTestBase { int serverPort = AvailablePortHelper.getRandomAvailableTCPPort(); cqDUnitTest.createServer(server, serverPort); - final int port = server.invokeInt(CqQueryDUnitTest.class, - "getCacheServerPort"); + final int port = server.invoke(() -> CqQueryDUnitTest.getCacheServerPort()); cqDUnitTest.createClient(client, port, host0); cqDUnitTest.createCQ(client, queryName, cqDUnitTest.cqs[0]); @@ -125,8 +124,7 @@ public class TestCQDUnitTest extends ManagementTestBase { /* queryDeletes: */0, /* totalEvents: */size); - long numOfCQ = ((Number) managingNode.invoke(TestCQDUnitTest.class, - "getNumOfCQ")).intValue(); + long numOfCQ = ((Number) managingNode.invoke(() -> TestCQDUnitTest.getNumOfCQ())).intValue(); LogWriterUtils.getLogWriter().info("testNumOfCQ numOfCQ= " + numOfCQ); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientsDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientsDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientsDUnitTest.java index 1659731..5decf7d 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientsDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestClientsDUnitTest.java @@ -85,12 +85,10 @@ public class TestClientsDUnitTest extends ManagementTestBase { VM client = managedNodeList.get(2); int serverPort = AvailablePortHelper.getRandomAvailableTCPPort(); cqDUnitTest.createServer(server, serverPort); - 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); - Integer numOfClients = (Integer) managingNode.invoke( - TestClientsDUnitTest.class, "getNumOfClients"); + Integer numOfClients = (Integer) managingNode.invoke(() -> TestClientsDUnitTest.getNumOfClients()); LogWriterUtils.getLogWriter().info("testNumOfClients numOfClients = " + numOfClients); cqDUnitTest.closeClient(client); cqDUnitTest.closeServer(server); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestServerDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestServerDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestServerDUnitTest.java index 8fa29a7..e632993 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestServerDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/management/internal/pulse/TestServerDUnitTest.java @@ -80,8 +80,7 @@ public class TestServerDUnitTest extends ManagementTestBase { VM server = managedNodeList.get(1); int serverPort = AvailablePortHelper.getRandomAvailableTCPPort(); cqDUnitTest.createServer(server, serverPort); - int serverCount = ((Number) managingNode.invoke(TestServerDUnitTest.class, - "getNumOfServersFromMBean")).intValue(); + int serverCount = ((Number) managingNode.invoke(() -> TestServerDUnitTest.getNumOfServersFromMBean())).intValue(); LogWriterUtils.getLogWriter().info("TestServerDUnitTest serverCount =" + serverCount); cqDUnitTest.closeServer(server); assertEquals(1, serverCount); http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java index 86e38f3..9910c8a 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthorizationTwoDUnitTest.java @@ -51,14 +51,10 @@ public class ClientAuthorizationTwoDUnitTest 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 }); - 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); } @@ -233,11 +229,11 @@ public class ClientAuthorizationTwoDUnitTest extends @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-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java index e26db30..344c977 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientAuthzObjectModDUnitTest.java @@ -119,12 +119,9 @@ public class ClientAuthzObjectModDUnitTest 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); //required by FilterPreAuthorization and FilterPostAuthorization. Normally, @@ -373,20 +370,18 @@ public class ClientAuthzObjectModDUnitTest extends ClientAuthorizationTestBase { // 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, extraProps, null, 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, extraProps, null, tgen, rnd); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java index e17acc0..0cb125f 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientCQPostAuthorizationDUnitTest.java @@ -86,21 +86,18 @@ public class ClientCQPostAuthorizationDUnitTest 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 { - client1.invoke(SecurityTestUtil.class, "closeCache"); - client2.invoke(SecurityTestUtil.class, "closeCache"); - server1.invoke(SecurityTestUtil.class, "closeCache"); - server2.invoke(SecurityTestUtil.class, "closeCache"); + client1.invoke(() -> SecurityTestUtil.closeCache()); + client2.invoke(() -> SecurityTestUtil.closeCache()); + server1.invoke(() -> SecurityTestUtil.closeCache()); + server2.invoke(() -> SecurityTestUtil.closeCache()); } public void testAllowCQForAllMultiusers() throws Exception { @@ -218,11 +215,10 @@ public class ClientCQPostAuthorizationDUnitTest extends Integer locatorPort = Integer.valueOf(AvailablePort .getRandomAvailablePort(AvailablePort.SOCKET)); // Close down any running servers - server1.invoke(SecurityTestUtil.class, "closeCache"); - server2.invoke(SecurityTestUtil.class, "closeCache"); + server1.invoke(() -> SecurityTestUtil.closeCache()); + server2.invoke(() -> SecurityTestUtil.closeCache()); - server1.invoke(ClientCQPostAuthorizationDUnitTest.class, - "createServerCache", new Object[] {serverProps, javaProps, locatorPort, port1}); + server1.invoke(() -> ClientCQPostAuthorizationDUnitTest.createServerCache(serverProps, javaProps, locatorPort, port1)); client1.invoke(ClientCQPostAuthorizationDUnitTest.class, "createClientCache", new Object[] {javaProps2, authInit, authProps, new Integer[] {port1, port2}, numOfUsers, postAuthzAllowed}); @@ -230,45 +226,35 @@ public class ClientCQPostAuthorizationDUnitTest extends "createClientCache", new Object[] {javaProps2, authInit, authProps, new Integer[] {port1, port2}, numOfUsers, postAuthzAllowed}); - client1.invoke(ClientCQPostAuthorizationDUnitTest.class, "createCQ", - new Object[] {numOfUsers}); + client1.invoke(() -> ClientCQPostAuthorizationDUnitTest.createCQ(numOfUsers)); client1.invoke(ClientCQPostAuthorizationDUnitTest.class, "executeCQ", new Object[] {numOfUsers, new Boolean[] {false, false}, numOfPuts, new String[numOfUsers], postAuthzAllowed}); - client2.invoke(ClientCQPostAuthorizationDUnitTest.class, "doPuts", - new Object[] {numOfPuts, Boolean.TRUE/* put last key */}); + client2.invoke(() -> ClientCQPostAuthorizationDUnitTest.doPuts(numOfPuts, Boolean.TRUE/* put last key */)); if (!postAuthzAllowed[0]) { // There is no point waiting as no user is authorized to receive cq events. try {Thread.sleep(1000);} catch (InterruptedException ie) {} } else { - client1.invoke(ClientCQPostAuthorizationDUnitTest.class, - "waitForLastKey", new Object[] {Integer.valueOf(0)}); + client1.invoke(() -> ClientCQPostAuthorizationDUnitTest.waitForLastKey(Integer.valueOf(0))); if (postAuthzAllowed[1]) { - client1.invoke(ClientCQPostAuthorizationDUnitTest.class, - "waitForLastKey", new Object[] {Integer.valueOf(1)}); + client1.invoke(() -> ClientCQPostAuthorizationDUnitTest.waitForLastKey(Integer.valueOf(1))); } } - client1.invoke(ClientCQPostAuthorizationDUnitTest.class, - "checkCQListeners", new Object[] {numOfUsers, postAuthzAllowed, - numOfPuts + 1/* last key */, 0, !failover}); + client1.invoke(() -> ClientCQPostAuthorizationDUnitTest.checkCQListeners(numOfUsers, postAuthzAllowed, + numOfPuts + 1/* last key */, 0, !failover)); if (failover) { - server2.invoke(ClientCQPostAuthorizationDUnitTest.class, - "createServerCache", new Object[] {serverProps, javaProps, locatorPort, port2}); - server1.invoke(SecurityTestUtil.class, "closeCache"); + server2.invoke(() -> ClientCQPostAuthorizationDUnitTest.createServerCache(serverProps, javaProps, locatorPort, port2)); + server1.invoke(() -> SecurityTestUtil.closeCache()); // Allow time for client1 to register its CQs on server2 - server2.invoke(ClientCQPostAuthorizationDUnitTest.class, - "allowCQsToRegister", new Object[] {Integer.valueOf(2)}); - - client2.invoke(ClientCQPostAuthorizationDUnitTest.class, "doPuts", - new Object[] {numOfPuts, Boolean.TRUE/* put last key */}); - client1.invoke(ClientCQPostAuthorizationDUnitTest.class, - "waitForLastKeyUpdate", new Object[] {Integer.valueOf(0)}); - client1.invoke(ClientCQPostAuthorizationDUnitTest.class, - "checkCQListeners", new Object[] {numOfUsers, postAuthzAllowed, + server2.invoke(() -> ClientCQPostAuthorizationDUnitTest.allowCQsToRegister(Integer.valueOf(2))); + + client2.invoke(() -> ClientCQPostAuthorizationDUnitTest.doPuts(numOfPuts, Boolean.TRUE/* put last key */)); + client1.invoke(() -> ClientCQPostAuthorizationDUnitTest.waitForLastKeyUpdate(Integer.valueOf(0))); + client1.invoke(() -> ClientCQPostAuthorizationDUnitTest.checkCQListeners(numOfUsers, postAuthzAllowed, numOfPuts + 1/* last key */, numOfPuts + 1/* last key */, - Boolean.TRUE}); + Boolean.TRUE)); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java index 78a45b1..62bff2b 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/ClientPostAuthorizationDUnitTest.java @@ -55,12 +55,9 @@ public class ClientPostAuthorizationDUnitTest 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); } @@ -142,8 +139,8 @@ public class ClientPostAuthorizationDUnitTest extends .getRandomAvailablePort(AvailablePort.SOCKET)); // Close down any running servers - server1.invoke(SecurityTestUtil.class, "closeCache"); - server2.invoke(SecurityTestUtil.class, "closeCache"); + server1.invoke(() -> SecurityTestUtil.closeCache()); + server2.invoke(() -> SecurityTestUtil.closeCache()); // Perform all the ops on the clients List opBlock = new ArrayList(); @@ -158,20 +155,18 @@ public class ClientPostAuthorizationDUnitTest 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); } @@ -355,20 +350,18 @@ public class ClientPostAuthorizationDUnitTest 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); } @@ -387,11 +380,11 @@ public class ClientPostAuthorizationDUnitTest extends @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-cq/src/test/java/com/gemstone/gemfire/security/MultiuserAPIDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserAPIDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserAPIDUnitTest.java index e3931b0..7161830 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserAPIDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserAPIDUnitTest.java @@ -78,14 +78,10 @@ public class MultiuserAPIDUnitTest 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)); } public static Integer createCacheServer(Object dsPort, Object locatorString, @@ -148,12 +144,10 @@ public class MultiuserAPIDUnitTest extends ClientAuthorizationTestBase { Integer locPort1 = SecurityTestUtil.getLocatorPort(); Integer locPort2 = SecurityTestUtil.getLocatorPort(); String locString = SecurityTestUtil.getLocatorString(); - Integer port1 = (Integer)server1.invoke(MultiuserAPIDUnitTest.class, - "createCacheServer", new Object[] {locPort1, locString, authenticator, - extraProps, javaProps}); - Integer port2 = (Integer)server2.invoke(MultiuserAPIDUnitTest.class, - "createCacheServer", new Object[] {locPort2, locString, authenticator, - extraProps, javaProps}); + Integer port1 = (Integer)server1.invoke(() -> MultiuserAPIDUnitTest.createCacheServer(locPort1, locString, authenticator, + extraProps, javaProps)); + Integer port2 = (Integer)server2.invoke(() -> MultiuserAPIDUnitTest.createCacheServer(locPort2, locString, authenticator, + extraProps, javaProps)); // Start the clients with valid credentials Properties credentials1 = gen.getValidCredentials(1); @@ -166,25 +160,22 @@ public class MultiuserAPIDUnitTest extends ClientAuthorizationTestBase { LogWriterUtils.getLogWriter().info( "testValidCredentials: For second client credentials: " + credentials2 + " : " + javaProps2); - client1.invoke(MultiuserAPIDUnitTest.class, "createCacheClient", - new Object[] {authInit, credentials1, javaProps1, port1, port2, null, - multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION)}); + client1.invoke(() -> MultiuserAPIDUnitTest.createCacheClient(authInit, credentials1, javaProps1, port1, port2, null, + multiUser, new Integer(SecurityTestUtil.NO_EXCEPTION))); } public void testSingleUserUnsupportedAPIs() { // Start servers // Start clients with multiuser-authentication set to false setUpVMs(new DummyCredentialGenerator(), Boolean.FALSE); - client1.invoke(MultiuserAPIDUnitTest.class, "verifyDisallowedOps", - new Object[] {Boolean.FALSE}); + client1.invoke(() -> MultiuserAPIDUnitTest.verifyDisallowedOps(Boolean.FALSE)); } public void testMultiUserUnsupportedAPIs() { // Start servers. // Start clients with multiuser-authentication set to true. setUpVMs(new DummyCredentialGenerator(), Boolean.TRUE); - client1.invoke(MultiuserAPIDUnitTest.class, "verifyDisallowedOps", - new Object[] {Boolean.TRUE}); + client1.invoke(() -> MultiuserAPIDUnitTest.verifyDisallowedOps(Boolean.TRUE)); } public static void verifyDisallowedOps(Boolean multiuserMode) { @@ -383,10 +374,10 @@ public class MultiuserAPIDUnitTest 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()); // 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-cq/src/test/java/com/gemstone/gemfire/security/MultiuserDurableCQAuthzDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserDurableCQAuthzDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserDurableCQAuthzDUnitTest.java index 23f496d..9f9d4c0 100644 --- a/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserDurableCQAuthzDUnitTest.java +++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/security/MultiuserDurableCQAuthzDUnitTest.java @@ -76,12 +76,9 @@ public class MultiuserDurableCQAuthzDUnitTest 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); } @@ -202,11 +199,10 @@ public class MultiuserDurableCQAuthzDUnitTest extends Integer locatorPort = new Integer(AvailablePort .getRandomAvailablePort(AvailablePort.SOCKET)); // Close down any running servers - server1.invoke(SecurityTestUtil.class, "closeCache"); - server2.invoke(SecurityTestUtil.class, "closeCache"); + server1.invoke(() -> SecurityTestUtil.closeCache()); + server2.invoke(() -> SecurityTestUtil.closeCache()); - server1.invoke(MultiuserDurableCQAuthzDUnitTest.class, - "createServerCache", new Object[] {serverProps, javaProps, locatorPort, port1}); + server1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.createServerCache(serverProps, javaProps, locatorPort, port1)); client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "createClientCache", new Object[] {javaProps2, authInit, authProps, new Integer[] {port1, port2}, numOfUsers, durableClientId, postAuthzAllowed}); @@ -215,44 +211,38 @@ public class MultiuserDurableCQAuthzDUnitTest extends // new Object[] {authInit, client2Credentials, javaProps2, // new Integer[] {port1, port2}, null, SecurityTestUtil.NO_EXCEPTION}); - client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "createCQ", - new Object[] {numOfUsers, Boolean.TRUE}); + client1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.createCQ(numOfUsers, Boolean.TRUE)); client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "executeCQ", new Object[] {numOfUsers, new Boolean[] {false, false}, numOfPuts, new String[numOfUsers]}); - client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "readyForEvents"); + client1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.readyForEvents()); if (keepAlive == null) { - client1.invoke(SecurityTestUtil.class, "closeCache"); + client1.invoke(() -> SecurityTestUtil.closeCache()); } else { - client1.invoke(SecurityTestUtil.class, "closeCache", - new Object[] {keepAlive}); + client1.invoke(() -> SecurityTestUtil.closeCache(keepAlive)); } - server1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "doPuts", - new Object[] {numOfPuts, Boolean.TRUE/* put last key */}); + server1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.doPuts(numOfPuts, Boolean.TRUE/* put last key */)); client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "createClientCache", new Object[] {javaProps2, authInit, authProps, new Integer[] {port1, port2}, numOfUsers, durableClientId, postAuthzAllowed}); - client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "createCQ", - new Object[] {numOfUsers, Boolean.TRUE}); + client1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.createCQ(numOfUsers, Boolean.TRUE)); client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "executeCQ", new Object[] {numOfUsers, new Boolean[] {false, false}, numOfPuts, new String[numOfUsers]}); - client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "readyForEvents"); + client1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.readyForEvents()); if (!postAuthzAllowed[0] || keepAlive == null || !keepAlive) { // Don't wait as no user is authorized to receive cq events. Thread.sleep(1000); } else { - client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "waitForLastKey", - new Object[] {Integer.valueOf(0), Boolean.TRUE}); + client1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.waitForLastKey(Integer.valueOf(0), Boolean.TRUE)); } Integer numOfCreates = (keepAlive == null) ? 0 : (keepAlive) ? (numOfPuts + 1/* last key */) : 0; - client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "checkCQListeners", - new Object[] {numOfUsers, postAuthzAllowed, numOfCreates, 0}); + client1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.checkCQListeners(numOfUsers, postAuthzAllowed, numOfCreates, 0)); client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "proxyCacheClose", new Object[] {new Integer[] {0, 1}, keepAlive}); @@ -260,25 +250,21 @@ public class MultiuserDurableCQAuthzDUnitTest extends client1.invoke(SecurityTestUtil.class, "createProxyCache", new Object[] {new Integer[] {0, 1}, authProps}); - client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "createCQ", - new Object[] {numOfUsers, Boolean.TRUE}); + client1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.createCQ(numOfUsers, Boolean.TRUE)); client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "executeCQ", new Object[] {numOfUsers, new Boolean[] {false, false}, numOfPuts, new String[numOfUsers]}); - server1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "doPuts", - new Object[] {numOfPuts, Boolean.TRUE/* put last key */}); + server1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.doPuts(numOfPuts, Boolean.TRUE/* put last key */)); if (!postAuthzAllowed[0] || keepAlive == null || !keepAlive) { // Don't wait as no user is authorized to receive cq events. Thread.sleep(1000); } else { - client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "waitForLastKey", - new Object[] {Integer.valueOf(0), Boolean.FALSE}); + client1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.waitForLastKey(Integer.valueOf(0), Boolean.FALSE)); } Integer numOfUpdates = numOfPuts + 1; - client1.invoke(MultiuserDurableCQAuthzDUnitTest.class, "checkCQListeners", - new Object[] {numOfUsers, postAuthzAllowed, 0, numOfUpdates}); + client1.invoke(() -> MultiuserDurableCQAuthzDUnitTest.checkCQListeners(numOfUsers, postAuthzAllowed, 0, numOfUpdates)); } public static void createServerCache(Properties serverProps, http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java index 2d1e2cd..cae30d2 100644 --- a/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java +++ b/gemfire-wan/src/test/java/com/gemstone/gemfire/internal/cache/UpdateVersionDUnitTest.java @@ -100,22 +100,22 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { final String key = "key-1"; // Site 1 - Integer lnPort = (Integer)vm0.invoke(UpdateVersionDUnitTest.class, "createFirstLocatorWithDSId", new Object[] { 1 }); + Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 )); - vm0.invoke(UpdateVersionDUnitTest.class, "createCache", new Object[] { lnPort}); - vm0.invoke(UpdateVersionDUnitTest.class, "createSender", new Object[] { "ln1", 2, false, 10, 1, false, false, null, true }); + vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort)); + vm0.invoke(() -> UpdateVersionDUnitTest.createSender( "ln1", 2, false, 10, 1, false, false, null, true )); - vm0.invoke(UpdateVersionDUnitTest.class, "createPartitionedRegion", new Object[] {regionName, "ln1", 1, 1}); - vm0.invoke(UpdateVersionDUnitTest.class, "startSender", new Object[] { "ln1" }); - vm0.invoke(UpdateVersionDUnitTest.class, "waitForSenderRunningState", new Object[] { "ln1" }); + vm0.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "ln1", 1, 1)); + vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" )); + vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" )); //Site 2 - Integer nyPort = (Integer)vm2.invoke(UpdateVersionDUnitTest.class, "createFirstRemoteLocator", new Object[] { 2, lnPort }); - Integer nyRecPort = (Integer) vm2.invoke(UpdateVersionDUnitTest.class, "createReceiver", new Object[] { nyPort }); + Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort )); + Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort )); - vm2.invoke(UpdateVersionDUnitTest.class, "createPartitionedRegion", new Object[] {regionName, "", 1, 1}); - vm3.invoke(UpdateVersionDUnitTest.class, "createCache", new Object[] { nyPort}); - vm3.invoke(UpdateVersionDUnitTest.class, "createPartitionedRegion", new Object[] {regionName, "", 1, 1}); + vm2.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1)); + vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort)); + vm3.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1)); final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Update a single entry and get its version") { @@ -238,22 +238,22 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { final String key = "key-1"; // Site 1 - Integer lnPort = (Integer)vm0.invoke(UpdateVersionDUnitTest.class, "createFirstLocatorWithDSId", new Object[] { 1 }); + Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 )); - vm0.invoke(UpdateVersionDUnitTest.class, "createCache", new Object[] { lnPort}); - vm0.invoke(UpdateVersionDUnitTest.class, "createSender", new Object[] { "ln1", 2, false, 10, 1, false, false, null, true }); + vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort)); + vm0.invoke(() -> UpdateVersionDUnitTest.createSender( "ln1", 2, false, 10, 1, false, false, null, true )); - vm0.invoke(UpdateVersionDUnitTest.class, "createReplicatedRegion", new Object[] {regionName, "ln1"}); - vm0.invoke(UpdateVersionDUnitTest.class, "startSender", new Object[] { "ln1" }); - vm0.invoke(UpdateVersionDUnitTest.class, "waitForSenderRunningState", new Object[] { "ln1" }); + vm0.invoke(() -> UpdateVersionDUnitTest.createReplicatedRegion(regionName, "ln1")); + vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" )); + vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" )); //Site 2 - Integer nyPort = (Integer)vm2.invoke(UpdateVersionDUnitTest.class, "createFirstRemoteLocator", new Object[] { 2, lnPort }); - Integer nyRecPort = (Integer) vm2.invoke(UpdateVersionDUnitTest.class, "createReceiver", new Object[] { nyPort }); + Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort )); + Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort )); - vm2.invoke(UpdateVersionDUnitTest.class, "createReplicatedRegion", new Object[] {regionName, ""}); - vm3.invoke(UpdateVersionDUnitTest.class, "createCache", new Object[] { nyPort }); - vm3.invoke(UpdateVersionDUnitTest.class, "createReplicatedRegion", new Object[] {regionName, ""}); + vm2.invoke(() -> UpdateVersionDUnitTest.createReplicatedRegion(regionName, "")); + vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort )); + vm3.invoke(() -> UpdateVersionDUnitTest.createReplicatedRegion(regionName, "")); final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Update a single entry and get its version") { @@ -361,25 +361,25 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { VM vm3 = host.getVM(3); // server2 site2 // Site 1 - Integer lnPort = (Integer)vm0.invoke(UpdateVersionDUnitTest.class, "createFirstLocatorWithDSId", new Object[] { 1 }); + Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 )); final String key = "key-1"; - vm0.invoke(UpdateVersionDUnitTest.class, "createCache", new Object[] { lnPort}); - vm0.invoke(UpdateVersionDUnitTest.class, "createSender", new Object[] { "ln1", 2, true, 10, 1, false, false, null, true }); + vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort)); + vm0.invoke(() -> UpdateVersionDUnitTest.createSender( "ln1", 2, true, 10, 1, false, false, null, true )); - vm0.invoke(UpdateVersionDUnitTest.class, "createPartitionedRegion", new Object[] {regionName, "ln1", 1, 1}); - vm0.invoke(UpdateVersionDUnitTest.class, "startSender", new Object[] { "ln1" }); - vm0.invoke(UpdateVersionDUnitTest.class, "waitForSenderRunningState", new Object[] { "ln1" }); + vm0.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "ln1", 1, 1)); + vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" )); + vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" )); //Site 2 - Integer nyPort = (Integer)vm2.invoke(UpdateVersionDUnitTest.class, "createFirstRemoteLocator", new Object[] { 2, lnPort }); - Integer nyRecPort = (Integer) vm2.invoke(UpdateVersionDUnitTest.class, "createReceiver", new Object[] { nyPort }); + Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort )); + Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort )); - vm2.invoke(UpdateVersionDUnitTest.class, "createPartitionedRegion", new Object[] {regionName, "", 1, 1}); + vm2.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1)); - vm3.invoke(UpdateVersionDUnitTest.class, "createCache", new Object[] { nyPort}); - vm3.invoke(UpdateVersionDUnitTest.class, "createPartitionedRegion", new Object[] {regionName, "", 1, 1}); + vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort)); + vm3.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1)); final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Put a single entry and get its version") { @@ -500,25 +500,25 @@ public class UpdateVersionDUnitTest extends DistributedTestCase { VM vm3 = host.getVM(3); // server2 site2 // Site 1 - Integer lnPort = (Integer)vm0.invoke(UpdateVersionDUnitTest.class, "createFirstLocatorWithDSId", new Object[] { 1 }); + Integer lnPort = (Integer)vm0.invoke(() -> UpdateVersionDUnitTest.createFirstLocatorWithDSId( 1 )); final String key = "key-1"; - vm0.invoke(UpdateVersionDUnitTest.class, "createCache", new Object[] { lnPort }); - vm0.invoke(UpdateVersionDUnitTest.class, "createConcurrentSender", new Object[] { "ln1", 2, false, 10, 2, false, false, null, true, 2 }); + vm0.invoke(() -> UpdateVersionDUnitTest.createCache( lnPort )); + vm0.invoke(() -> UpdateVersionDUnitTest.createConcurrentSender( "ln1", 2, false, 10, 2, false, false, null, true, 2 )); - vm0.invoke(UpdateVersionDUnitTest.class, "createPartitionedRegion", new Object[] {regionName, "ln1", 1, 1}); - vm0.invoke(UpdateVersionDUnitTest.class, "startSender", new Object[] { "ln1" }); - vm0.invoke(UpdateVersionDUnitTest.class, "waitForSenderRunningState", new Object[] { "ln1" }); + vm0.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "ln1", 1, 1)); + vm0.invoke(() -> UpdateVersionDUnitTest.startSender( "ln1" )); + vm0.invoke(() -> UpdateVersionDUnitTest.waitForSenderRunningState( "ln1" )); //Site 2 - Integer nyPort = (Integer)vm2.invoke(UpdateVersionDUnitTest.class, "createFirstRemoteLocator", new Object[] { 2, lnPort }); - Integer nyRecPort = (Integer) vm2.invoke(UpdateVersionDUnitTest.class, "createReceiver", new Object[] { nyPort }); + Integer nyPort = (Integer)vm2.invoke(() -> UpdateVersionDUnitTest.createFirstRemoteLocator( 2, lnPort )); + Integer nyRecPort = (Integer) vm2.invoke(() -> UpdateVersionDUnitTest.createReceiver( nyPort )); - vm2.invoke(UpdateVersionDUnitTest.class, "createPartitionedRegion", new Object[] {regionName, "", 1, 1}); + vm2.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1)); - vm3.invoke(UpdateVersionDUnitTest.class, "createCache", new Object[] { nyPort }); - vm3.invoke(UpdateVersionDUnitTest.class, "createPartitionedRegion", new Object[] {regionName, "", 1, 1}); + vm3.invoke(() -> UpdateVersionDUnitTest.createCache( nyPort )); + vm3.invoke(() -> UpdateVersionDUnitTest.createPartitionedRegion(regionName, "", 1, 1)); final VersionTag tag = (VersionTag) vm0.invoke(new SerializableCallable("Put a single entry and get its version") { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/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 17afcbb..374d929 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 @@ -5121,14 +5121,14 @@ public class WANTestBase extends DistributedTestCase{ @Override protected final void preTearDown() throws Exception { cleanupVM(); - vm0.invoke(WANTestBase.class, "cleanupVM"); - vm1.invoke(WANTestBase.class, "cleanupVM"); - vm2.invoke(WANTestBase.class, "cleanupVM"); - vm3.invoke(WANTestBase.class, "cleanupVM"); - vm4.invoke(WANTestBase.class, "cleanupVM"); - vm5.invoke(WANTestBase.class, "cleanupVM"); - vm6.invoke(WANTestBase.class, "cleanupVM"); - vm7.invoke(WANTestBase.class, "cleanupVM"); + vm0.invoke(() -> WANTestBase.cleanupVM()); + vm1.invoke(() -> WANTestBase.cleanupVM()); + vm2.invoke(() -> WANTestBase.cleanupVM()); + vm3.invoke(() -> WANTestBase.cleanupVM()); + vm4.invoke(() -> WANTestBase.cleanupVM()); + vm5.invoke(() -> WANTestBase.cleanupVM()); + vm6.invoke(() -> WANTestBase.cleanupVM()); + vm7.invoke(() -> WANTestBase.cleanupVM()); } public static void cleanupVM() throws IOException {