http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java index c28f9e7..b69c973 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/Bug40396DUnitTest.java @@ -163,10 +163,9 @@ public class Bug40396DUnitTest extends DistributedTestCase { */ public void testForFaultyDeltaImplementationForEOFEX() { boolean matched = false; - ((Integer)server.invoke(Bug40396DUnitTest.class, "createServerCache")).intValue(); - ((Integer)server2.invoke(Bug40396DUnitTest.class, "createServerCache")).intValue(); - Exception xp = (Exception)server.invoke(Bug40396DUnitTest.class, - "putDelta", new Object[] { REGION_NAME, END_OF_FILE_EX }); + ((Integer)server.invoke(() -> Bug40396DUnitTest.createServerCache())).intValue(); + ((Integer)server2.invoke(() -> Bug40396DUnitTest.createServerCache())).intValue(); + Exception xp = (Exception)server.invoke(() -> Bug40396DUnitTest.putDelta( REGION_NAME, END_OF_FILE_EX )); StackTraceElement[] st = xp.getCause().getStackTrace(); matched = getMatched(st); @@ -191,10 +190,10 @@ public class Bug40396DUnitTest extends DistributedTestCase { */ public void testForFaultyDeltaImplementationForAIOBEX() { boolean matched = false; - ((Integer)server.invoke(Bug40396DUnitTest.class, "createServerCache")).intValue(); - ((Integer)server2.invoke(Bug40396DUnitTest.class, "createServerCache")).intValue(); - Exception xp = (Exception) server.invoke(Bug40396DUnitTest.class, "putDelta", new Object[] { - REGION_NAME, ARRAY_INDEX_OUT_BOUND_EX }); + ((Integer)server.invoke(() -> Bug40396DUnitTest.createServerCache())).intValue(); + ((Integer)server2.invoke(() -> Bug40396DUnitTest.createServerCache())).intValue(); + Exception xp = (Exception) server.invoke(() -> Bug40396DUnitTest.putDelta( + REGION_NAME, ARRAY_INDEX_OUT_BOUND_EX )); StackTraceElement[] st = xp.getStackTrace(); matched = getMatched(st); @@ -205,9 +204,9 @@ public class Bug40396DUnitTest extends DistributedTestCase { @Override protected final void preTearDown() throws Exception { // then close the servers - server.invoke(Bug40396DUnitTest.class, "removeExceptions"); - server.invoke(Bug40396DUnitTest.class, "closeCache"); - server2.invoke(Bug40396DUnitTest.class, "closeCache"); + server.invoke(() -> Bug40396DUnitTest.removeExceptions()); + server.invoke(() -> Bug40396DUnitTest.closeCache()); + server2.invoke(() -> Bug40396DUnitTest.closeCache()); cache = null; Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } }); }
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java index 3d53df9..ae91f21 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/BackwardCompatibilityHigherVersionClientDUnitTest.java @@ -136,17 +136,13 @@ public class BackwardCompatibilityHigherVersionClientDUnitTest extends @Override protected final void postTearDown() throws Exception { - client1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class, - "unsetHandshakeVersionForTesting"); - client1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class, - "unsetConnectionToServerFailed"); + client1.invoke(() -> BackwardCompatibilityHigherVersionClientDUnitTest.unsetHandshakeVersionForTesting()); + client1.invoke(() -> BackwardCompatibilityHigherVersionClientDUnitTest.unsetConnectionToServerFailed()); // close the clients first - client1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class, - "closeCache"); + client1.invoke(() -> BackwardCompatibilityHigherVersionClientDUnitTest.closeCache()); // then close the servers - server1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class, - "closeCache"); + server1.invoke(() -> BackwardCompatibilityHigherVersionClientDUnitTest.closeCache()); } public static void closeCache() { @@ -161,17 +157,12 @@ public class BackwardCompatibilityHigherVersionClientDUnitTest extends * Verify that server responds to a higher versioned client. */ public void testHigherVersionedClient() { - Integer port1 = ((Integer)server1.invoke( - BackwardCompatibilityHigherVersionClientDUnitTest.class, - "createServerCache")); - - client1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class, - "setHandshakeVersionForTesting"); - client1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class, - "createClientCache", new Object[] { - NetworkUtils.getServerHostName(server1.getHost()), port1 }); - client1.invoke(BackwardCompatibilityHigherVersionClientDUnitTest.class, - "verifyConnectionToServerFailed"); + Integer port1 = ((Integer)server1.invoke(() -> BackwardCompatibilityHigherVersionClientDUnitTest.createServerCache())); + + client1.invoke(() -> BackwardCompatibilityHigherVersionClientDUnitTest.setHandshakeVersionForTesting()); + client1.invoke(() -> BackwardCompatibilityHigherVersionClientDUnitTest.createClientCache( + NetworkUtils.getServerHostName(server1.getHost()), port1 )); + client1.invoke(() -> BackwardCompatibilityHigherVersionClientDUnitTest.verifyConnectionToServerFailed()); } /* http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java index c8ac91e..12cd163 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36269DUnitTest.java @@ -82,10 +82,8 @@ public class Bug36269DUnitTest extends DistributedTestCase // Server2 VM server2 = host.getVM(1); - PORT1 = ((Integer)server1.invoke(Bug36269DUnitTest.class, - "createServerCache")).intValue(); - PORT2 = ((Integer)server2.invoke(Bug36269DUnitTest.class, - "createServerCache")).intValue(); + PORT1 = ((Integer)server1.invoke(() -> Bug36269DUnitTest.createServerCache())).intValue(); + PORT2 = ((Integer)server2.invoke(() -> Bug36269DUnitTest.createServerCache())).intValue(); } @@ -109,8 +107,8 @@ public class Bug36269DUnitTest extends DistributedTestCase try { createClientCache(); acquireConnectionsAndDestroyRegion(NetworkUtils.getServerHostName(Host.getHost(0))); - server1.invoke(Bug36269DUnitTest.class, "verifyRegionDestroy"); - server2.invoke(Bug36269DUnitTest.class, "verifyRegionDestroy"); + server1.invoke(() -> Bug36269DUnitTest.verifyRegionDestroy()); + server2.invoke(() -> Bug36269DUnitTest.verifyRegionDestroy()); Wait.pause(5000); verifyNoRegionDestroyOnOriginator(); } @@ -222,7 +220,7 @@ public class Bug36269DUnitTest extends DistributedTestCase protected final void preTearDown() throws Exception { closeCache(); // close server - server1.invoke(Bug36269DUnitTest.class, "closeCache"); - server2.invoke(Bug36269DUnitTest.class, "closeCache"); + server1.invoke(() -> Bug36269DUnitTest.closeCache()); + server2.invoke(() -> Bug36269DUnitTest.closeCache()); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java index cff2266..81693d9 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36457DUnitTest.java @@ -142,11 +142,11 @@ public class Bug36457DUnitTest extends DistributedTestCase @Override protected final void preTearDown() throws Exception { // close the clients first - client1.invoke(Bug36457DUnitTest.class, "closeCache"); - client2.invoke(Bug36457DUnitTest.class, "closeCache"); + client1.invoke(() -> Bug36457DUnitTest.closeCache()); + client2.invoke(() -> Bug36457DUnitTest.closeCache()); // then close the servers - server1.invoke(Bug36457DUnitTest.class, "closeCache"); - server2.invoke(Bug36457DUnitTest.class, "closeCache"); + server1.invoke(() -> Bug36457DUnitTest.closeCache()); + server2.invoke(() -> Bug36457DUnitTest.closeCache()); } public static void closeCache() @@ -159,20 +159,17 @@ public class Bug36457DUnitTest extends DistributedTestCase public void testBug36457() { - Integer port1 = ((Integer)server1.invoke(Bug36457DUnitTest.class, - "createServerCache")); - Integer port2 = ((Integer)server2.invoke(Bug36457DUnitTest.class, - "createServerCache")); - client1.invoke(Bug36457DUnitTest.class, "createClientCache", new Object[] { - NetworkUtils.getServerHostName(server1.getHost()), port1, port2 }); - client2.invoke(Bug36457DUnitTest.class, "createClientCache", new Object[] { - NetworkUtils.getServerHostName(server1.getHost()), port1, port2 }); + Integer port1 = ((Integer)server1.invoke(() -> Bug36457DUnitTest.createServerCache())); + Integer port2 = ((Integer)server2.invoke(() -> Bug36457DUnitTest.createServerCache())); + client1.invoke(() -> Bug36457DUnitTest.createClientCache( + NetworkUtils.getServerHostName(server1.getHost()), port1, port2 )); + client2.invoke(() -> Bug36457DUnitTest.createClientCache( + NetworkUtils.getServerHostName(server1.getHost()), port1, port2 )); //set a cllabck so that we come to know that whether a failover is called or not // if failover is called means this bug is present. - client2.invoke(Bug36457DUnitTest.class, "setClientServerObserver"); - client1.invoke(Bug36457DUnitTest.class, "destroyRegion"); - isFaileoverHappened = ((Boolean)client2.invoke(Bug36457DUnitTest.class, - "isFaileoverHappened")).booleanValue(); + client2.invoke(() -> Bug36457DUnitTest.setClientServerObserver()); + client1.invoke(() -> Bug36457DUnitTest.destroyRegion()); + isFaileoverHappened = ((Boolean)client2.invoke(() -> Bug36457DUnitTest.isFaileoverHappened())).booleanValue(); if (isFaileoverHappened) { //if failover is called means this bug is present, else fixed fail("Test failed because of unregistration failed due to region is destroyed on server"); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java index d9f1a2e..0aafb77 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36805DUnitTest.java @@ -136,11 +136,11 @@ public class Bug36805DUnitTest extends DistributedTestCase @Override protected final void preTearDown() throws Exception { // close the clients first - client1.invoke(Bug36805DUnitTest.class, "closeCache"); - client2.invoke(Bug36805DUnitTest.class, "closeCache"); + client1.invoke(() -> Bug36805DUnitTest.closeCache()); + client2.invoke(() -> Bug36805DUnitTest.closeCache()); // then close the servers - server1.invoke(Bug36805DUnitTest.class, "closeCache"); - server2.invoke(Bug36805DUnitTest.class, "closeCache"); + server1.invoke(() -> Bug36805DUnitTest.closeCache()); + server2.invoke(() -> Bug36805DUnitTest.closeCache()); } public static void closeCache() @@ -153,28 +153,24 @@ public class Bug36805DUnitTest extends DistributedTestCase public void testBug36805() { - Integer port1 = ((Integer)server1.invoke(Bug36805DUnitTest.class, - "createServerCache")); - Integer port2 = ((Integer)server2.invoke(Bug36805DUnitTest.class, - "createServerCache")); - client1.invoke(Bug36805DUnitTest.class, "createClientCache", new Object[] { - NetworkUtils.getServerHostName(server1.getHost()), port1, port2 }); - client2.invoke(Bug36805DUnitTest.class, "createClientCache", new Object[] { - NetworkUtils.getServerHostName(server1.getHost()), port1, port2 }); + Integer port1 = ((Integer)server1.invoke(() -> Bug36805DUnitTest.createServerCache())); + Integer port2 = ((Integer)server2.invoke(() -> Bug36805DUnitTest.createServerCache())); + client1.invoke(() -> Bug36805DUnitTest.createClientCache( + NetworkUtils.getServerHostName(server1.getHost()), port1, port2 )); + client2.invoke(() -> Bug36805DUnitTest.createClientCache( + NetworkUtils.getServerHostName(server1.getHost()), port1, port2 )); // set a cllabck so that we come to know that whether a failover is called // or not // if failover is called means this bug is present. - // client2.invoke(Bug36805DUnitTest.class, "setClientServerObserver"); - client1.invoke(Bug36805DUnitTest.class, "registerInterest"); // register + // client2.invoke(() -> Bug36805DUnitTest.setClientServerObserver()); + client1.invoke(() -> Bug36805DUnitTest.registerInterest()); // register // interest // shoud not // cause any // failure - client2.invoke(Bug36805DUnitTest.class, "verifyDeadAndLiveServers", - new Object[] { new Integer(0), new Integer(2) }); - client1.invoke(Bug36805DUnitTest.class, "verifyDeadAndLiveServers", - new Object[] { new Integer(0), new Integer(2) }); + client2.invoke(() -> Bug36805DUnitTest.verifyDeadAndLiveServers( new Integer(0), new Integer(2) )); + client1.invoke(() -> Bug36805DUnitTest.verifyDeadAndLiveServers( new Integer(0), new Integer(2) )); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java index ceac13b..def774a 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java @@ -62,16 +62,14 @@ public class Bug36829DUnitTest extends DistributedTestCase { final int durableClientTimeout = 600; // keep the client alive for 600 - PORT = ((Integer)this.serverVM.invoke(CacheServerTestUtil.class, - "createCacheServer", new Object[] { "DUMMY_REGION", new Boolean(true) - })).intValue(); + PORT = ((Integer)this.serverVM.invoke(() -> CacheServerTestUtil.createCacheServer( "DUMMY_REGION", new Boolean(true) + ))).intValue(); - this.ClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] { + this.ClientVM.invoke(() -> CacheServerTestUtil.createCacheClient( getClientPool(NetworkUtils.getServerHostName(ClientVM.getHost()), PORT, true, 0), regionName, getClientDistributedSystemProperties(durableClientId, - durableClientTimeout), Boolean.TRUE }); + durableClientTimeout), Boolean.TRUE )); // Send clientReady message this.ClientVM.invoke(new CacheSerializableRunnable("Send clientReady") { @@ -82,23 +80,20 @@ public class Bug36829DUnitTest extends DistributedTestCase { // We expect in registerKey() that the RegionNotFoundException is thrown. // If exception is not thrown then the test fails. - this.ClientVM.invoke(Bug36829DUnitTest.class, "registerKey", - new Object[] { "Key1" }); + this.ClientVM.invoke(() -> Bug36829DUnitTest.registerKey( "Key1" )); // creating REgion on the Server -/* this.serverVM.invoke(CacheServerTestUtil.class, "createRegion", - new Object[] { regionName }); +/* this.serverVM.invoke(() -> CacheServerTestUtil.createRegion( regionName )); // should be successful. - this.ClientVM.invoke(Bug36829DUnitTest.class, "registerKeyAfterRegionCreation", - new Object[] { "Key1" });*/ + this.ClientVM.invoke(() -> Bug36829DUnitTest.registerKeyAfterRegionCreation( "Key1" ));*/ // Stop the durable client - this.ClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.ClientVM.invoke(() -> CacheServerTestUtil.closeCache()); // Stop server 1 - this.serverVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.serverVM.invoke(() -> CacheServerTestUtil.closeCache()); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java index 872f95c..30fb4c6 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java @@ -142,9 +142,9 @@ public class Bug36995DUnitTest extends DistributedTestCase @Override protected final void preTearDown() throws Exception { closeCache(); - server1.invoke(Bug36995DUnitTest.class, "closeCache"); - server2.invoke(Bug36995DUnitTest.class, "closeCache"); - server3.invoke(Bug36995DUnitTest.class, "closeCache"); + server1.invoke(() -> Bug36995DUnitTest.closeCache()); + server2.invoke(() -> Bug36995DUnitTest.closeCache()); + server3.invoke(() -> Bug36995DUnitTest.closeCache()); } public static void closeCache() @@ -160,12 +160,9 @@ public class Bug36995DUnitTest extends DistributedTestCase */ public void testBug36995_Default() { - Integer port1 = ((Integer)server1.invoke(Bug36995DUnitTest.class, - "createServerCache")); - Integer port2 = ((Integer)server2.invoke(Bug36995DUnitTest.class, - "createServerCache")); - Integer port3 = ((Integer)server3.invoke(Bug36995DUnitTest.class, - "createServerCache")); + Integer port1 = ((Integer)server1.invoke(() -> Bug36995DUnitTest.createServerCache())); + Integer port2 = ((Integer)server2.invoke(() -> Bug36995DUnitTest.createServerCache())); + Integer port3 = ((Integer)server3.invoke(() -> Bug36995DUnitTest.createServerCache())); createClientCacheWithDefaultMessageTrackingTimeout( NetworkUtils.getServerHostName(server1.getHost()), port1.intValue(), port2 .intValue(), port3.intValue()); @@ -180,12 +177,9 @@ public class Bug36995DUnitTest extends DistributedTestCase { //work around GEODE-507 IgnoredException.addIgnoredException("Connection reset"); - Integer port1 = ((Integer)server1.invoke(Bug36995DUnitTest.class, - "createServerCache")); - Integer port2 = ((Integer)server2.invoke(Bug36995DUnitTest.class, - "createServerCache")); - Integer port3 = ((Integer)server3.invoke(Bug36995DUnitTest.class, - "createServerCache")); + Integer port1 = ((Integer)server1.invoke(() -> Bug36995DUnitTest.createServerCache())); + Integer port2 = ((Integer)server2.invoke(() -> Bug36995DUnitTest.createServerCache())); + Integer port3 = ((Integer)server3.invoke(() -> Bug36995DUnitTest.createServerCache())); createClientCache(NetworkUtils.getServerHostName(server1.getHost()), port1.intValue(), port2.intValue(), port3.intValue()); assertEquals(54321, pool.getSubscriptionMessageTrackingTimeout()); @@ -196,16 +190,13 @@ public class Bug36995DUnitTest extends DistributedTestCase */ public void testBug36526() { - Integer port1 = ((Integer)server1.invoke(Bug36995DUnitTest.class, - "createServerCache")); - Integer port2 = ((Integer)server2.invoke(Bug36995DUnitTest.class, - "createServerCache")); - Integer port3 = ((Integer)server3.invoke(Bug36995DUnitTest.class, - "createServerCache")); + Integer port1 = ((Integer)server1.invoke(() -> Bug36995DUnitTest.createServerCache())); + Integer port2 = ((Integer)server2.invoke(() -> Bug36995DUnitTest.createServerCache())); + Integer port3 = ((Integer)server3.invoke(() -> Bug36995DUnitTest.createServerCache())); createClientCache(NetworkUtils.getServerHostName(server1.getHost()), port1.intValue(), port2.intValue(), port3.intValue()); verifyDeadAndLiveServers(0, 3); - server2.invoke(Bug36995DUnitTest.class, "stopServer"); + server2.invoke(() -> Bug36995DUnitTest.stopServer()); verifyDeadAndLiveServers(1, 2); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java index 050a8fc..994da58 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java @@ -92,7 +92,7 @@ public class Bug37210DUnitTest extends DistributedTestCase server = host.getVM(0); client = host.getVM(2); PORT = ((Integer)server - .invoke(Bug37210DUnitTest.class, "createServerCache")).intValue(); + .invoke(() -> Bug37210DUnitTest.createServerCache())).intValue(); } /** @@ -126,10 +126,10 @@ public class Bug37210DUnitTest extends DistributedTestCase @Override protected final void preTearDown() throws Exception { // close client - client.invoke(Bug37210DUnitTest.class, "closeCache"); + client.invoke(() -> Bug37210DUnitTest.closeCache()); // close server - server.invoke(Bug37210DUnitTest.class, "closeCache"); + server.invoke(() -> Bug37210DUnitTest.closeCache()); } /** @@ -149,17 +149,14 @@ public class Bug37210DUnitTest extends DistributedTestCase LogWriterUtils.getLogWriter().info("testHAStatsCleanup : BEGIN"); IgnoredException.addIgnoredException("java.net.SocketException"); IgnoredException.addIgnoredException("Unexpected IOException"); - client.invoke(Bug37210DUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT) }); - server.invoke(Bug37210DUnitTest.class, "doEntryOperations"); + client.invoke(() -> Bug37210DUnitTest.createClientCache( NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT) )); + server.invoke(() -> Bug37210DUnitTest.doEntryOperations()); - server.invoke(Bug37210DUnitTest.class, - "closeCacheClientProxyAndVerifyStats"); - client.invoke(Bug37210DUnitTest.class, "closeCache"); + server.invoke(() -> Bug37210DUnitTest.closeCacheClientProxyAndVerifyStats()); + client.invoke(() -> Bug37210DUnitTest.closeCache()); //we don't send close response thus needs to wait for client termination Thread.currentThread().sleep(1000); - server.invoke(Bug37210DUnitTest.class, - "closeCacheClientProxyAndVerifyStats2"); + server.invoke(() -> Bug37210DUnitTest.closeCacheClientProxyAndVerifyStats2()); LogWriterUtils.getLogWriter().info("testHAStatsCleanup : END"); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java index f7adf6a..4c1c896 100644 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java @@ -68,28 +68,26 @@ public class Bug37805DUnitTest extends DistributedTestCase{ @Override protected final void preTearDown() throws Exception { // Stop server 1 - this.server1VM.invoke(CacheServerTestUtil.class, "closeCache"); + this.server1VM.invoke(() -> CacheServerTestUtil.closeCache()); CacheServerTestUtil.resetDisableShufflingOfEndpointsFlag(); } public void testFunctionality() { // Step 1: Starting the servers - PORT1 = ((Integer)this.server1VM.invoke(CacheServerTestUtil.class, - "createCacheServer", new Object[] { regionName, new Boolean(true), - })).intValue(); + PORT1 = ((Integer)this.server1VM.invoke(() -> CacheServerTestUtil.createCacheServer( regionName, new Boolean(true), + ))).intValue(); final int durableClientTimeout = 600; // Step 2: Starting Client and creating durableRegion final String durableClientId = getName() + "_client"; - this.durableClientVM.invoke(CacheServerTestUtil.class, "createCacheClient", - new Object[] { + this.durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient( getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), PORT1, true, 0), regionName, getDurableClientDistributedSystemProperties(durableClientId, - durableClientTimeout), Boolean.TRUE }); + durableClientTimeout), Boolean.TRUE )); // Send clientReady message this.durableClientVM.invoke(new CacheSerializableRunnable( @@ -99,10 +97,10 @@ public class Bug37805DUnitTest extends DistributedTestCase{ } }); - this.server1VM.invoke(Bug37805DUnitTest.class, "checkRootRegions"); + this.server1VM.invoke(() -> Bug37805DUnitTest.checkRootRegions()); - this.durableClientVM.invoke(CacheServerTestUtil.class, "closeCache"); + this.durableClientVM.invoke(() -> CacheServerTestUtil.closeCache()); } public static void checkRootRegions() { http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsDUnitTest.java index 236076a..bdc96a7 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsDUnitTest.java @@ -115,30 +115,26 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase public void testOneServerToClientTransactionsPropagation() { Integer port1 = initServerCache(server1); - client1.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1 }); - client2.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1 }); + client1.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1 )); + client2.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1 )); Wait.pause(PAUSE); server1.invoke(resetFlags()); client1.invoke(resetFlags()); client2.invoke(resetFlags()); - server1.invoke(CacheServerTransactionsDUnitTest.class, "putInTransaction", - new Object[] { "server1" }); + server1.invoke(() -> CacheServerTransactionsDUnitTest.putInTransaction( "server1" )); Wait.pause(PAUSE); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyNotUpdated"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyNotUpdated"); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyNotUpdated()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyNotUpdated()); - server1.invoke(CacheServerTransactionsDUnitTest.class, - "commitTransactionOnServer1"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.commitTransactionOnServer1()); Wait.pause(PAUSE); - server1.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); } @@ -152,10 +148,8 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase { Integer port1 = initServerCache(server1); Integer port2 = initServerCache(server2); - client1.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2 }); - client2.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2 }); + client1.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1, port2 )); + client2.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1, port2 )); Wait.pause(PAUSE); server1.invoke(resetFlags()); @@ -163,22 +157,20 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase client1.invoke(resetFlags()); client2.invoke(resetFlags()); - server1.invoke(CacheServerTransactionsDUnitTest.class, "putInTransaction", - new Object[] { "server1" }); + server1.invoke(() -> CacheServerTransactionsDUnitTest.putInTransaction( "server1" )); Wait.pause(PAUSE); - server2.invoke(CacheServerTransactionsDUnitTest.class, "verifyNotUpdated"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyNotUpdated"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyNotUpdated"); + server2.invoke(() -> CacheServerTransactionsDUnitTest.verifyNotUpdated()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyNotUpdated()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyNotUpdated()); - server1.invoke(CacheServerTransactionsDUnitTest.class, - "commitTransactionOnServer1"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.commitTransactionOnServer1()); Wait.pause(PAUSE); - server1.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); - server2.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); + server2.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); } /** @@ -190,10 +182,8 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase { Integer port1 = initServerCache(server1); Integer port2 = initServerCache(server2); - client1.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1 }); - client2.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port2 }); + client1.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1 )); + client2.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port2 )); Wait.pause(PAUSE); server1.invoke(resetFlags()); @@ -201,22 +191,20 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase client1.invoke(resetFlags()); client2.invoke(resetFlags()); - server1.invoke(CacheServerTransactionsDUnitTest.class, "putInTransaction", - new Object[] { "server1" }); + server1.invoke(() -> CacheServerTransactionsDUnitTest.putInTransaction( "server1" )); Wait.pause(PAUSE); - server2.invoke(CacheServerTransactionsDUnitTest.class, "verifyNotUpdated"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyNotUpdated"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyNotUpdated"); + server2.invoke(() -> CacheServerTransactionsDUnitTest.verifyNotUpdated()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyNotUpdated()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyNotUpdated()); - server1.invoke(CacheServerTransactionsDUnitTest.class, - "commitTransactionOnServer1"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.commitTransactionOnServer1()); Wait.pause(PAUSE); - server1.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); - server2.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdates"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); + server2.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates()); } /** @@ -226,25 +214,21 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase public void testInvalidatesOneServerToClientTransactionsPropagation() { Integer port1 = initServerCache(server1); - client1.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1 }); - client2.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1 }); + client1.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1 )); + client2.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1 )); Wait.pause(PAUSE); server1.invoke(resetFlags()); client1.invoke(resetFlags()); client2.invoke(resetFlags()); - server1.invoke(CacheServerTransactionsDUnitTest.class, "invalidateInTransaction", - new Object[] { "server1" }); - server1.invoke(CacheServerTransactionsDUnitTest.class, - "commitTransactionOnServer1"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.invalidateInTransaction( "server1" )); + server1.invoke(() -> CacheServerTransactionsDUnitTest.commitTransactionOnServer1()); Wait.pause(PAUSE); - server1.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); } /** @@ -255,10 +239,8 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase { Integer port1 = initServerCache(server1); Integer port2 = initServerCache(server2); - client1.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2 }); - client2.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2 }); + client1.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1, port2 )); + client2.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1, port2 )); Wait.pause(PAUSE); server1.invoke(resetFlags()); @@ -266,16 +248,14 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase client1.invoke(resetFlags()); client2.invoke(resetFlags()); - server1.invoke(CacheServerTransactionsDUnitTest.class, "invalidateInTransaction", - new Object[] { "server1" }); - server1.invoke(CacheServerTransactionsDUnitTest.class, - "commitTransactionOnServer1"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.invalidateInTransaction( "server1" )); + server1.invoke(() -> CacheServerTransactionsDUnitTest.commitTransactionOnServer1()); Wait.pause(PAUSE); - server1.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); - server2.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); + server2.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); } /** @@ -287,10 +267,8 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase { Integer port1 = initServerCache(server1); Integer port2 = initServerCache(server2); - client1.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1 }); - client2.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port2 }); + client1.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1 )); + client2.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port2 )); Wait.pause(PAUSE); server1.invoke(resetFlags()); @@ -298,16 +276,14 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase client1.invoke(resetFlags()); client2.invoke(resetFlags()); - server1.invoke(CacheServerTransactionsDUnitTest.class, "invalidateInTransaction", - new Object[] { "server1" }); - server1.invoke(CacheServerTransactionsDUnitTest.class, - "commitTransactionOnServer1"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.invalidateInTransaction( "server1" )); + server1.invoke(() -> CacheServerTransactionsDUnitTest.commitTransactionOnServer1()); Wait.pause(PAUSE); - server1.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); - server2.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyInvalidates"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); + server2.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyInvalidates()); } @@ -319,25 +295,21 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase public void testDestroysOneServerToClientTransactionsPropagation() { Integer port1 = initServerCache(server1); - client1.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1 }); - client2.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1 }); + client1.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1 )); + client2.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1 )); Wait.pause(PAUSE); server1.invoke(resetFlags()); client1.invoke(resetFlags()); client2.invoke(resetFlags()); - server1.invoke(CacheServerTransactionsDUnitTest.class, "destroyInTransaction", - new Object[] { "server1" }); - server1.invoke(CacheServerTransactionsDUnitTest.class, - "commitTransactionOnServer1"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.destroyInTransaction( "server1" )); + server1.invoke(() -> CacheServerTransactionsDUnitTest.commitTransactionOnServer1()); Wait.pause(PAUSE); - server1.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); } /** @@ -348,10 +320,8 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase { Integer port1 = initServerCache(server1); Integer port2 = initServerCache(server2); - client1.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2 }); - client2.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1, port2 }); + client1.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1, port2 )); + client2.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1, port2 )); Wait.pause(PAUSE); server1.invoke(resetFlags()); @@ -359,16 +329,14 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase client1.invoke(resetFlags()); client2.invoke(resetFlags()); - server1.invoke(CacheServerTransactionsDUnitTest.class, "destroyInTransaction", - new Object[] { "server1" }); - server1.invoke(CacheServerTransactionsDUnitTest.class, - "commitTransactionOnServer1"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.destroyInTransaction( "server1" )); + server1.invoke(() -> CacheServerTransactionsDUnitTest.commitTransactionOnServer1()); Wait.pause(PAUSE); - server1.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); - server2.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); + server2.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); } @@ -380,10 +348,8 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase { Integer port1 = initServerCache(server1); Integer port2 = initServerCache(server2); - client1.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1 }); - client2.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port2 }); + client1.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1 )); + client2.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port2 )); Wait.pause(PAUSE); server1.invoke(resetFlags()); @@ -391,16 +357,14 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase client1.invoke(resetFlags()); client2.invoke(resetFlags()); - server1.invoke(CacheServerTransactionsDUnitTest.class, "destroyInTransaction", - new Object[] { "server1" }); - server1.invoke(CacheServerTransactionsDUnitTest.class, - "commitTransactionOnServer1"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.destroyInTransaction( "server1" )); + server1.invoke(() -> CacheServerTransactionsDUnitTest.commitTransactionOnServer1()); Wait.pause(PAUSE); - server1.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); - server2.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); - client1.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyDestroys"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); + server2.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); + client1.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyDestroys()); } /** @@ -409,20 +373,16 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase * */ public void YOGESH_testClientToServerCommits(){ - Integer port1 = ((Integer)server1.invoke( - CacheServerTransactionsDUnitTest.class, "createServerCache")); - Integer port2 = ((Integer)server2.invoke( - CacheServerTransactionsDUnitTest.class, "createServerCache")); - client1.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port1 }); - client2.invoke(CacheServerTransactionsDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), port2 }); - client1.invoke(CacheServerTransactionsDUnitTest.class, "commitTransactionOnClient"); + Integer port1 = ((Integer)server1.invoke(() -> CacheServerTransactionsDUnitTest.createServerCache())); + Integer port2 = ((Integer)server2.invoke(() -> CacheServerTransactionsDUnitTest.createServerCache())); + client1.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port1 )); + client2.invoke(() -> CacheServerTransactionsDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), port2 )); + client1.invoke(() -> CacheServerTransactionsDUnitTest.commitTransactionOnClient()); Wait.pause(PAUSE); - server1.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdatesOnServer"); - server2.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdatesOnServer"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "verifyUpdatesOnServer"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdatesOnServer()); + server2.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdatesOnServer()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdatesOnServer()); } private CacheSerializableRunnable resetFlags() @@ -846,10 +806,10 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase @Override protected final void preTearDown() throws Exception { // close the clients first - client1.invoke(CacheServerTransactionsDUnitTest.class, "closeCache"); - client2.invoke(CacheServerTransactionsDUnitTest.class, "closeCache"); + client1.invoke(() -> CacheServerTransactionsDUnitTest.closeCache()); + client2.invoke(() -> CacheServerTransactionsDUnitTest.closeCache()); // then close the servers - server1.invoke(CacheServerTransactionsDUnitTest.class, "closeCache"); - server2.invoke(CacheServerTransactionsDUnitTest.class, "closeCache"); + server1.invoke(() -> CacheServerTransactionsDUnitTest.closeCache()); + server2.invoke(() -> CacheServerTransactionsDUnitTest.closeCache()); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClearPropagationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClearPropagationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClearPropagationDUnitTest.java index 15beecd..e71bebb 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClearPropagationDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClearPropagationDUnitTest.java @@ -100,15 +100,11 @@ public class ClearPropagationDUnitTest extends DistributedTestCase //client 2 VM client2 = host.getVM(3); - int PORT1 = ((Integer)server1.invoke(ClearPropagationDUnitTest.class, - "createServerCache")).intValue(); - int PORT2 = ((Integer)server2.invoke(ClearPropagationDUnitTest.class, - "createServerCache")).intValue(); + int PORT1 = ((Integer)server1.invoke(() -> ClearPropagationDUnitTest.createServerCache())).intValue(); + int PORT2 = ((Integer)server2.invoke(() -> ClearPropagationDUnitTest.createServerCache())).intValue(); - client1.invoke(ClearPropagationDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), new Integer(PORT1), new Integer(PORT2) }); - client2.invoke(ClearPropagationDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(server1.getHost()), new Integer(PORT1), new Integer(PORT2) }); + client1.invoke(() -> ClearPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), new Integer(PORT1), new Integer(PORT2) )); + client2.invoke(() -> ClearPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()), new Integer(PORT1), new Integer(PORT2) )); CacheObserverHolder.setInstance(new CacheObserverAdapter()); @@ -151,26 +147,24 @@ public class ClearPropagationDUnitTest extends DistributedTestCase //First create entries on both servers via the two client - client1.invoke(ClearPropagationDUnitTest.class, "createEntriesK1andK2"); - client2.invoke(ClearPropagationDUnitTest.class, "createEntriesK1andK2"); - client1.invoke(ClearPropagationDUnitTest.class, "registerKeysK1andK2"); - client2.invoke(ClearPropagationDUnitTest.class, "registerKeysK1andK2"); + client1.invoke(() -> ClearPropagationDUnitTest.createEntriesK1andK2()); + client2.invoke(() -> ClearPropagationDUnitTest.createEntriesK1andK2()); + client1.invoke(() -> ClearPropagationDUnitTest.registerKeysK1andK2()); + client2.invoke(() -> ClearPropagationDUnitTest.registerKeysK1andK2()); server1.invoke(checkSizeRegion(2, false/*Do not Block*/)); server2.invoke(checkSizeRegion(2, false/*Do not Block*/)); client1.invoke(checkSizeRegion(2, false/*Do not Block*/)); client2.invoke(checkSizeRegion(2, false/*Do not Block*/)); - client1.invoke(ClearPropagationDUnitTest.class, - "acquireConnectionsAndClear", - new Object[] { NetworkUtils.getServerHostName(client1.getHost())}); + client1.invoke(() -> ClearPropagationDUnitTest.acquireConnectionsAndClear( NetworkUtils.getServerHostName(client1.getHost()))); client1.invoke(checkSizeRegion(2, false/*Do not Block*/)); client2.invoke(checkSizeRegion(0, true /* block*/)); server1.invoke(checkSizeRegion(0, false/*Do not Block*/)); server2.invoke(checkSizeRegion(0, false/*Do not Block*/)); - client1.invoke(ClearPropagationDUnitTest.class, "verifyNoUpdates"); + client1.invoke(() -> ClearPropagationDUnitTest.verifyNoUpdates()); } @@ -202,26 +196,24 @@ public class ClearPropagationDUnitTest extends DistributedTestCase client1.invoke(resetFlags); client2.invoke(resetFlags); - client1.invoke(ClearPropagationDUnitTest.class, "createEntriesK1andK2"); - client2.invoke(ClearPropagationDUnitTest.class, "createEntriesK1andK2"); - client1.invoke(ClearPropagationDUnitTest.class, "registerKeysK1andK2"); - client2.invoke(ClearPropagationDUnitTest.class, "registerKeysK1andK2"); + client1.invoke(() -> ClearPropagationDUnitTest.createEntriesK1andK2()); + client2.invoke(() -> ClearPropagationDUnitTest.createEntriesK1andK2()); + client1.invoke(() -> ClearPropagationDUnitTest.registerKeysK1andK2()); + client2.invoke(() -> ClearPropagationDUnitTest.registerKeysK1andK2()); server1.invoke(checkSizeRegion(2, false/*Do not Block*/)); server2.invoke(checkSizeRegion(2, false/*Do not Block*/)); client1.invoke(checkSizeRegion(2, false/*Do not Block*/)); client2.invoke(checkSizeRegion(2, false/*Do not Block*/)); - client1.invoke(ClearPropagationDUnitTest.class, - "acquireConnectionsAndDestroyRegion", - new Object[] { NetworkUtils.getServerHostName(client1.getHost())}); + client1.invoke(() -> ClearPropagationDUnitTest.acquireConnectionsAndDestroyRegion( NetworkUtils.getServerHostName(client1.getHost()))); client1.invoke(checkSizeRegion(2, false/*Do not Block*/)); client2.invoke(checkDestroyRegion(true /* block*/)); server1.invoke(checkDestroyRegion(false/*Do not Block*/)); server2.invoke(checkDestroyRegion(false/*Do not Block*/)); - client1.invoke(ClearPropagationDUnitTest.class, "verifyNoUpdates"); + client1.invoke(() -> ClearPropagationDUnitTest.verifyNoUpdates()); } @@ -479,10 +471,10 @@ public class ClearPropagationDUnitTest extends DistributedTestCase @Override protected final void preTearDown() throws Exception { //close client - client1.invoke(ClearPropagationDUnitTest.class, "closeCache"); - client2.invoke(ClearPropagationDUnitTest.class, "closeCache"); + client1.invoke(() -> ClearPropagationDUnitTest.closeCache()); + client2.invoke(() -> ClearPropagationDUnitTest.closeCache()); //close server - server1.invoke(ClearPropagationDUnitTest.class, "closeCache"); - server2.invoke(ClearPropagationDUnitTest.class, "closeCache"); + server1.invoke(() -> ClearPropagationDUnitTest.closeCache()); + server2.invoke(() -> ClearPropagationDUnitTest.closeCache()); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientConflationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientConflationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientConflationDUnitTest.java index 3a7c246..21a920f 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientConflationDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientConflationDUnitTest.java @@ -81,8 +81,8 @@ public class ClientConflationDUnitTest extends DistributedTestCase vm0 = host.getVM(0); vm1 = host.getVM(1); setIsSlowStart(); - vm0.invoke(ClientConflationDUnitTest.class, "setIsSlowStart"); - PORT = ((Integer)vm0.invoke(ClientConflationDUnitTest.class, "createServerCache" )).intValue(); + vm0.invoke(() -> ClientConflationDUnitTest.setIsSlowStart()); + PORT = ((Integer)vm0.invoke(() -> ClientConflationDUnitTest.createServerCache())).intValue(); } private Cache createCache(Properties props) throws Exception @@ -134,19 +134,19 @@ public class ClientConflationDUnitTest extends DistributedTestCase private void performSteps(String conflation) throws Exception { createClientCacheFeeder(NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT)); - vm1.invoke(ClientConflationDUnitTest.class, "createClientCache", new Object[] { NetworkUtils.getServerHostName(vm1.getHost()), new Integer(PORT), - conflation}); - vm1.invoke(ClientConflationDUnitTest.class, "setClientServerObserverForBeforeInterestRecovery"); - vm1.invoke(ClientConflationDUnitTest.class, "setAllCountersZero"); - vm1.invoke(ClientConflationDUnitTest.class, "assertAllCountersZero"); - vm1.invoke(ClientConflationDUnitTest.class, "registerInterest"); + vm1.invoke(() -> ClientConflationDUnitTest.createClientCache( NetworkUtils.getServerHostName(vm1.getHost()), new Integer(PORT), + conflation)); + vm1.invoke(() -> ClientConflationDUnitTest.setClientServerObserverForBeforeInterestRecovery()); + vm1.invoke(() -> ClientConflationDUnitTest.setAllCountersZero()); + vm1.invoke(() -> ClientConflationDUnitTest.assertAllCountersZero()); + vm1.invoke(() -> ClientConflationDUnitTest.registerInterest()); putEntries(); - vm0.invoke(ConflationDUnitTest.class, "unsetIsSlowStart"); + vm0.invoke(() -> ConflationDUnitTest.unsetIsSlowStart()); Thread.sleep(20000); - vm0.invoke(ClientConflationDUnitTest.class, "assertAllQueuesEmpty"); + vm0.invoke(() -> ClientConflationDUnitTest.assertAllQueuesEmpty()); - vm1.invoke(ClientConflationDUnitTest.class, "assertCounterSizes", new Object[] {conflation}); - vm1.invoke(ClientConflationDUnitTest.class, "assertValue"); + vm1.invoke(() -> ClientConflationDUnitTest.assertCounterSizes(conflation)); + vm1.invoke(() -> ClientConflationDUnitTest.assertValue()); } /** @@ -532,9 +532,9 @@ public class ClientConflationDUnitTest extends DistributedTestCase protected final void preTearDown() throws Exception { // close client closeCacheFeeder(); - vm1.invoke(ClientConflationDUnitTest.class, "closeCacheClient"); + vm1.invoke(() -> ClientConflationDUnitTest.closeCacheClient()); // close server - vm0.invoke(ClientConflationDUnitTest.class, "closeCacheServer"); + vm0.invoke(() -> ClientConflationDUnitTest.closeCacheServer()); } } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java index 22f36cd..3d0364c 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java @@ -185,81 +185,77 @@ public class ClientInterestNotifyDUnitTest extends DistributedTestCase PORT = createServerCache(); // Create a feeder. - vm0.invoke(ClientInterestNotifyDUnitTest.class, "createClientCacheFeeder", - new Object[] {NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT)}); + vm0.invoke(() -> ClientInterestNotifyDUnitTest.createClientCacheFeeder(NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT))); // Client 1 overrides NBS to true. // Client 2 "overrides" NSB to false. // Client 3 uses the default NBS which is false on the server. - vm1.invoke(ClientInterestNotifyDUnitTest.class, "createClientCache", - new Object[] { NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT), "ClientOn"}); + vm1.invoke(() -> ClientInterestNotifyDUnitTest.createClientCache( NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT), "ClientOn")); /* - vm2.invoke(ClientInterestNotifyDUnitTest.class, "createClientCache", - new Object[] { getServerHostName(Host.getHost(0)), new Integer(PORT), - DistributionConfig.NOTIFY_BY_SUBSCRIPTION_OVERRIDE_PROP_VALUE_OFF, "ClientOff"}); - vm3.invoke(ClientInterestNotifyDUnitTest.class, "createClientCache", - new Object[] { getServerHostName(Host.getHost(0)), new Integer(PORT), - DistributionConfig.NOTIFY_BY_SUBSCRIPTION_OVERRIDE_PROP_VALUE_DEFAULT, "ClientDefault"}); + vm2.invoke(() -> ClientInterestNotifyDUnitTest.createClientCache( getServerHostName(Host.getHost(0)), new Integer(PORT), + DistributionConfig.NOTIFY_BY_SUBSCRIPTION_OVERRIDE_PROP_VALUE_OFF, "ClientOff")); + vm3.invoke(() -> ClientInterestNotifyDUnitTest.createClientCache( getServerHostName(Host.getHost(0)), new Integer(PORT), + DistributionConfig.NOTIFY_BY_SUBSCRIPTION_OVERRIDE_PROP_VALUE_DEFAULT, "ClientDefault")); */ // Feeder doFeed does one put on one key for each of the 3 regions so // that the following client RI with ALL_KEYS and KEYS_VALUE result works. - vm0.invoke(ClientInterestNotifyDUnitTest.class, "doFeed"); + vm0.invoke(() -> ClientInterestNotifyDUnitTest.doFeed()); // RI on ALL_KEYS with InterestResultPolicy KEYS_VALUES. - vm1.invoke(ClientInterestNotifyDUnitTest.class, "registerInterest"); + vm1.invoke(() -> ClientInterestNotifyDUnitTest.registerInterest()); /* - vm2.invoke(ClientInterestNotifyDUnitTest.class, "registerInterest"); - vm3.invoke(ClientInterestNotifyDUnitTest.class, "registerInterest"); + vm2.invoke(() -> ClientInterestNotifyDUnitTest.registerInterest()); + vm3.invoke(() -> ClientInterestNotifyDUnitTest.registerInterest()); */ // Get key for region 3 for all clients to check no unwanted notifications // arrive on client 1 region 3 since we do not register interest on any // client but notifications should arrive for client 2 and client 3. - vm1.invoke(ClientInterestNotifyDUnitTest.class, "getEntries"); + vm1.invoke(() -> ClientInterestNotifyDUnitTest.getEntries()); /* - vm2.invoke(ClientInterestNotifyDUnitTest.class, "getEntries"); - vm3.invoke(ClientInterestNotifyDUnitTest.class, "getEntries"); + vm2.invoke(() -> ClientInterestNotifyDUnitTest.getEntries()); + vm3.invoke(() -> ClientInterestNotifyDUnitTest.getEntries()); */ // Feeder doEntryOps does 2 puts, 1 invalidate and 1 destroy on a // single key for each of the 3 regions. - vm0.invoke(ClientInterestNotifyDUnitTest.class, "doEntryOps"); + vm0.invoke(() -> ClientInterestNotifyDUnitTest.doEntryOps()); waitForQueuesToDrain(); // Unregister interest to check it works and no extra notifications received. - vm1.invoke(ClientInterestNotifyDUnitTest.class, "unregisterInterest"); + vm1.invoke(() -> ClientInterestNotifyDUnitTest.unregisterInterest()); /* - vm2.invoke(ClientInterestNotifyDUnitTest.class, "unregisterInterest"); - vm3.invoke(ClientInterestNotifyDUnitTest.class, "unregisterInterest"); + vm2.invoke(() -> ClientInterestNotifyDUnitTest.unregisterInterest()); + vm3.invoke(() -> ClientInterestNotifyDUnitTest.unregisterInterest()); */ // Feeder doEntryOps again does 2 puts, 1 invalidate and 1 destroy on a // single key for each of the 3 regions while no interest on the clients. - vm0.invoke(ClientInterestNotifyDUnitTest.class, "doEntryOps"); + vm0.invoke(() -> ClientInterestNotifyDUnitTest.doEntryOps()); assertAllQueuesEmpty(); // since no client has registered interest // Re-register interest on all clients except for region 3 again. - vm1.invoke(ClientInterestNotifyDUnitTest.class, "registerInterest"); + vm1.invoke(() -> ClientInterestNotifyDUnitTest.registerInterest()); /* - vm2.invoke(ClientInterestNotifyDUnitTest.class, "registerInterest"); - vm3.invoke(ClientInterestNotifyDUnitTest.class, "registerInterest"); + vm2.invoke(() -> ClientInterestNotifyDUnitTest.registerInterest()); + vm3.invoke(() -> ClientInterestNotifyDUnitTest.registerInterest()); */ // Feeder doEntryOps again does 2 puts, 1 invalidate and 1 destroy on a // single key for each of the 3 regions after clients re-register interest. - vm0.invoke(ClientInterestNotifyDUnitTest.class, "doEntryOps"); + vm0.invoke(() -> ClientInterestNotifyDUnitTest.doEntryOps()); waitForQueuesToDrain(); @@ -295,27 +291,18 @@ public class ClientInterestNotifyDUnitTest extends DistributedTestCase // Region 3 of clients 2 and 3 receive an invalidate and a destroy each // because NBS is set to false for those clients. - vm1.invoke(ClientInterestNotifyDUnitTest.class, "doValidation", - new Object[] {REGION_NAME1, 1, 3, 2, 2}); - vm1.invoke(ClientInterestNotifyDUnitTest.class, "doValidation", - new Object[] {REGION_NAME2, 0, 0, 1, 1}); - vm1.invoke(ClientInterestNotifyDUnitTest.class, "doValidation", - new Object[] {REGION_NAME3, 1, 0, 0, 0}); + vm1.invoke(() -> ClientInterestNotifyDUnitTest.doValidation(REGION_NAME1, 1, 3, 2, 2)); + vm1.invoke(() -> ClientInterestNotifyDUnitTest.doValidation(REGION_NAME2, 0, 0, 1, 1)); + vm1.invoke(() -> ClientInterestNotifyDUnitTest.doValidation(REGION_NAME3, 1, 0, 0, 0)); /* - vm2.invoke(ClientInterestNotifyDUnitTest.class, "doValidation", - new Object[] {REGION_NAME1, 0, 0, 1, 1}); - vm2.invoke(ClientInterestNotifyDUnitTest.class, "doValidation", - new Object[] {REGION_NAME2, 0, 0, 1, 1}); - vm2.invoke(ClientInterestNotifyDUnitTest.class, "doValidation", - new Object[] {REGION_NAME3, 1, 0, 1, 1}); - - vm3.invoke(ClientInterestNotifyDUnitTest.class, "doValidation", - new Object[] {REGION_NAME1, 0, 0, 1, 1}); - vm3.invoke(ClientInterestNotifyDUnitTest.class, "doValidation", - new Object[] {REGION_NAME2, 0, 0, 1, 1}); - vm3.invoke(ClientInterestNotifyDUnitTest.class, "doValidation", - new Object[] {REGION_NAME3, 1, 0, 1, 1}); + vm2.invoke(() -> ClientInterestNotifyDUnitTest.doValidation(REGION_NAME1, 0, 0, 1, 1)); + vm2.invoke(() -> ClientInterestNotifyDUnitTest.doValidation(REGION_NAME2, 0, 0, 1, 1)); + vm2.invoke(() -> ClientInterestNotifyDUnitTest.doValidation(REGION_NAME3, 1, 0, 1, 1)); + + vm3.invoke(() -> ClientInterestNotifyDUnitTest.doValidation(REGION_NAME1, 0, 0, 1, 1)); + vm3.invoke(() -> ClientInterestNotifyDUnitTest.doValidation(REGION_NAME2, 0, 0, 1, 1)); + vm3.invoke(() -> ClientInterestNotifyDUnitTest.doValidation(REGION_NAME3, 1, 0, 1, 1)); */ } @@ -639,11 +626,11 @@ public class ClientInterestNotifyDUnitTest extends DistributedTestCase */ @Override protected final void preTearDown() throws Exception { - vm0.invoke(ClientInterestNotifyDUnitTest.class, "closeCache"); - vm1.invoke(ClientInterestNotifyDUnitTest.class, "closeCache"); + vm0.invoke(() -> ClientInterestNotifyDUnitTest.closeCache()); + vm1.invoke(() -> ClientInterestNotifyDUnitTest.closeCache()); /* - vm2.invoke(ClientInterestNotifyDUnitTest.class, "closeCache"); - vm3.invoke(ClientInterestNotifyDUnitTest.class, "closeCache"); + vm2.invoke(() -> ClientInterestNotifyDUnitTest.closeCache()); + vm3.invoke(() -> ClientInterestNotifyDUnitTest.closeCache()); */ closeCacheServer(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java index 0f40428..2170ce9 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerMiscDUnitTest.java @@ -148,8 +148,8 @@ public class ClientServerMiscDUnitTest extends CacheTestCase int port1 = initServerCache(true); // vm0 int port2 = initServerCache2(true); // vm1 String serverName = NetworkUtils.getServerHostName(Host.getHost(0)); - host.getVM(2).invoke(this.getClass(), "createClientCacheV", new Object[]{serverName, port1}); - host.getVM(3).invoke(this.getClass(), "createClientCacheV", new Object[]{serverName, port2}); + host.getVM(2).invoke(() -> this.createClientCacheV(serverName, port1)); + host.getVM(3).invoke(() -> this.createClientCacheV(serverName, port2)); LogWriterUtils.getLogWriter().info("Testing concurrent map operations from a client with a distributed region"); concurrentMapTest(host.getVM(2), "/" + REGION_NAME1); // TODO add verification in vm3 @@ -162,8 +162,8 @@ public class ClientServerMiscDUnitTest extends CacheTestCase int port1 = initServerCache(true); // vm0 int port2 = initServerCache2(true); // vm1 String serverName = NetworkUtils.getServerHostName(Host.getHost(0)); - host.getVM(2).invoke(this.getClass(), "createEmptyClientCache", new Object[]{serverName, port1}); - host.getVM(3).invoke(this.getClass(), "createClientCacheV", new Object[]{serverName, port2}); + host.getVM(2).invoke(() -> this.createEmptyClientCache(serverName, port1)); + host.getVM(3).invoke(() -> this.createClientCacheV(serverName, port2)); LogWriterUtils.getLogWriter().info("Testing concurrent map operations from a client with a distributed region"); concurrentMapTest(host.getVM(2), "/" + REGION_NAME1); // TODO add verification in vm3 @@ -382,7 +382,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1); populateCache(); registerInterest(); - server1.invoke(ClientServerMiscDUnitTest.class, "put"); + server1.invoke(() -> ClientServerMiscDUnitTest.put()); // pause(5000 + 5000 + 10000); /*final int maxWaitTime = Integer.getInteger(WAIT_PROPERTY, WAIT_DEFAULT).intValue(); @@ -417,9 +417,8 @@ public class ClientServerMiscDUnitTest extends CacheTestCase registerInterestInBothTheRegions(); closeRegion1(); Wait.pause(6000); - server1.invoke(ClientServerMiscDUnitTest.class, - "verifyInterestListOnServer"); - server1.invoke(ClientServerMiscDUnitTest.class, "put"); + server1.invoke(() -> ClientServerMiscDUnitTest.verifyInterestListOnServer()); + server1.invoke(() -> ClientServerMiscDUnitTest.put()); //pause(5000); verifyUpdatesOnRegion2(); } @@ -443,8 +442,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase assertEquals(false, pool.isDestroyed()); pool.destroy(); assertEquals(true, pool.isDestroyed()); - server1.invoke(ClientServerMiscDUnitTest.class, - "verifyNoCacheClientProxyOnServer"); + server1.invoke(() -> ClientServerMiscDUnitTest.verifyNoCacheClientProxyOnServer()); } @@ -465,9 +463,8 @@ public class ClientServerMiscDUnitTest extends CacheTestCase PoolImpl pool = (PoolImpl)createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)),PORT1); destroyRegion1(); // pause(5000); - server1.invoke(ClientServerMiscDUnitTest.class, - "verifyCacheClientProxyOnServer", new Object[] { new String( - REGION_NAME1) }); + server1.invoke(() -> ClientServerMiscDUnitTest.verifyCacheClientProxyOnServer( new String( + REGION_NAME1) )); Connection conn = pool.acquireConnection(); assertNotNull(conn); assertEquals(1, pool.getConnectedServerCount()); @@ -479,8 +476,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase pool.destroy(); assertEquals(true, pool.isDestroyed()); // pause(5000); - server1.invoke(ClientServerMiscDUnitTest.class, - "verifyNoCacheClientProxyOnServer"); + server1.invoke(() -> ClientServerMiscDUnitTest.verifyNoCacheClientProxyOnServer()); try { getCache().createRegion(REGION_NAME2, attrs); fail("expected IllegalStateException"); @@ -502,7 +498,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1); registerInterestForInvalidatesInBothTheRegions(); populateCache(); - server1.invoke(ClientServerMiscDUnitTest.class, "put"); + server1.invoke(() -> ClientServerMiscDUnitTest.put()); //pause(5000); verifyInvalidatesOnBothRegions(); @@ -594,7 +590,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase assertNotNull(conn); populateCache(); - server1.invoke(ClientServerMiscDUnitTest.class, "put"); + server1.invoke(() -> ClientServerMiscDUnitTest.put()); // pause(5000); WaitCriterion wc = new WaitCriterion() { String excuse; @@ -692,8 +688,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase //region1.registerInterest(CacheClientProxy.ALL_KEYS); region2.registerInterest("ALL_KEYS"); Wait.pause(6000); - server1.invoke(ClientServerMiscDUnitTest.class, - "verifyInterestListOnServer"); + server1.invoke(() -> ClientServerMiscDUnitTest.verifyInterestListOnServer()); } /** @@ -1368,7 +1363,7 @@ public class ClientServerMiscDUnitTest extends CacheTestCase // close the clients first closeCache(); // then close the servers - server1.invoke(ClientServerMiscDUnitTest.class, "closeCache"); + server1.invoke(() -> ClientServerMiscDUnitTest.closeCache()); } public static void closeCache() http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConflationDUnitTest.java ---------------------------------------------------------------------- diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConflationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConflationDUnitTest.java index 88bdb20..4844ec8 100755 --- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConflationDUnitTest.java +++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ConflationDUnitTest.java @@ -90,7 +90,7 @@ public class ConflationDUnitTest extends DistributedTestCase final Host host = Host.getHost(0); vm0 = host.getVM(0); vm2 = host.getVM(2); - PORT = ((Integer)vm0.invoke(ConflationDUnitTest.class, "createServerCache" )).intValue(); + PORT = ((Integer)vm0.invoke(() -> ConflationDUnitTest.createServerCache())).intValue(); } private Cache createCache(Properties props) throws Exception @@ -140,24 +140,23 @@ public class ConflationDUnitTest extends DistributedTestCase public void testTwoRegionsTwoWriters() { try { - vm0.invoke(ConflationDUnitTest.class, "setIsSlowStart"); + vm0.invoke(() -> ConflationDUnitTest.setIsSlowStart()); createClientCache1UniqueWriter ( NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT)); - vm2.invoke(ConflationDUnitTest.class, "createClientCache2UniqueWriter", - new Object[] { NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT)}); - vm2.invoke(ConflationDUnitTest.class, "setClientServerObserverForBeforeInterestRecovery"); - vm2.invoke(ConflationDUnitTest.class, "setAllCountersZero"); - vm2.invoke(ConflationDUnitTest.class, "assertAllCountersZero"); - vm2.invoke(ConflationDUnitTest.class, "registerInterest"); + vm2.invoke(() -> ConflationDUnitTest.createClientCache2UniqueWriter( NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT))); + vm2.invoke(() -> ConflationDUnitTest.setClientServerObserverForBeforeInterestRecovery()); + vm2.invoke(() -> ConflationDUnitTest.setAllCountersZero()); + vm2.invoke(() -> ConflationDUnitTest.assertAllCountersZero()); + vm2.invoke(() -> ConflationDUnitTest.registerInterest()); create(); put(); createMarker(); - vm2.invoke(ConflationDUnitTest.class, "waitForMarker"); - vm2.invoke(ConflationDUnitTest.class, "assertValue"); - vm2.invoke(ConflationDUnitTest.class, "destroyMarker"); + vm2.invoke(() -> ConflationDUnitTest.waitForMarker()); + vm2.invoke(() -> ConflationDUnitTest.assertValue()); + vm2.invoke(() -> ConflationDUnitTest.destroyMarker()); destroy(); createMarker(); - vm2.invoke(ConflationDUnitTest.class, "waitForMarker"); - vm2.invoke(ConflationDUnitTest.class, "assertCounterSizes"); + vm2.invoke(() -> ConflationDUnitTest.waitForMarker()); + vm2.invoke(() -> ConflationDUnitTest.assertCounterSizes()); } catch( Exception e ) { Assert.fail("Test failed due to exception", e); @@ -171,24 +170,23 @@ public class ConflationDUnitTest extends DistributedTestCase public void testTwoRegionsOneWriter() { try { - vm0.invoke(ConflationDUnitTest.class, "setIsSlowStart"); + vm0.invoke(() -> ConflationDUnitTest.setIsSlowStart()); createClientCache1CommonWriter( NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT)); - vm2.invoke(ConflationDUnitTest.class, "createClientCache2CommonWriter", - new Object[] { NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT)}); - vm2.invoke(ConflationDUnitTest.class, "setClientServerObserverForBeforeInterestRecovery"); - vm2.invoke(ConflationDUnitTest.class, "setAllCountersZero"); - vm2.invoke(ConflationDUnitTest.class, "assertAllCountersZero"); - vm2.invoke(ConflationDUnitTest.class, "registerInterest"); + vm2.invoke(() -> ConflationDUnitTest.createClientCache2CommonWriter( NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT))); + vm2.invoke(() -> ConflationDUnitTest.setClientServerObserverForBeforeInterestRecovery()); + vm2.invoke(() -> ConflationDUnitTest.setAllCountersZero()); + vm2.invoke(() -> ConflationDUnitTest.assertAllCountersZero()); + vm2.invoke(() -> ConflationDUnitTest.registerInterest()); create(); put(); createMarker(); - vm2.invoke(ConflationDUnitTest.class, "waitForMarker"); - vm2.invoke(ConflationDUnitTest.class, "assertValue"); - vm2.invoke(ConflationDUnitTest.class, "destroyMarker"); + vm2.invoke(() -> ConflationDUnitTest.waitForMarker()); + vm2.invoke(() -> ConflationDUnitTest.assertValue()); + vm2.invoke(() -> ConflationDUnitTest.destroyMarker()); destroy(); createMarker(); - vm2.invoke(ConflationDUnitTest.class, "waitForMarker"); - vm2.invoke(ConflationDUnitTest.class, "assertCounterSizes"); + vm2.invoke(() -> ConflationDUnitTest.waitForMarker()); + vm2.invoke(() -> ConflationDUnitTest.assertCounterSizes()); } catch( Exception e ) { Assert.fail("Test failed due to exception", e); @@ -203,27 +201,26 @@ public class ConflationDUnitTest extends DistributedTestCase public void testNotMoreMessagesSent() { try { - vm0.invoke(ConflationDUnitTest.class, "setIsSlowStart"); + vm0.invoke(() -> ConflationDUnitTest.setIsSlowStart()); createClientCache1CommonWriterTest3(NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT)); - vm2.invoke(ConflationDUnitTest.class, - "createClientCache2CommonWriterTest3", new Object[] { - NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT) }); - vm2.invoke(ConflationDUnitTest.class, "setClientServerObserverForBeforeInterestRecovery"); - vm2.invoke(ConflationDUnitTest.class, "setAllCountersZero"); - vm2.invoke(ConflationDUnitTest.class, "assertAllCountersZero"); - vm2.invoke(ConflationDUnitTest.class, "registerInterest"); + vm2.invoke(() -> ConflationDUnitTest.createClientCache2CommonWriterTest3( + NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT) )); + vm2.invoke(() -> ConflationDUnitTest.setClientServerObserverForBeforeInterestRecovery()); + vm2.invoke(() -> ConflationDUnitTest.setAllCountersZero()); + vm2.invoke(() -> ConflationDUnitTest.assertAllCountersZero()); + vm2.invoke(() -> ConflationDUnitTest.registerInterest()); create(); put200(); createMarker(); - vm2.invoke(ConflationDUnitTest.class, "waitForMarker"); - vm2.invoke(ConflationDUnitTest.class, "assertValue"); - vm2.invoke(ConflationDUnitTest.class, "destroyMarker"); + vm2.invoke(() -> ConflationDUnitTest.waitForMarker()); + vm2.invoke(() -> ConflationDUnitTest.assertValue()); + vm2.invoke(() -> ConflationDUnitTest.destroyMarker()); destroy(); createMarker(); - vm2.invoke(ConflationDUnitTest.class, "waitForMarker"); - vm2.invoke(ConflationDUnitTest.class, "assertCounterSizesLessThan200"); - vm0.invoke(ConflationDUnitTest.class, "getStatsOnServer"); - vm0.invoke(ConflationDUnitTest.class, "assertConflationStatus"); + vm2.invoke(() -> ConflationDUnitTest.waitForMarker()); + vm2.invoke(() -> ConflationDUnitTest.assertCounterSizesLessThan200()); + vm0.invoke(() -> ConflationDUnitTest.getStatsOnServer()); + vm0.invoke(() -> ConflationDUnitTest.assertConflationStatus()); } catch (Exception e) { Assert.fail("Test failed due to exception", e); @@ -912,9 +909,9 @@ public class ConflationDUnitTest extends DistributedTestCase protected final void preTearDown() throws Exception { // close client closeCache(); - vm2.invoke(ConflationDUnitTest.class, "closeCache"); + vm2.invoke(() -> ConflationDUnitTest.closeCache()); // close server - vm0.invoke(ConflationDUnitTest.class, "closeCache"); + vm0.invoke(() -> ConflationDUnitTest.closeCache()); } }