You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by up...@apache.org on 2016/02/16 23:11:53 UTC
[33/56] [abbrv] incubator-geode git commit: Automatically converting
calls of vm.invoke to lambdas
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java
index d5b6252..85f3707 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAInterestTestCase.java
@@ -108,9 +108,9 @@ public class HAInterestTestCase extends DistributedTestCase {
server3 = host.getVM(2);
CacheServerTestUtil.disableShufflingOfEndpoints();
// start servers first
- PORT1 = ((Integer) server1.invoke(HAInterestTestCase.class, "createServerCache")).intValue();
- PORT2 = ((Integer) server2.invoke(HAInterestTestCase.class, "createServerCache")).intValue();
- PORT3 = ((Integer) server3.invoke(HAInterestTestCase.class, "createServerCache")).intValue();
+ PORT1 = ((Integer) server1.invoke(() -> HAInterestTestCase.createServerCache())).intValue();
+ PORT2 = ((Integer) server2.invoke(() -> HAInterestTestCase.createServerCache())).intValue();
+ PORT3 = ((Integer) server3.invoke(() -> HAInterestTestCase.createServerCache())).intValue();
exceptionOccured = false;
IgnoredException.addIgnoredException("java.net.ConnectException: Connection refused: connect");
}
@@ -121,9 +121,9 @@ public class HAInterestTestCase extends DistributedTestCase {
closeCache();
// then close the servers
- server1.invoke(HAInterestTestCase.class, "closeCache");
- server2.invoke(HAInterestTestCase.class, "closeCache");
- server3.invoke(HAInterestTestCase.class, "closeCache");
+ server1.invoke(() -> HAInterestTestCase.closeCache());
+ server2.invoke(() -> HAInterestTestCase.closeCache());
+ server3.invoke(() -> HAInterestTestCase.closeCache());
CacheServerTestUtil.resetDisableShufflingOfEndpointsFlag();
}
@@ -307,8 +307,8 @@ public class HAInterestTestCase extends DistributedTestCase {
synchronized (HAInterestTestCase.class) {
Thread t = new Thread() {
public void run() {
- getBackupVM().invoke(HAInterestTestCase.class, "startServer");
- getPrimaryVM().invoke(HAInterestTestCase.class, "stopServer");
+ getBackupVM().invoke(() -> HAInterestTestCase.startServer());
+ getPrimaryVM().invoke(() -> HAInterestTestCase.stopServer());
}
};
t.start();
@@ -361,7 +361,7 @@ public class HAInterestTestCase extends DistributedTestCase {
ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {
public void beforeInterestRegistration() {
synchronized (HAInterestTestCase.class) {
- vm.invoke(HAInterestTestCase.class, "startServer");
+ vm.invoke(() -> HAInterestTestCase.startServer());
HAInterestTestCase.isBeforeRegistrationCallbackCalled = true;
HAInterestTestCase.class.notify();
PoolImpl.BEFORE_REGISTER_CALLBACK_FLAG = false;
@@ -384,7 +384,7 @@ public class HAInterestTestCase extends DistributedTestCase {
ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {
public void afterInterestRegistration() {
synchronized (HAInterestTestCase.class) {
- vm.invoke(HAInterestTestCase.class, "startServer");
+ vm.invoke(() -> HAInterestTestCase.startServer());
HAInterestTestCase.isAfterRegistrationCallbackCalled = true;
HAInterestTestCase.class.notify();
PoolImpl.AFTER_REGISTER_CALLBACK_FLAG = false;
@@ -597,7 +597,7 @@ public class HAInterestTestCase extends DistributedTestCase {
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
// close primaryEP
- getPrimaryVM().invoke(HAInterestTestCase.class, "stopServer");
+ getPrimaryVM().invoke(() -> HAInterestTestCase.stopServer());
List list = new ArrayList();
list.add(k1);
list.add(k2);
@@ -627,7 +627,7 @@ public class HAInterestTestCase extends DistributedTestCase {
Wait.waitForCriterion(wc, TIMEOUT_MILLIS, INTERVAL_MILLIS, true);
// close primaryEP
- getPrimaryVM().invoke(HAInterestTestCase.class, "stopServer");
+ getPrimaryVM().invoke(() -> HAInterestTestCase.stopServer());
List list = new ArrayList();
list.add(k1);
srp.unregisterInterest(list, InterestType.KEY, false, false);
@@ -652,9 +652,9 @@ public class HAInterestTestCase extends DistributedTestCase {
// close primaryEP
VM backup = getBackupVM();
- getPrimaryVM().invoke(HAInterestTestCase.class, "stopServer");
+ getPrimaryVM().invoke(() -> HAInterestTestCase.stopServer());
// close secondary
- backup.invoke(HAInterestTestCase.class, "stopServer");
+ backup.invoke(() -> HAInterestTestCase.stopServer());
List list = new ArrayList();
list.add(k1);
list.add(k2);
@@ -689,7 +689,7 @@ public class HAInterestTestCase extends DistributedTestCase {
// close secondary EP
VM result = getBackupVM();
- result.invoke(HAInterestTestCase.class, "stopServer");
+ result.invoke(() -> HAInterestTestCase.stopServer());
List list = new ArrayList();
list.add(k1);
list.add(k2);
@@ -725,7 +725,7 @@ public class HAInterestTestCase extends DistributedTestCase {
// close secondary EP
VM result = getBackupVM();
- result.invoke(HAInterestTestCase.class, "stopServer");
+ result.invoke(() -> HAInterestTestCase.stopServer());
List list = new ArrayList();
list.add(k1);
srp.unregisterInterest(list, InterestType.KEY, false, false);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
index 01c595c..7395a84 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java
@@ -90,9 +90,9 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
IgnoredException.addIgnoredException("SocketException");
// start servers first
- PORT1 = ((Integer) server1.invoke(HAStartupAndFailoverDUnitTest.class, "createServerCache"));
- PORT2 = ((Integer) server2.invoke(HAStartupAndFailoverDUnitTest.class, "createServerCache"));
- PORT3 = ((Integer) server3.invoke(HAStartupAndFailoverDUnitTest.class, "createServerCache"));
+ PORT1 = ((Integer) server1.invoke(() -> HAStartupAndFailoverDUnitTest.createServerCache()));
+ PORT2 = ((Integer) server2.invoke(() -> HAStartupAndFailoverDUnitTest.createServerCache()));
+ PORT3 = ((Integer) server3.invoke(() -> HAStartupAndFailoverDUnitTest.createServerCache()));
CacheServerTestUtil.disableShufflingOfEndpoints();
}
@@ -105,40 +105,40 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
createClientCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost()));
// primary
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
// secondaries
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
setClientServerObserver();
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
waitForPrimaryIdentification();
//primary
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
unSetClientServerObserver();
//secondary
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
setClientServerObserver();
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
//primary
waitForPrimaryIdentification();
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
unSetClientServerObserver();
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
// All servers are dead at this point , no primary in the system.
verifyDeadAndLiveServers(3,0);
// now start one of the servers
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "startServer");
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.startServer());
// make sure that the server3 which was started recenty was marked live.
verifyDeadAndLiveServers(2,1);
//verify that is it primary , and dispatche is running
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
}
@@ -155,19 +155,19 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
// failed primary due to incorect host name of the server
// new primary
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
//secondary
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
setClientServerObserver();
//stop new primary
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
waitForPrimaryIdentification();
//newly selectd primary
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
unSetClientServerObserver();
}
@@ -182,22 +182,22 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
createClientCacheWithLargeRetryInterval(this.getName(), NetworkUtils.getServerHostName(server1.getHost()));
// primary
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
// secondaries
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
setClientServerObserver();
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
//stop ProbablePrimary
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
// processException();
waitForPrimaryIdentification();
//new primary
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
unSetClientServerObserver();
}
@@ -209,9 +209,9 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
{
createClientCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost()));
verifyPrimaryShouldNotBeNullAndEPListShouldNotBeEmpty();
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
verifyDeadAndLiveServers(3,0);
verifyPrimaryShouldBeNullAndEPListShouldBeEmpty();
}
@@ -222,15 +222,15 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
public void testCacheClientUpdatersInitiatesFailoverOnPrimaryFailure() throws Exception
{
createClientCacheWithLargeRetryInterval(this.getName(), NetworkUtils.getServerHostName(server1.getHost()));
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
setClientServerObserver();
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
waitForPrimaryIdentification();
unSetClientServerObserver();
verifyDeadAndLiveServers(1,2);
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
}
/**
@@ -240,13 +240,13 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
public void testCacheClientUpdaterInitiatesFailoverOnSecondaryFailure() throws Exception
{
createClientCacheWithLargeRetryInterval(this.getName(), NetworkUtils.getServerHostName(server1.getHost()));
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
verifyDeadAndLiveServers(1,2);
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
}
@@ -259,13 +259,13 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
{
createClientCacheWithLargeRetryInterval(this.getName(), NetworkUtils.getServerHostName(server1.getHost()));
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
verifyDeadAndLiveServers(2,1);
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
}
@@ -277,13 +277,13 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
{
createClientCache(this.getName(), NetworkUtils.getServerHostName(server1.getHost()));
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsNotAlive");
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsNotAlive());
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
verifyDeadAndLiveServers(2,1);
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "verifyDispatcherIsAlive");
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.verifyDispatcherIsAlive());
}
/**
@@ -296,7 +296,7 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
// so that only cache operation can detect a server failure and should initiate failover
createClientCacheWithLargeRetryIntervalAndWithoutCallbackConnection(this.getName()
, NetworkUtils.getServerHostName(server1.getHost()));
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "stopServer");
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.stopServer());
put();
verifyDeadAndLiveServers(1,2);
}
@@ -723,9 +723,9 @@ public class HAStartupAndFailoverDUnitTest extends DistributedTestCase
closeCache();
// then close the servers
- server1.invoke(HAStartupAndFailoverDUnitTest.class, "closeCache");
- server2.invoke(HAStartupAndFailoverDUnitTest.class, "closeCache");
- server3.invoke(HAStartupAndFailoverDUnitTest.class, "closeCache");
+ server1.invoke(() -> HAStartupAndFailoverDUnitTest.closeCache());
+ server2.invoke(() -> HAStartupAndFailoverDUnitTest.closeCache());
+ server3.invoke(() -> HAStartupAndFailoverDUnitTest.closeCache());
CacheServerTestUtil.resetDisableShufflingOfEndpointsFlag();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
index c6f71e2..65e78d3 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InstantiatorPropagationDUnitTest.java
@@ -154,11 +154,11 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
protected final void preTearDown() throws Exception {
// close the clients first
closeCache();
- client1.invoke(InstantiatorPropagationDUnitTest.class, "closeCache");
- client2.invoke(InstantiatorPropagationDUnitTest.class, "closeCache");
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.closeCache());
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.closeCache());
- server1.invoke(InstantiatorPropagationDUnitTest.class, "closeCache");
- server1.invoke(InstantiatorPropagationDUnitTest.class, "closeCache");
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.closeCache());
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.closeCache());
}
public static void closeCache() {
@@ -471,24 +471,19 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
Wait.pause(3000);
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject1");
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject2");
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject1());
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject2());
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(2) });
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(2) ));
client1
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT1) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT1) ));
// // wait for client2 to come online
Wait.pause(3000);
//
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(2) });
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(2) ));
//
// // Put some entries from the client
client1.invoke(new CacheSerializableRunnable("Put entries from client") {
@@ -545,13 +540,11 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
Wait.pause(3000);
client1
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT1) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT1) ));
client2
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT2) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT2) ));
unregisterInstantiatorsInAllVMs();
@@ -559,21 +552,16 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
Wait.pause(2000);
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject3");
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject3());
Wait.pause(4000);
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(1) });
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(1) ));
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(1) });
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(1) ));
- server2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(1) });
+ server2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(1) ));
- client2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(1) });
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(1) ));
unregisterInstantiatorsInAllVMs();
}
@@ -589,45 +577,36 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
PORT2 = initServerCache(server2);
client1
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT1) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT1) ));
client2
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT2) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT2) ));
unregisterInstantiatorsInAllVMs();
// wait for client2 to come online
Wait.pause(2000);
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject4");
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject4());
Wait.pause(4000);
- server1.invoke(InstantiatorPropagationDUnitTest.class, "stopServer");
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.stopServer());
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject5");
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject6");
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject5());
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject6());
- server2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithAllPuts) });
+ server2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithAllPuts) ));
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithAllPuts) });
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithAllPuts) ));
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithOnePut) });
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithOnePut) ));
- client2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithAllPuts) });
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithAllPuts) ));
unregisterInstantiatorsInAllVMs();
}
@@ -644,38 +623,30 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
PORT2 = initServerCache(server2);
client1
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT1) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT1) ));
client2
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT2) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT2) ));
unregisterInstantiatorsInAllVMs();
// wait for client2 to come online
Wait.pause(2000);
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject10");
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject10());
Wait.pause(4000);
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject11");
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject11());
Wait.pause(4000);
- server2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(2) });
+ server2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(2) ));
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(2) });
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(2) ));
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(2) });
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(2) ));
- client2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(2) });
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(2) ));
unregisterInstantiatorsInAllVMs();
}
@@ -688,57 +659,46 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
PORT1 = initServerCache(server1);
PORT2 = initServerCache(server2);
client1
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT1) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT1) ));
client2
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT2) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT2) ));
unregisterInstantiatorsInAllVMs();
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject7");
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithOnePut) });
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject7());
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithOnePut) ));
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithOnePut) });
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithOnePut) ));
- server2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithOnePut) });
+ server2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithOnePut) ));
- client2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithOnePut) });
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithOnePut) ));
- server1.invoke(InstantiatorPropagationDUnitTest.class, "stopServer");
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.stopServer());
try {
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject8");
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject8());
}
catch (Exception expected) {// we are putting in a client whose server is
// dead
}
- server1.invoke(InstantiatorPropagationDUnitTest.class, "startServer");
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.startServer());
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithAllPuts) });
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithAllPuts) ));
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithAllPuts) });
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithAllPuts) ));
- server2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(
- instanceCountWithAllPuts) });
+ server2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(
+ instanceCountWithAllPuts) ));
unregisterInstantiatorsInAllVMs();
}
@@ -756,34 +716,27 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
PORT2 = initServerCache(server2);
client1
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT1) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT1) ));
client2
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(server1.getHost()),
- new Integer(PORT1) });
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache( NetworkUtils.getServerHostName(server1.getHost()),
+ new Integer(PORT1) ));
createClientCache(NetworkUtils.getServerHostName(server2.getHost()), new Integer(PORT2));
unregisterInstantiatorsInAllVMs();
// wait for client2 to come online
Wait.pause(2000);
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "registerTestObject12");
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.registerTestObject12());
Wait.pause(4000);
- client1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(1) });
+ client1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(1) ));
- server1.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(1) });
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(1) ));
- server2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(1) });
+ server2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(1) ));
- client2.invoke(InstantiatorPropagationDUnitTest.class,
- "verifyInstantiators", new Object[] { new Integer(1) });
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.verifyInstantiators( new Integer(1) ));
verifyInstantiators(1);
@@ -820,19 +773,16 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
unregisterInstantiatorsInAllVMs();
- client2.invoke(InstantiatorPropagationDUnitTest.class,
- "createClientCache_EventId", new Object[] {
- NetworkUtils.getServerHostName(server1.getHost()), new Integer(PORT2) });
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.createClientCache_EventId(
+ NetworkUtils.getServerHostName(server1.getHost()), new Integer(PORT2) ));
setClientServerObserver1();
- client2.invoke(InstantiatorPropagationDUnitTest.class,
- "setClientServerObserver2");
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.setClientServerObserver2());
registerTestObject19();
Wait.pause(10000);
- Boolean pass = (Boolean)client2.invoke(
- InstantiatorPropagationDUnitTest.class, "verifyResult");
+ Boolean pass = (Boolean)client2.invoke(() -> InstantiatorPropagationDUnitTest.verifyResult());
assertTrue("EventId found Different", pass.booleanValue());
PoolImpl.IS_INSTANTIATOR_CALLBACK = false;
@@ -853,24 +803,23 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
new Integer(PORT1));
client2
- .invoke(InstantiatorPropagationDUnitTest.class, "createClientCache",
- new Object[] {NetworkUtils.getServerHostName(server2.getHost()),
- new Integer(PORT2)});
+ .invoke(() -> InstantiatorPropagationDUnitTest.createClientCache(NetworkUtils.getServerHostName(server2.getHost()),
+ new Integer(PORT2)));
Wait.pause(3000);
unregisterInstantiatorsInAllVMs();
assertTestObject20NotLoaded();
- server1.invoke(InstantiatorPropagationDUnitTest.class, "assertTestObject20NotLoaded");
- server2.invoke(InstantiatorPropagationDUnitTest.class, "assertTestObject20NotLoaded");
- client2.invoke(InstantiatorPropagationDUnitTest.class, "assertTestObject20NotLoaded");
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.assertTestObject20NotLoaded());
+ server2.invoke(() -> InstantiatorPropagationDUnitTest.assertTestObject20NotLoaded());
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.assertTestObject20NotLoaded());
registerTestObject20();
Wait.pause(5000);
assertTestObject20Loaded();
- server1.invoke(InstantiatorPropagationDUnitTest.class, "assertTestObject20Loaded");
- //server2.invoke(InstantiatorPropagationDUnitTest.class, "assertTestObject20Loaded"); // classes are not initialized after loading in p2p path
- client2.invoke(InstantiatorPropagationDUnitTest.class, "assertTestObject20NotLoaded");
+ server1.invoke(() -> InstantiatorPropagationDUnitTest.assertTestObject20Loaded());
+ //server2.invoke(() -> InstantiatorPropagationDUnitTest.assertTestObject20Loaded()); // classes are not initialized after loading in p2p path
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.assertTestObject20NotLoaded());
} finally {
unregisterInstantiatorsInAllVMs();
disconnectAllFromDS();
@@ -976,8 +925,7 @@ public class InstantiatorPropagationDUnitTest extends DistributedTestCase {
{
eventId = eventID;
System.out.println("client2= "+client2 + " eventid= "+eventID);
- client2.invoke(InstantiatorPropagationDUnitTest.class,
- "setEventId", new Object[] { eventId });
+ client2.invoke(() -> InstantiatorPropagationDUnitTest.setEventId( eventId ));
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/69024aa9/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
index 06f599f..d43b067 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListDUnitTest.java
@@ -143,7 +143,7 @@ public class InterestListDUnitTest extends DistributedTestCase
vm1 = host.getVM(1);
vm2 = host.getVM(2);
// start servers first
- PORT1 = ((Integer) vm0.invoke(InterestListDUnitTest.class, "createServerCache")).intValue();
+ PORT1 = ((Integer) vm0.invoke(() -> InterestListDUnitTest.createServerCache())).intValue();
}
/**
@@ -166,41 +166,33 @@ public class InterestListDUnitTest extends DistributedTestCase
public void testInterestListRegistration()
{
- vm1.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)});
- vm2.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)});
+ vm1.invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)));
+ vm2.invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)));
- vm1.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
- vm2.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
+ vm1.invoke(() -> InterestListDUnitTest.createEntriesK1andK2());
+ vm2.invoke(() -> InterestListDUnitTest.createEntriesK1andK2());
- vm1.invoke(InterestListDUnitTest.class, "registerKey",
- new Object[] { key1 });
- vm2.invoke(InterestListDUnitTest.class, "registerKey",
- new Object[] { key2 });
+ vm1.invoke(() -> InterestListDUnitTest.registerKey( key1 ));
+ vm2.invoke(() -> InterestListDUnitTest.registerKey( key2 ));
- vm1.invoke(InterestListDUnitTest.class, "put", new Object[] { "vm1" });
+ vm1.invoke(() -> InterestListDUnitTest.put( "vm1" ));
Wait.pause(10000);
- vm2.invoke(InterestListDUnitTest.class, "validateEntriesK1andK2",
- new Object[] { "vm2" });
- vm2.invoke(InterestListDUnitTest.class, "put", new Object[] { "vm2" });
+ vm2.invoke(() -> InterestListDUnitTest.validateEntriesK1andK2( "vm2" ));
+ vm2.invoke(() -> InterestListDUnitTest.put( "vm2" ));
Wait.pause(10000);
- vm1.invoke(InterestListDUnitTest.class, "validateEntriesK1andK2",
- new Object[] { "vm1" });
+ vm1.invoke(() -> InterestListDUnitTest.validateEntriesK1andK2( "vm1" ));
- vm1.invoke(InterestListDUnitTest.class, "unregisterKey",
- new Object[] { key1 });
- vm2.invoke(InterestListDUnitTest.class, "unregisterKey",
- new Object[] { key2 });
+ vm1.invoke(() -> InterestListDUnitTest.unregisterKey( key1 ));
+ vm2.invoke(() -> InterestListDUnitTest.unregisterKey( key2 ));
- vm1.invoke(InterestListDUnitTest.class, "putAgain", new Object[] { "vm1" });
+ vm1.invoke(() -> InterestListDUnitTest.putAgain( "vm1" ));
Wait.pause(10000);
- vm2.invoke(InterestListDUnitTest.class, "validateEntriesAgain",
- new Object[] { "vm2" });
- vm2.invoke(InterestListDUnitTest.class, "putAgain", new Object[] { "vm2" });
+ vm2.invoke(() -> InterestListDUnitTest.validateEntriesAgain( "vm2" ));
+ vm2.invoke(() -> InterestListDUnitTest.putAgain( "vm2" ));
Wait.pause(10000);
- vm1.invoke(InterestListDUnitTest.class, "validateEntriesAgain",
- new Object[] { "vm1" });
+ vm1.invoke(() -> InterestListDUnitTest.validateEntriesAgain( "vm1" ));
}
/**
@@ -231,53 +223,39 @@ public class InterestListDUnitTest extends DistributedTestCase
{
// Initialization
- vm1.invoke(InterestListDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT1)});
- vm2.invoke(InterestListDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT1)});
+ vm1.invoke(() -> InterestListDUnitTest.createClientCache( NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT1)));
+ vm2.invoke(() -> InterestListDUnitTest.createClientCache( NetworkUtils.getServerHostName(Host.getHost(0)), new Integer(PORT1)));
- vm1.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
- vm2.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
+ vm1.invoke(() -> InterestListDUnitTest.createEntriesK1andK2());
+ vm2.invoke(() -> InterestListDUnitTest.createEntriesK1andK2());
// STEP 1
- vm2.invoke(InterestListDUnitTest.class, "putSingleEntry",
- new Object[] { key2, "vm2" });
+ vm2.invoke(() -> InterestListDUnitTest.putSingleEntry( key2, "vm2" ));
Wait.pause(2000);
- vm1.invoke(InterestListDUnitTest.class, "validateSingleEntry",
- new Object[] {key2, key2_originalValue});
+ vm1.invoke(() -> InterestListDUnitTest.validateSingleEntry(key2, key2_originalValue));
// STEP 2
// Force key2 to synchronize with server cache
- vm1.invoke(InterestListDUnitTest.class, "registerKey",
- new Object[] { key2 });
+ vm1.invoke(() -> InterestListDUnitTest.registerKey( key2 ));
// Verify that new value is present
- vm1.invoke(InterestListDUnitTest.class, "validateSingleEntry",
- new Object[] {key2, "vm2"}); // value now magically changed
+ vm1.invoke(() -> InterestListDUnitTest.validateSingleEntry(key2, "vm2")); // value now magically changed
// but the other key should not have changed
- vm1.invoke(InterestListDUnitTest.class, "validateSingleEntry",
- new Object[] {key1, key1_originalValue}); // still unchanged
+ vm1.invoke(() -> InterestListDUnitTest.validateSingleEntry(key1, key1_originalValue)); // still unchanged
// STEP 3
- vm1.invoke(InterestListDUnitTest.class, "putSingleEntry",
- new Object[] { key1, "vm1" });
+ vm1.invoke(() -> InterestListDUnitTest.putSingleEntry( key1, "vm1" ));
Wait.pause(2000);
- vm2.invoke(InterestListDUnitTest.class, "validateSingleEntry",
- new Object[] {key1, key1_originalValue}); // still unchanged
- vm2.invoke(InterestListDUnitTest.class, "registerKey",
- new Object[] { key1 });
+ vm2.invoke(() -> InterestListDUnitTest.validateSingleEntry(key1, key1_originalValue)); // still unchanged
+ vm2.invoke(() -> InterestListDUnitTest.registerKey( key1 ));
// Verify that new value is present
- vm2.invoke(InterestListDUnitTest.class, "validateSingleEntry",
- new Object[] {key1, "vm1"}); // value now magically changed
+ vm2.invoke(() -> InterestListDUnitTest.validateSingleEntry(key1, "vm1")); // value now magically changed
// STEP 4
// unregister on one key
- vm2.invoke(InterestListDUnitTest.class, "unregisterKey",
- new Object[] { key1 });
- vm1.invoke(InterestListDUnitTest.class, "putSingleEntry",
- new Object[] { key1, key1_originalValue });
+ vm2.invoke(() -> InterestListDUnitTest.unregisterKey( key1 ));
+ vm1.invoke(() -> InterestListDUnitTest.putSingleEntry( key1, key1_originalValue ));
Wait.pause(2000);
- vm2.invoke(InterestListDUnitTest.class, "validateSingleEntry",
- new Object[] {key1, "vm1"}); // update lost
+ vm2.invoke(() -> InterestListDUnitTest.validateSingleEntry(key1, "vm1")); // update lost
}
/**
@@ -289,19 +267,19 @@ public class InterestListDUnitTest extends DistributedTestCase
public void testInterestListRegistration_ALL_KEYS()
{
- vm1.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)});
- vm2.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)});
+ vm1.invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)));
+ vm2.invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)));
- vm1.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
- vm2.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
+ vm1.invoke(() -> InterestListDUnitTest.createEntriesK1andK2());
+ vm2.invoke(() -> InterestListDUnitTest.createEntriesK1andK2());
- vm2.invoke(InterestListDUnitTest.class, "registerALL_KEYS");
+ vm2.invoke(() -> InterestListDUnitTest.registerALL_KEYS());
- vm1.invoke(InterestListDUnitTest.class, "put_ALL_KEYS");
+ vm1.invoke(() -> InterestListDUnitTest.put_ALL_KEYS());
Wait.pause(10000);
- vm2.invoke(InterestListDUnitTest.class, "validate_ALL_KEYS");
+ vm2.invoke(() -> InterestListDUnitTest.validate_ALL_KEYS());
}
/**
@@ -316,23 +294,21 @@ public class InterestListDUnitTest extends DistributedTestCase
public void testInitializationOfRegionFromInterestList()
{
// directly put on server
- vm0.invoke(InterestListDUnitTest.class, "multiple_put");
+ vm0.invoke(() -> InterestListDUnitTest.multiple_put());
Wait.pause(1000);
// create clients to connect to that server
- vm1.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)});
- vm2.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)});
+ vm1.invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)));
+ vm2.invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1)));
// register interest
- vm1.invoke(InterestListDUnitTest.class, "registerKeys");
- vm2.invoke(InterestListDUnitTest.class, "registerKeysAgain");
+ vm1.invoke(() -> InterestListDUnitTest.registerKeys());
+ vm2.invoke(() -> InterestListDUnitTest.registerKeysAgain());
Wait.pause(10000);
// verify the values for registered keys
- vm1.invoke(InterestListDUnitTest.class,
- "validateRegionEntriesFromInterestListInVm1");
- vm2.invoke(InterestListDUnitTest.class,
- "validateRegionEntriesFromInterestListInVm2");
+ vm1.invoke(() -> InterestListDUnitTest.validateRegionEntriesFromInterestListInVm1());
+ vm2.invoke(() -> InterestListDUnitTest.validateRegionEntriesFromInterestListInVm2());
}
@@ -357,52 +333,44 @@ public class InterestListDUnitTest extends DistributedTestCase
{
DistributedMember c1 = (DistributedMember)vm1
- .invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), PORT1});
+ .invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), PORT1));
DistributedMember c2 = (DistributedMember)vm2
- .invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), PORT1});
+ .invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), PORT1));
- vm1.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
- vm2.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
+ vm1.invoke(() -> InterestListDUnitTest.createEntriesK1andK2());
+ vm2.invoke(() -> InterestListDUnitTest.createEntriesK1andK2());
- vm0.invoke(InterestListDUnitTest.class, "registerKeyForClient",
- new Object[] { c1, key1 });
- vm0.invoke(InterestListDUnitTest.class, "registerKeyForClient",
- new Object[] { c2, key2 });
+ vm0.invoke(() -> InterestListDUnitTest.registerKeyForClient( c1, key1 ));
+ vm0.invoke(() -> InterestListDUnitTest.registerKeyForClient( c2, key2 ));
- vm0.invoke(InterestListDUnitTest.class, "flushQueues");
+ vm0.invoke(() -> InterestListDUnitTest.flushQueues());
- vm1.invoke(InterestListDUnitTest.class, "put", new Object[] { "vm1" });
+ vm1.invoke(() -> InterestListDUnitTest.put( "vm1" ));
- vm0.invoke(InterestListDUnitTest.class, "flushQueues");
+ vm0.invoke(() -> InterestListDUnitTest.flushQueues());
- vm2.invoke(InterestListDUnitTest.class, "validateEntriesK1andK2",
- new Object[] { "vm2" });
- vm2.invoke(InterestListDUnitTest.class, "put", new Object[] { "vm2" });
+ vm2.invoke(() -> InterestListDUnitTest.validateEntriesK1andK2( "vm2" ));
+ vm2.invoke(() -> InterestListDUnitTest.put( "vm2" ));
- vm0.invoke(InterestListDUnitTest.class, "flushQueues");
+ vm0.invoke(() -> InterestListDUnitTest.flushQueues());
- vm1.invoke(InterestListDUnitTest.class, "validateEntriesK1andK2",
- new Object[] { "vm1" });
+ vm1.invoke(() -> InterestListDUnitTest.validateEntriesK1andK2( "vm1" ));
- vm0.invoke(InterestListDUnitTest.class, "unregisterKeyForClient",
- new Object[] { c1, key1 });
- vm0.invoke(InterestListDUnitTest.class, "unregisterKeyForClient",
- new Object[] { c2, key2 });
+ vm0.invoke(() -> InterestListDUnitTest.unregisterKeyForClient( c1, key1 ));
+ vm0.invoke(() -> InterestListDUnitTest.unregisterKeyForClient( c2, key2 ));
- vm1.invoke(InterestListDUnitTest.class, "putAgain", new Object[] { "vm1" });
+ vm1.invoke(() -> InterestListDUnitTest.putAgain( "vm1" ));
- vm0.invoke(InterestListDUnitTest.class, "flushQueues");
+ vm0.invoke(() -> InterestListDUnitTest.flushQueues());
- vm2.invoke(InterestListDUnitTest.class, "validateEntriesAgain",
- new Object[] { "vm2" });
- vm2.invoke(InterestListDUnitTest.class, "putAgain", new Object[] { "vm2" });
+ vm2.invoke(() -> InterestListDUnitTest.validateEntriesAgain( "vm2" ));
+ vm2.invoke(() -> InterestListDUnitTest.putAgain( "vm2" ));
- vm0.invoke(InterestListDUnitTest.class, "flushQueues");
+ vm0.invoke(() -> InterestListDUnitTest.flushQueues());
- vm1.invoke(InterestListDUnitTest.class, "validateEntriesAgain",
- new Object[] { "vm1" });
+ vm1.invoke(() -> InterestListDUnitTest.validateEntriesAgain( "vm1" ));
}
/**
@@ -423,69 +391,57 @@ public class InterestListDUnitTest extends DistributedTestCase
}
addRegisterInterestListener();
- vm0.invoke(InterestListDUnitTest.class, "addRegisterInterestListener");
+ vm0.invoke(() -> InterestListDUnitTest.addRegisterInterestListener());
// servers are set up, now do the clients
DistributedMember c1 = (DistributedMember)vm1
- .invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), PORT1, port2});
+ .invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), PORT1, port2));
DistributedMember c2 = (DistributedMember)vm2
- .invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), PORT1, port2});
+ .invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), PORT1, port2));
- vm1.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
- vm2.invoke(InterestListDUnitTest.class, "createEntriesK1andK2");
+ vm1.invoke(() -> InterestListDUnitTest.createEntriesK1andK2());
+ vm2.invoke(() -> InterestListDUnitTest.createEntriesK1andK2());
// interest registration from clients should cause listeners to be invoked
// in both servers
LogWriterUtils.getLogWriter().info("test phase 1");
- vm1.invoke(InterestListDUnitTest.class, "registerKey",
- new Object[] { key1 });
- vm2.invoke(InterestListDUnitTest.class, "registerKey",
- new Object[] { key2 });
+ vm1.invoke(() -> InterestListDUnitTest.registerKey( key1 ));
+ vm2.invoke(() -> InterestListDUnitTest.registerKey( key2 ));
Integer zero = new Integer(0);
Integer two = new Integer(2);
interestListener.verifyCountsAndClear(2, 0);
- vm0.invoke(InterestListDUnitTest.class, "verifyCountsAndClear",
- new Object[]{ two, zero });
+ vm0.invoke(() -> InterestListDUnitTest.verifyCountsAndClear( two, zero ));
// unregistration from clients should invoke listeners on both servers
LogWriterUtils.getLogWriter().info("test phase 2");
- vm1.invoke(InterestListDUnitTest.class, "unregisterKey",
- new Object[] { key1 });
- vm2.invoke(InterestListDUnitTest.class, "unregisterKey",
- new Object[] { key2 });
+ vm1.invoke(() -> InterestListDUnitTest.unregisterKey( key1 ));
+ vm2.invoke(() -> InterestListDUnitTest.unregisterKey( key2 ));
interestListener.verifyCountsAndClear(0, 2);
- vm0.invoke(InterestListDUnitTest.class, "verifyCountsAndClear",
- new Object[]{ zero, two });
+ vm0.invoke(() -> InterestListDUnitTest.verifyCountsAndClear( zero, two ));
// now the primary server for eache client will register and unregister
LogWriterUtils.getLogWriter().info("test phase 3");
registerKeyForClient(c1, key1);
- vm0.invoke(InterestListDUnitTest.class, "registerKeyForClient",
- new Object[] { c1, key1 });
+ vm0.invoke(() -> InterestListDUnitTest.registerKeyForClient( c1, key1 ));
registerKeyForClient(c2, key2);
- vm0.invoke(InterestListDUnitTest.class, "registerKeyForClient",
- new Object[] { c2, key2 });
+ vm0.invoke(() -> InterestListDUnitTest.registerKeyForClient( c2, key2 ));
interestListener.verifyCountsAndClear(2, 0);
- vm0.invoke(InterestListDUnitTest.class, "verifyCountsAndClear",
- new Object[]{ two, zero });
+ vm0.invoke(() -> InterestListDUnitTest.verifyCountsAndClear( two, zero ));
LogWriterUtils.getLogWriter().info("test phase 4");
unregisterKeyForClient(c1, key1);
- vm0.invoke(InterestListDUnitTest.class, "unregisterKeyForClient",
- new Object[] { c1, key1 });
+ vm0.invoke(() -> InterestListDUnitTest.unregisterKeyForClient( c1, key1 ));
unregisterKeyForClient(c2, key2);
- vm0.invoke(InterestListDUnitTest.class, "unregisterKeyForClient",
- new Object[] { c2, key2 });
+ vm0.invoke(() -> InterestListDUnitTest.unregisterKeyForClient( c2, key2 ));
interestListener.verifyCountsAndClear(0, 2);
- vm0.invoke(InterestListDUnitTest.class, "verifyCountsAndClear",
- new Object[]{ zero, two });
+ vm0.invoke(() -> InterestListDUnitTest.verifyCountsAndClear( zero, two ));
}
/**
@@ -495,21 +451,17 @@ public class InterestListDUnitTest extends DistributedTestCase
public void testNoAvailableServer() {
// Register interest in key1.
- vm1.invoke(InterestListDUnitTest.class, "createClientCache",
- new Object[] { NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1) });
- vm1.invoke(InterestListDUnitTest.class, "registerKey",
- new Object[] { key1 });
+ vm1.invoke(() -> InterestListDUnitTest.createClientCache( NetworkUtils.getServerHostName(vm0.getHost()), new Integer(PORT1) ));
+ vm1.invoke(() -> InterestListDUnitTest.registerKey( key1 ));
// Stop the server.
- vm0.invoke(InterestListDUnitTest.class, "closeCache");
+ vm0.invoke(() -> InterestListDUnitTest.closeCache());
// Try to unregister interest in key1 -- should not throw an exception.
- vm1.invoke(InterestListDUnitTest.class, "unregisterKeyEx",
- new Object[] { key1 });
+ vm1.invoke(() -> InterestListDUnitTest.unregisterKeyEx( key1 ));
// Now try registration of interest in key2 -- should throw an exception.
- vm1.invoke(InterestListDUnitTest.class, "registerKeyEx",
- new Object[] { key2 });
+ vm1.invoke(() -> InterestListDUnitTest.registerKeyEx( key2 ));
}
public void testRegisterInterestOnReplicatedRegionWithCacheLoader() {
@@ -522,39 +474,39 @@ public class InterestListDUnitTest extends DistributedTestCase
private void runRegisterInterestWithCacheLoaderTest(boolean addReplicatedRegion) {
// Stop the server (since it was already started with a replicated region)
- vm0.invoke(InterestListDUnitTest.class, "closeCache");
+ vm0.invoke(() -> InterestListDUnitTest.closeCache());
// Start two servers with the appropriate region
- int port1 = ((Integer) vm0.invoke(InterestListDUnitTest.class, "createServerCache", new Object[] { addReplicatedRegion })).intValue();
+ int port1 = ((Integer) vm0.invoke(() -> InterestListDUnitTest.createServerCache( addReplicatedRegion ))).intValue();
VM server2VM = Host.getHost(0).getVM(3);
- int port2 = ((Integer) server2VM.invoke(InterestListDUnitTest.class, "createServerCache", new Object[] { addReplicatedRegion })).intValue();
+ int port2 = ((Integer) server2VM.invoke(() -> InterestListDUnitTest.createServerCache( addReplicatedRegion ))).intValue();
// Add a cache loader to the region in both cache servers
- vm0.invoke(InterestListDUnitTest.class, "addCacheLoader");
- server2VM.invoke(InterestListDUnitTest.class, "addCacheLoader");
+ vm0.invoke(() -> InterestListDUnitTest.addCacheLoader());
+ server2VM.invoke(() -> InterestListDUnitTest.addCacheLoader());
// Create client cache
- vm1.invoke(InterestListDUnitTest.class, "createClientCache",new Object[] {
- NetworkUtils.getServerHostName(vm0.getHost()), port1, port2});
+ vm1.invoke(() -> InterestListDUnitTest.createClientCache(
+ NetworkUtils.getServerHostName(vm0.getHost()), port1, port2));
// Register interest in all keys
- vm1.invoke(InterestListDUnitTest.class, "registerALL_KEYS");
+ vm1.invoke(() -> InterestListDUnitTest.registerALL_KEYS());
// Add CacheListener
int numEvents = 100;
- vm1.invoke(InterestListDUnitTest.class, "addCacheListener", new Object[] {numEvents});
+ vm1.invoke(() -> InterestListDUnitTest.addCacheListener(numEvents));
// Do gets on the client
- vm1.invoke(InterestListDUnitTest.class, "doGets", new Object[] {numEvents});
+ vm1.invoke(() -> InterestListDUnitTest.doGets(numEvents));
// Wait for cache listener create events
- vm1.invoke(InterestListDUnitTest.class, "waitForCacheListenerCreates");
+ vm1.invoke(() -> InterestListDUnitTest.waitForCacheListenerCreates());
// Confirm there are no cache listener update events
- vm1.invoke(InterestListDUnitTest.class, "confirmNoCacheListenerUpdates");
+ vm1.invoke(() -> InterestListDUnitTest.confirmNoCacheListenerUpdates());
// Confirm there are no cache listener invalidate events
- vm1.invoke(InterestListDUnitTest.class, "confirmNoCacheListenerInvalidates");
+ vm1.invoke(() -> InterestListDUnitTest.confirmNoCacheListenerInvalidates());
}
private void createCache(Properties props) throws Exception
@@ -1080,10 +1032,10 @@ public class InterestListDUnitTest extends DistributedTestCase
@Override
protected final void preTearDown() throws Exception {
// close the clients first
- vm1.invoke(InterestListDUnitTest.class, "closeCache");
- vm2.invoke(InterestListDUnitTest.class, "closeCache");
+ vm1.invoke(() -> InterestListDUnitTest.closeCache());
+ vm2.invoke(() -> InterestListDUnitTest.closeCache());
// then close the servers
- vm0.invoke(InterestListDUnitTest.class, "closeCache");
+ vm0.invoke(() -> InterestListDUnitTest.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/InterestListEndpointDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListEndpointDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListEndpointDUnitTest.java
index b8db844..5f16688 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListEndpointDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListEndpointDUnitTest.java
@@ -110,8 +110,8 @@ public class InterestListEndpointDUnitTest extends DistributedTestCase
// then create client
Wait.pause(5000); // [bruce] avoid ConnectException
- client1.invoke(impl.getClass(), "createClientCache", new Object[] {
- NetworkUtils.getServerHostName(server1.getHost()), new Integer(PORT1),new Integer(PORT2)});
+ client1.invoke(() -> impl.createClientCache(
+ NetworkUtils.getServerHostName(server1.getHost()), new Integer(PORT1),new Integer(PORT2)));
}
@@ -133,14 +133,14 @@ public class InterestListEndpointDUnitTest extends DistributedTestCase
*/
public void testDirectPutOnServer()
{
- client1.invoke(impl.getClass(), "createEntriesK1andK2");
- server1.invoke(impl.getClass(), "createEntriesK1andK2");
- server2.invoke(impl.getClass(), "createEntriesK1andK2");
+ client1.invoke(() -> impl.createEntriesK1andK2());
+ server1.invoke(() -> impl.createEntriesK1andK2());
+ server2.invoke(() -> impl.createEntriesK1andK2());
- client1.invoke(impl.getClass(), "registerKey1");
+ client1.invoke(() -> impl.registerKey1());
//directly put on server
- server1.invoke(impl.getClass(), "put");
- client1.invoke(impl.getClass(), "verifyPut");
+ server1.invoke(() -> impl.put());
+ client1.invoke(() -> impl.verifyPut());
}
/**
* put on non interest list ep and verify updates
@@ -148,30 +148,30 @@ public class InterestListEndpointDUnitTest extends DistributedTestCase
*/
public void testInterestListEndpoint()
{
- client1.invoke(impl.getClass(), "createEntriesK1andK2");
- server2.invoke(impl.getClass(), "createEntriesK1andK2"); // server
- server1.invoke(impl.getClass(), "createEntriesK1andK2"); // server
+ client1.invoke(() -> impl.createEntriesK1andK2());
+ server2.invoke(() -> impl.createEntriesK1andK2()); // server
+ server1.invoke(() -> impl.createEntriesK1andK2()); // server
- client1.invoke(impl.getClass(), "registerKey1");
+ client1.invoke(() -> impl.registerKey1());
- server1.invoke(impl.getClass(), "verifyIfNotInterestListEndpointAndThenPut");
- server2.invoke(impl.getClass(), "verifyIfNotInterestListEndpointAndThenPut");
- client1.invoke(impl.getClass(), "verifyPut");
+ server1.invoke(() -> impl.verifyIfNotInterestListEndpointAndThenPut());
+ server2.invoke(() -> impl.verifyIfNotInterestListEndpointAndThenPut());
+ client1.invoke(() -> impl.verifyPut());
}
public void testInterestListEndpointAfterFailover() throws Exception
{
final long maxWaitTime = 20000;
- client1.invoke(impl.getClass(), "createEntriesK1andK2");
- server2.invoke(impl.getClass(), "createEntriesK1andK2");
- server1.invoke(impl.getClass(), "createEntriesK1andK2");
+ client1.invoke(() -> impl.createEntriesK1andK2());
+ server2.invoke(() -> impl.createEntriesK1andK2());
+ server1.invoke(() -> impl.createEntriesK1andK2());
- client1.invoke(impl.getClass(), "registerKey1");
+ client1.invoke(() -> impl.registerKey1());
boolean firstIsPrimary = isVm0Primary();
VM primary = firstIsPrimary? server1 : server2;
- primary.invoke(impl.getClass(), "stopILEndpointServer");
+ primary.invoke(() -> impl.stopILEndpointServer());
Wait.pause(5000);
//Since the loadbalancing policy is roundrobin & there are two servers so
@@ -210,13 +210,13 @@ public class InterestListEndpointDUnitTest extends DistributedTestCase
});
//put on stopped server
- primary.invoke(impl.getClass(), "put");
- client1.invoke(impl.getClass(), "verifyPut");
+ primary.invoke(() -> impl.put());
+ client1.invoke(() -> impl.verifyPut());
}
public static boolean isVm0Primary() throws Exception {
- int port = ((Integer)client1.invoke(impl.getClass(), "getPrimaryPort")).intValue();
+ int port = ((Integer)client1.invoke(() -> impl.getPrimaryPort())).intValue();
return port == PORT1;
}
@@ -232,9 +232,9 @@ public class InterestListEndpointDUnitTest extends DistributedTestCase
public void testUpdaterThreadIsAliveForFailedEndPoint(){
- client1.invoke(impl.getClass(), "acquirePoolConnection");
- client1.invoke(impl.getClass(), "processException");
- client1.invoke(impl.getClass(), "verifyUpdaterThreadIsAlive");
+ client1.invoke(() -> impl.acquirePoolConnection());
+ client1.invoke(() -> impl.processException());
+ client1.invoke(() -> impl.verifyUpdaterThreadIsAlive());
}
public static void acquirePoolConnection()
@@ -493,9 +493,9 @@ public class InterestListEndpointDUnitTest extends DistributedTestCase
@Override
protected final void preTearDown() throws Exception {
// Close client cache first, then server caches
- client1.invoke(impl.getClass(), "closeCache");
- server2.invoke(impl.getClass(), "closeCache");
- server1.invoke(impl.getClass(), "closeCache");
+ client1.invoke(() -> impl.closeCache());
+ server2.invoke(() -> impl.closeCache());
+ server1.invoke(() -> impl.closeCache());
CacheServerTestUtil.resetDisableShufflingOfEndpointsFlag();
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/InterestListFailoverDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListFailoverDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListFailoverDUnitTest.java
index d5e32bd..34073c2 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListFailoverDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListFailoverDUnitTest.java
@@ -86,22 +86,18 @@ public class InterestListFailoverDUnitTest extends DistributedTestCase
public void createServersAndClients(int redundancyLevel) {
final Host host = Host.getHost(0);
// start servers first
- PORT1 = ((Integer)vm0.invoke(CacheServerTestUtil.class,
- "createCacheServer",
- new Object[] {REGION_NAME, new Boolean(true)}))
+ PORT1 = ((Integer)vm0.invoke(() -> CacheServerTestUtil.createCacheServer(REGION_NAME, new Boolean(true))))
.intValue();
- PORT2 = ((Integer)vm3.invoke(CacheServerTestUtil.class,
- "createCacheServer",
- new Object[] {REGION_NAME, new Boolean(true)}))
+ PORT2 = ((Integer)vm3.invoke(() -> CacheServerTestUtil.createCacheServer(REGION_NAME, new Boolean(true))))
.intValue();
- vm1.invoke(CacheServerTestUtil.class, "disableShufflingOfEndpoints");
- vm2.invoke(CacheServerTestUtil.class, "disableShufflingOfEndpoints");
- vm1.invoke(CacheServerTestUtil.class, "createCacheClient", new Object[] {
- getClientPool(NetworkUtils.getServerHostName(host),redundancyLevel), REGION_NAME });
- vm2.invoke(CacheServerTestUtil.class, "createCacheClient", new Object[] {
- getClientPool(NetworkUtils.getServerHostName(host),0), REGION_NAME });
+ vm1.invoke(() -> CacheServerTestUtil.disableShufflingOfEndpoints());
+ vm2.invoke(() -> CacheServerTestUtil.disableShufflingOfEndpoints());
+ vm1.invoke(() -> CacheServerTestUtil.createCacheClient(
+ getClientPool(NetworkUtils.getServerHostName(host),redundancyLevel), REGION_NAME ));
+ vm2.invoke(() -> CacheServerTestUtil.createCacheClient(
+ getClientPool(NetworkUtils.getServerHostName(host),0), REGION_NAME ));
}
/**
@@ -132,24 +128,24 @@ public class InterestListFailoverDUnitTest extends DistributedTestCase
public void doTestInterestListRecovery(int redundancyLevel)
{
createServersAndClients(redundancyLevel);
- vm1.invoke(InterestListFailoverDUnitTest.class, "createEntries");
- vm2.invoke(InterestListFailoverDUnitTest.class, "createEntries");
- vm0.invoke(InterestListFailoverDUnitTest.class, "createEntries");
- Integer primaryPort = (Integer)vm1.invoke(InterestListFailoverDUnitTest.class, "registerInterestList");
+ vm1.invoke(() -> InterestListFailoverDUnitTest.createEntries());
+ vm2.invoke(() -> InterestListFailoverDUnitTest.createEntries());
+ vm0.invoke(() -> InterestListFailoverDUnitTest.createEntries());
+ Integer primaryPort = (Integer)vm1.invoke(() -> InterestListFailoverDUnitTest.registerInterestList());
VM primaryVM;
if (primaryPort.intValue() == PORT1) {
primaryVM = vm0;
} else {
primaryVM = vm3;
}
- vm2.invoke(InterestListFailoverDUnitTest.class, "putA");
+ vm2.invoke(() -> InterestListFailoverDUnitTest.putA());
// pause(10000);
- vm1.invoke(InterestListFailoverDUnitTest.class, "validateEntriesA");
- primaryVM.invoke(InterestListFailoverDUnitTest.class, "stopServer");
+ vm1.invoke(() -> InterestListFailoverDUnitTest.validateEntriesA());
+ primaryVM.invoke(() -> InterestListFailoverDUnitTest.stopServer());
//pause(10000);
- vm2.invoke(InterestListFailoverDUnitTest.class, "putB");
+ vm2.invoke(() -> InterestListFailoverDUnitTest.putB());
//(10000);
- vm1.invoke(InterestListFailoverDUnitTest.class, "validateEntriesB");
+ vm1.invoke(() -> InterestListFailoverDUnitTest.validateEntriesB());
}
public static void createEntries()
@@ -309,11 +305,11 @@ public class InterestListFailoverDUnitTest extends DistributedTestCase
public void closeAll() {
// close the clients first
- vm1.invoke(CacheServerTestUtil.class, "closeCache");
- vm2.invoke(CacheServerTestUtil.class, "closeCache");
+ vm1.invoke(() -> CacheServerTestUtil.closeCache());
+ vm2.invoke(() -> CacheServerTestUtil.closeCache());
// then close the servers
- vm0.invoke(CacheServerTestUtil.class, "closeCache");
- vm3.invoke(CacheServerTestUtil.class, "closeCache");
+ vm0.invoke(() -> CacheServerTestUtil.closeCache());
+ vm3.invoke(() -> CacheServerTestUtil.closeCache());
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/InterestListRecoveryDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListRecoveryDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListRecoveryDUnitTest.java
index 19e7e16..8beb5a0 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListRecoveryDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/InterestListRecoveryDUnitTest.java
@@ -97,8 +97,8 @@ public class InterestListRecoveryDUnitTest extends DistributedTestCase
server1 = host.getVM(0);
server2 = host.getVM(1);
//start servers first
- PORT1 = ((Integer)server1.invoke(InterestListRecoveryDUnitTest.class, "createServerCache" )).intValue();
- PORT2 = ((Integer)server2.invoke(InterestListRecoveryDUnitTest.class, "createServerCache" )).intValue();
+ PORT1 = ((Integer)server1.invoke(() -> InterestListRecoveryDUnitTest.createServerCache())).intValue();
+ PORT2 = ((Integer)server2.invoke(() -> InterestListRecoveryDUnitTest.createServerCache())).intValue();
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("server1 port is " + String.valueOf(PORT1));
com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("server2 port is " + String.valueOf(PORT2));
@@ -110,7 +110,7 @@ public class InterestListRecoveryDUnitTest extends DistributedTestCase
public void XtestKeyInterestRecoveryWhileServerFailover() throws Exception
{
createEntries();
- server1.invoke(InterestListRecoveryDUnitTest.class, "createEntries");
+ server1.invoke(() -> InterestListRecoveryDUnitTest.createEntries());
registerK1toK5();
setServerUnavailable("localhost"+PORT1);
Wait.pause(20000);
@@ -119,7 +119,7 @@ public class InterestListRecoveryDUnitTest extends DistributedTestCase
Wait.pause(20000);
setServerUnavailable("localhost"+PORT2);
Wait.pause(20000);
- server1.invoke(InterestListRecoveryDUnitTest.class, "verifyUnregisterK1toK3");
+ server1.invoke(() -> InterestListRecoveryDUnitTest.verifyUnregisterK1toK3());
}
@@ -129,8 +129,8 @@ public class InterestListRecoveryDUnitTest extends DistributedTestCase
LogWriter logger = system.getLogWriter();
createEntries();
- server2.invoke(InterestListRecoveryDUnitTest.class, "createEntries");
- server1.invoke(InterestListRecoveryDUnitTest.class, "createEntries");
+ server2.invoke(() -> InterestListRecoveryDUnitTest.createEntries());
+ server1.invoke(() -> InterestListRecoveryDUnitTest.createEntries());
registerK1toK5();
logger.fine("After registerK1toK5");
@@ -147,7 +147,7 @@ public class InterestListRecoveryDUnitTest extends DistributedTestCase
logger.fine("serverFirstRegistered is server2 and serverSecondRegistered is server1");
}
verifyDeadAndLiveServers(0,2);
- serverFirstRegistered.invoke(InterestListRecoveryDUnitTest.class, "verifyRegionToProxyMapForFullRegistration");
+ serverFirstRegistered.invoke(() -> InterestListRecoveryDUnitTest.verifyRegionToProxyMapForFullRegistration());
logger.fine("After verifyRegionToProxyMapForFullRegistration on serverFirstRegistered");
logger.info("<ExpectedException action=add>"
+ SocketException.class.getName() + "</ExpectedException>");
@@ -155,17 +155,17 @@ public class InterestListRecoveryDUnitTest extends DistributedTestCase
+ EOFException.class.getName() + "</ExpectedException>");
killCurrentEndpoint();
logger.fine("After killCurrentEndpoint1");
- serverSecondRegistered.invoke(InterestListRecoveryDUnitTest.class, "verifyRegionToProxyMapForFullRegistrationRetry");
+ serverSecondRegistered.invoke(() -> InterestListRecoveryDUnitTest.verifyRegionToProxyMapForFullRegistrationRetry());
logger.fine("After verifyRegionToProxyMapForFullRegistration on serverSecondRegistered");
unregisterK1toK3();
- serverSecondRegistered.invoke(InterestListRecoveryDUnitTest.class, "verifyRegisterK4toK5Retry");
+ serverSecondRegistered.invoke(() -> InterestListRecoveryDUnitTest.verifyRegisterK4toK5Retry());
logger.fine("After verifyRegisterK4toK5Retry on serverSecondRegistered");
}
private boolean isInterestListRegisteredToServer1() {
/*
try {
- server1.invoke(InterestListRecoveryDUnitTest.class, "verifyRegionToProxyMapForFullRegistration");
+ server1.invoke(() -> InterestListRecoveryDUnitTest.verifyRegionToProxyMapForFullRegistration());
} catch (Throwable t) {
// Means its registered on server2.
return false;
@@ -484,10 +484,10 @@ public class InterestListRecoveryDUnitTest extends DistributedTestCase
@Override
protected final void preTearDown() throws Exception {
// close the clients first
- server2.invoke(InterestListRecoveryDUnitTest.class, "closeCache");
+ server2.invoke(() -> InterestListRecoveryDUnitTest.closeCache());
closeCache();
// then close the servers
- server1.invoke(InterestListRecoveryDUnitTest.class, "closeCache");
+ server1.invoke(() -> InterestListRecoveryDUnitTest.closeCache());
}
public static void closeCache()