geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [21/32] incubator-geode git commit: GEODE-1162: convert all CLI command DUnit tests to JUnit 4
Date Fri, 15 Apr 2016 03:07:50 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/GemFireSecurityExceptionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/GemFireSecurityExceptionTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/GemFireSecurityExceptionTest.java
index 0c048d3..5aa01ff 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/GemFireSecurityExceptionTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/GemFireSecurityExceptionTest.java
@@ -23,7 +23,6 @@ import java.io.NotSerializableException;
 import java.io.Serializable;
 import javax.naming.NamingException;
 
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
 import org.apache.commons.lang.SerializationUtils;
 import org.junit.Before;
 import org.junit.Rule;
@@ -31,10 +30,13 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
 
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
 /**
  * Unit tests for {@link GemFireSecurityException}.
  */
-@Category(UnitTest.class)
+@Category({ UnitTest.class, SecurityTest.class })
 public class GemFireSecurityExceptionTest {
 
   private String message;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/NotAuthorizedExceptionTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/NotAuthorizedExceptionTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/NotAuthorizedExceptionTest.java
index c5e0ba5..ec054d7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/NotAuthorizedExceptionTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/NotAuthorizedExceptionTest.java
@@ -25,7 +25,6 @@ import java.io.Serializable;
 import java.security.Principal;
 import javax.naming.NamingException;
 
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
 import org.apache.commons.lang.SerializationUtils;
 import org.junit.Before;
 import org.junit.Rule;
@@ -33,10 +32,13 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TestName;
 
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
 /**
  * Unit tests for {@link NotAuthorizedException}.
  */
-@Category(UnitTest.class)
+@Category({ UnitTest.class, SecurityTest.class })
 public class NotAuthorizedExceptionTest {
 
   private String message;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
index 1db599f..179f29d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/P2PAuthenticationDUnitTest.java
@@ -29,6 +29,10 @@ import static com.gemstone.gemfire.test.dunit.Wait.*;
 import java.util.Properties;
 import javax.net.ssl.SSLHandshakeException;
 
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.Locator;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
@@ -44,16 +48,14 @@ import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import com.gemstone.gemfire.test.junit.categories.SecurityTest;
 
 /**
  * Tests peer to peer authentication in Gemfire
  * 
  * @since 5.5
  */
-@Category(DistributedTest.class)
+@Category({ DistributedTest.class, SecurityTest.class })
 public class P2PAuthenticationDUnitTest extends JUnit4DistributedTestCase {
 
   private static VM locatorVM = null;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java b/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
index 663a17d..10ac68a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/SecurityTestUtils.java
@@ -18,16 +18,20 @@
  */
 package com.gemstone.gemfire.security;
 
+import static com.gemstone.gemfire.cache30.ClientServerTestCase.*;
 import static com.gemstone.gemfire.distributed.internal.DistributionConfig.*;
 import static com.gemstone.gemfire.internal.AvailablePort.*;
-import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static com.gemstone.gemfire.test.dunit.Assert.assertEquals;
+import static com.gemstone.gemfire.test.dunit.Assert.assertFalse;
+import static com.gemstone.gemfire.test.dunit.Assert.assertNotNull;
+import static com.gemstone.gemfire.test.dunit.Assert.assertNull;
+import static com.gemstone.gemfire.test.dunit.Assert.assertTrue;
+import static com.gemstone.gemfire.test.dunit.Assert.fail;
 import static com.gemstone.gemfire.test.dunit.DistributedTestUtils.*;
 import static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
 import static com.gemstone.gemfire.test.dunit.NetworkUtils.*;
 import static com.gemstone.gemfire.test.dunit.Wait.*;
 
-import static com.gemstone.gemfire.cache30.ClientServerTestCase.configureConnectionPoolWithNameAndFactory;
-
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -84,6 +88,7 @@ import com.gemstone.gemfire.pdx.PdxSerializable;
 import com.gemstone.gemfire.pdx.PdxWriter;
 import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 
 /**
  * Contains utility methods for setting up servers/clients for authentication
@@ -93,7 +98,7 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
  */
 public final class SecurityTestUtils {
 
-  private final DistributedTestCase distributedTestCase = new DistributedTestCase(getClass().getSimpleName()) {}; // TODO: delete
+  private final JUnit4DistributedTestCase distributedTestCase = new JUnit4DistributedTestCase() {}; // TODO: delete
 
   protected static final int NO_EXCEPTION = 0;
   protected static final int AUTHREQ_EXCEPTION = 1;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/generator/AuthzCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/AuthzCredentialGenerator.java b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/AuthzCredentialGenerator.java
index f39fc84..a561de0 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/AuthzCredentialGenerator.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/AuthzCredentialGenerator.java
@@ -16,13 +16,6 @@
  */
 package com.gemstone.gemfire.security.generator;
 
-import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.security.AccessControl;
-import com.gemstone.gemfire.security.templates.DummyAuthorization;
-import com.gemstone.gemfire.security.templates.XmlAuthorization;
-import org.apache.logging.log4j.Logger;
-
 import java.security.Principal;
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -31,6 +24,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.security.AccessControl;
+import com.gemstone.gemfire.security.templates.DummyAuthorization;
+import com.gemstone.gemfire.security.templates.XmlAuthorization;
+
 /**
  * Encapsulates obtaining authorized and unauthorized credentials for a given
  * operation in a region. Implementations will be for different kinds of

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/generator/CredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/CredentialGenerator.java b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/CredentialGenerator.java
index aee7ebb..fd079a2 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/CredentialGenerator.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/CredentialGenerator.java
@@ -24,13 +24,14 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.security.AuthInitialize;
 import com.gemstone.gemfire.security.Authenticator;
 import com.gemstone.gemfire.security.templates.DummyAuthenticator;
 import com.gemstone.gemfire.security.templates.LdapUserAuthenticator;
 import com.gemstone.gemfire.security.templates.PKCSAuthenticator;
-import org.apache.logging.log4j.Logger;
 
 /**
  * Encapsulates obtaining valid and invalid credentials. Implementations will be

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/generator/DummyCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/DummyCredentialGenerator.java b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/DummyCredentialGenerator.java
index b709dbc..77ffbd9 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/DummyCredentialGenerator.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/DummyCredentialGenerator.java
@@ -16,12 +16,12 @@
  */
 package com.gemstone.gemfire.security.generator;
 
-import com.gemstone.gemfire.security.templates.DummyAuthenticator;
-import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
-
 import java.security.Principal;
 import java.util.Properties;
 
+import com.gemstone.gemfire.security.templates.DummyAuthenticator;
+import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
+
 public class DummyCredentialGenerator extends CredentialGenerator {
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/generator/LdapUserCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/LdapUserCredentialGenerator.java b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/LdapUserCredentialGenerator.java
index bbd9528..7bdcd9a 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/LdapUserCredentialGenerator.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/LdapUserCredentialGenerator.java
@@ -16,18 +16,19 @@
  */
 package com.gemstone.gemfire.security.generator;
 
+import java.security.Principal;
+import java.util.Properties;
+import java.util.Random;
+
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.cache.tier.sockets.HandShake;
 import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.util.test.TestUtil;
 import com.gemstone.gemfire.security.templates.LdapUserAuthenticator;
 import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
-import org.apache.logging.log4j.Logger;
-
-import java.security.Principal;
-import java.util.Properties;
-import java.util.Random;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.util.test.TestUtil;
 
 public class LdapUserCredentialGenerator extends CredentialGenerator {
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/generator/PKCSCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/PKCSCredentialGenerator.java b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/PKCSCredentialGenerator.java
index 6d33493..09381b8 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/PKCSCredentialGenerator.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/PKCSCredentialGenerator.java
@@ -16,15 +16,15 @@
  */
 package com.gemstone.gemfire.security.generator;
 
-import com.gemstone.gemfire.util.test.TestUtil;
-import com.gemstone.gemfire.security.templates.PKCSAuthInit;
-import com.gemstone.gemfire.security.templates.PKCSAuthenticator;
-
 import java.security.Principal;
 import java.security.Provider;
 import java.security.Security;
 import java.util.Properties;
 
+import com.gemstone.gemfire.security.templates.PKCSAuthInit;
+import com.gemstone.gemfire.security.templates.PKCSAuthenticator;
+import com.gemstone.gemfire.util.test.TestUtil;
+
 public class PKCSCredentialGenerator extends CredentialGenerator {
 
   public static String keyStoreDir = getKeyStoreDir();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/generator/SSLCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/SSLCredentialGenerator.java b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/SSLCredentialGenerator.java
index ff23f78..6f7cf29 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/SSLCredentialGenerator.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/SSLCredentialGenerator.java
@@ -16,15 +16,16 @@
  */
 package com.gemstone.gemfire.security.generator;
 
-import com.gemstone.gemfire.internal.logging.LogService;
-import com.gemstone.gemfire.security.AuthenticationFailedException;
-import org.apache.logging.log4j.Logger;
-
 import java.io.File;
 import java.io.IOException;
 import java.security.Principal;
 import java.util.Properties;
 
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.security.AuthenticationFailedException;
+
 public class SSLCredentialGenerator extends CredentialGenerator {
 
   private static final Logger logger = LogService.getLogger();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/generator/UserPasswordWithExtraPropsAuthInit.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/UserPasswordWithExtraPropsAuthInit.java b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/UserPasswordWithExtraPropsAuthInit.java
index b29f16b..6d0c583 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/UserPasswordWithExtraPropsAuthInit.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/UserPasswordWithExtraPropsAuthInit.java
@@ -16,14 +16,14 @@
  */
 package com.gemstone.gemfire.security.generator;
 
+import java.util.Iterator;
+import java.util.Properties;
+
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.security.AuthInitialize;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.templates.UserPasswordAuthInit;
 
-import java.util.Iterator;
-import java.util.Properties;
-
 /**
  * An {@link AuthInitialize} implementation that obtains the user name and
  * password as the credentials from the given set of properties. If 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/generator/XmlAuthzCredentialGenerator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/XmlAuthzCredentialGenerator.java b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/XmlAuthzCredentialGenerator.java
index 5d07004..7dcf5ae 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/generator/XmlAuthzCredentialGenerator.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/generator/XmlAuthzCredentialGenerator.java
@@ -16,16 +16,16 @@
  */
 package com.gemstone.gemfire.security.generator;
 
-import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
-import com.gemstone.gemfire.util.test.TestUtil;
-import com.gemstone.gemfire.security.templates.UsernamePrincipal;
-import com.gemstone.gemfire.security.templates.XmlAuthorization;
-
 import java.security.Principal;
 import java.util.HashSet;
 import java.util.Properties;
 import java.util.Set;
 
+import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
+import com.gemstone.gemfire.security.templates.UsernamePrincipal;
+import com.gemstone.gemfire.security.templates.XmlAuthorization;
+import com.gemstone.gemfire.util.test.TestUtil;
+
 public class XmlAuthzCredentialGenerator extends AuthzCredentialGenerator {
 
   private static final String dummyXml = "authz-dummy.xml";

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/templates/DummyAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/DummyAuthorization.java b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/DummyAuthorization.java
index a76a46f..17bc5e1 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/DummyAuthorization.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/DummyAuthorization.java
@@ -16,6 +16,10 @@
  */
 package com.gemstone.gemfire.security.templates;
 
+import java.security.Principal;
+import java.util.HashSet;
+import java.util.Set;
+
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.operations.OperationContext;
@@ -24,10 +28,6 @@ import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.security.AccessControl;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
-import java.security.Principal;
-import java.util.HashSet;
-import java.util.Set;
-
 /**
  * A dummy implementation of the {@code AccessControl} interface that
  * allows authorization depending on the format of the {@code Principal}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/templates/LdapUserAuthenticator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/LdapUserAuthenticator.java b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/LdapUserAuthenticator.java
index fd2286e..b92a08a 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/LdapUserAuthenticator.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/LdapUserAuthenticator.java
@@ -22,12 +22,13 @@ import javax.naming.Context;
 import javax.naming.directory.DirContext;
 import javax.naming.directory.InitialDirContext;
 
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.Authenticator;
-import org.apache.logging.log4j.Logger;
 
 /**
  * An implementation of {@link Authenticator} that uses LDAP.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSAuthInit.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSAuthInit.java b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSAuthInit.java
index 0b38a7b..9f1ccec 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSAuthInit.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSAuthInit.java
@@ -24,12 +24,13 @@ import java.security.Signature;
 import java.security.cert.X509Certificate;
 import java.util.Properties;
 
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.security.AuthInitialize;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
-import org.apache.logging.log4j.Logger;
 
 /**
  * An {@link AuthInitialize} implementation that obtains the digital signature

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSAuthenticator.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSAuthenticator.java b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSAuthenticator.java
index 971cf60..ac5939d 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSAuthenticator.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSAuthenticator.java
@@ -29,12 +29,13 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 import com.gemstone.gemfire.security.Authenticator;
-import org.apache.logging.log4j.Logger;
 
 /**
  * An implementation of {@link Authenticator} that uses PKCS.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSPrincipalTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSPrincipalTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSPrincipalTest.java
index e0bc1e4..677e2d4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSPrincipalTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/PKCSPrincipalTest.java
@@ -16,14 +16,15 @@
  */
 package com.gemstone.gemfire.security.templates;
 
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import static org.assertj.core.api.Assertions.*;
+
+import java.io.Serializable;
+
 import org.apache.commons.lang.SerializationUtils;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.Serializable;
-
-import static org.assertj.core.api.Assertions.assertThat;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 /**
  * Unit tests for {@link PKCSPrincipal}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/templates/UserPasswordAuthInit.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/UserPasswordAuthInit.java b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/UserPasswordAuthInit.java
index 34161ac..6c05090 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/UserPasswordAuthInit.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/UserPasswordAuthInit.java
@@ -16,13 +16,13 @@
  */
 package com.gemstone.gemfire.security.templates;
 
+import java.util.Properties;
+
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.security.AuthInitialize;
 import com.gemstone.gemfire.security.AuthenticationFailedException;
 
-import java.util.Properties;
-
 /**
  * An {@link AuthInitialize} implementation that obtains the user name and
  * password as the credentials from the given set of properties.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/templates/UsernamePrincipalTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/UsernamePrincipalTest.java b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/UsernamePrincipalTest.java
index e762d06..bce19b4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/UsernamePrincipalTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/UsernamePrincipalTest.java
@@ -16,14 +16,15 @@
  */
 package com.gemstone.gemfire.security.templates;
 
-import com.gemstone.gemfire.test.junit.categories.UnitTest;
+import static org.assertj.core.api.Assertions.*;
+
+import java.io.Serializable;
+
 import org.apache.commons.lang.SerializationUtils;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import java.io.Serializable;
-
-import static org.assertj.core.api.Assertions.assertThat;
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
 
 /**
  * Unit tests for {@link UsernamePrincipal}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlAuthorization.java b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlAuthorization.java
index b8f2e50..2153fb4 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlAuthorization.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlAuthorization.java
@@ -29,15 +29,6 @@ import java.util.regex.Pattern;
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
 
-import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.operations.ExecuteFunctionOperationContext;
-import com.gemstone.gemfire.cache.operations.OperationContext;
-import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
-import com.gemstone.gemfire.cache.operations.QueryOperationContext;
-import com.gemstone.gemfire.distributed.DistributedMember;
-import com.gemstone.gemfire.security.AccessControl;
-import com.gemstone.gemfire.security.NotAuthorizedException;
 import org.w3c.dom.Attr;
 import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
@@ -48,6 +39,16 @@ import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.operations.ExecuteFunctionOperationContext;
+import com.gemstone.gemfire.cache.operations.OperationContext;
+import com.gemstone.gemfire.cache.operations.OperationContext.OperationCode;
+import com.gemstone.gemfire.cache.operations.QueryOperationContext;
+import com.gemstone.gemfire.distributed.DistributedMember;
+import com.gemstone.gemfire.security.AccessControl;
+import com.gemstone.gemfire.security.NotAuthorizedException;
+
 /**
  * An implementation of the {@link AccessControl} interface that allows
  * authorization using the permissions as specified in the given XML

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlErrorHandler.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlErrorHandler.java b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlErrorHandler.java
index 19d10c6..e2b286b 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlErrorHandler.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/security/templates/XmlErrorHandler.java
@@ -16,13 +16,14 @@
  */
 package com.gemstone.gemfire.security.templates;
 
-import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.internal.logging.LogService;
 import org.apache.logging.log4j.Logger;
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.internal.logging.LogService;
+
 /**
  * Implementation of {@link ErrorHandler} interface to handle validation errors
  * while XML parsing.

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/AsyncInvocation.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/AsyncInvocation.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/AsyncInvocation.java
index a612f87..a9427d3 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/AsyncInvocation.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/AsyncInvocation.java
@@ -16,21 +16,25 @@
  */
 package com.gemstone.gemfire.test.dunit;
 
+import java.util.concurrent.Callable;
+import java.util.concurrent.CancellationException;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.Future;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
+import java.util.concurrent.atomic.AtomicReference;
 
-import com.gemstone.gemfire.InternalGemFireError;
 import com.gemstone.gemfire.SystemFailure;
 
 /**
- * <P>An <code>AsyncInvocation</code> represents the invocation of a
- * remote invocation that executes asynchronously from its caller.  An
- * instanceof <code>AsyncInvocation</code> provides information about
- * the invocation such as any exception that it may have thrown.</P>
+ * An {@code AsyncInvocation} represents the invocation of a remote invocation
+ * that executes asynchronously from its caller.  An instance of
+ * {@code AsyncInvocation} provides information about the invocation such as
+ * any exception that it may have thrown.
  *
- * <P>Because it is a <code>Thread</code>, an
- * <code>AsyncInvocation</code> can be used as follows:</P>
+ * <p>{@code AsyncInvocation} can be used as follows:
  *
- * <PRE>
+ * <pre>
  *   AsyncInvocation ai1 = vm.invokeAsync(() -> Test.method1());
  *   AsyncInvocation ai2 = vm.invokeAsync(() -> Test.method2());
  *
@@ -42,87 +46,65 @@ import com.gemstone.gemfire.SystemFailure;
  *   if (ai2.exceptionOccurred()) {
  *     throw ai2.getException();
  *   }
- * </PRE>
+ * </pre>
  *
+ * @param <V> The result type returned by this AsyncInvocation's {@code get} methods
  * @see VM#invokeAsync(Class, String)
  */
-public class AsyncInvocation<T> extends Thread {
-  //@todo davidw Add the ability to get a return value back from the
-  //async method call.  (Use a static ThreadLocal field that is
-  //accessible from the Runnable used in VM#invoke)
-  
-  private static final ThreadLocal returnValue = new ThreadLocal();
+public class AsyncInvocation<V> implements Future<V> {
+  // TODO:davidw: Add the ability to get a return value back from the
+  // async method call.  (Use a static ThreadLocal field that is
+  // accessible from the Runnable used in VM#invoke)
+  // TODO:?: reimplement using Futures
+
+  private static final long DEFAULT_JOIN_MILLIS = 60 * 1000;
 
-  /** The singleton the thread group */
-  private static final ThreadGroup GROUP = new AsyncInvocationGroup();
+  private final Thread thread;
 
-  ///////////////////// Instance Fields  /////////////////////
+  private final AtomicReference<V> resultValue = new AtomicReference<>();
 
-  /** An exception thrown while this async invocation ran */
-  protected volatile Throwable exception;
+  /** An exception thrown while this {@code AsyncInvocation} ran */
+  private final AtomicReference<Throwable> resultThrowable = new AtomicReference<>();
 
-  /** The object (or class) that is the receiver of this asyn method
-   * invocation */
-  private Object receiver;
+  /** The object (or class) that is the target of this {@code AsyncInvocation} */
+  private Object target;
 
   /** The name of the method being invoked */
   private String methodName;
-  
-  /** The returned object if any */
-  public volatile T returnedObj = null;
-
-  //////////////////////  Constructors  //////////////////////
 
+  /** True if this {@code AsyncInvocation} has been cancelled */
+  private boolean cancelled;
+  
   /**
-   * Creates a new <code>AsyncInvocation</code>
+   * Creates a new {@code AsyncInvocation}.
    *
-   * @param receiver
-   *        The object or {@link Class} on which the remote method was
-   *        invoked
-   * @param methodName
-   *        The name of the method being invoked
-   * @param work
-   *        The actual invocation of the method
+   * @param  target
+   *         The object or {@link Class} on which the remote method was
+   *         invoked
+   * @param  methodName
+   *         The name of the method being invoked
+   * @param  work
+   *         The actual invocation of the method
    */
-  public AsyncInvocation(Object receiver, String methodName, Runnable work) {
-    super(GROUP, work, getName(receiver, methodName));
-    this.receiver = receiver;
+  public AsyncInvocation(final Object target, final String methodName, final Callable<V> work) {
+    this.target = target;
     this.methodName = methodName;
-    this.exception = null;
+    this.thread = new Thread(new AsyncInvocationGroup(), runnable(work), getName(target, methodName));
   }
 
-  //////////////////////  Static Methods  /////////////////////
-
   /**
-   * Returns the name of a <code>AsyncInvocation</code> based on its
-   * receiver and method name.
-   */
-  private static String getName(Object receiver, String methodName) {
-    StringBuffer sb = new StringBuffer(methodName);
-    sb.append(" invoked on ");
-    if (receiver instanceof Class) {
-      sb.append("class ");
-      sb.append(((Class) receiver).getName());
-
-    } else {
-      sb.append("an instance of ");
-      sb.append(receiver.getClass().getName());
-    }
-
-    return sb.toString();
-  }
-
-  /////////////////////  Instance Methods  ////////////////////
-
-  /**
-   * Returns the receiver of this async method invocation
+   * Returns the target of this async method invocation.
+   *
+   * @deprecated This method is not required for anything.
    */
-  public Object getReceiver() {
-    return this.receiver;
+  public Object getTarget() {
+    return this.target;
   }
 
   /**
-   * Returns the name of the method being invoked remotely
+   * Returns the name of the method being invoked remotely.
+   *
+   * @deprecated This method is not required for anything.
    */
   public String getMethodName() {
     return this.methodName;
@@ -131,86 +113,383 @@ public class AsyncInvocation<T> extends Thread {
   /**
    * Returns whether or not an exception occurred during this async
    * method invocation.
+   *
+   * @throws AssertionError if this {@code AsyncInvocation} is not done.
    */
   public boolean exceptionOccurred() {
-    if (this.isAlive()) {
-      throw new InternalGemFireError("Exception status not available while thread is alive.");
-    }
-    return this.exception != null;
+    return getException() != null;
   }
 
   /**
    * Returns the exception that was thrown during this async method
    * invocation.
+   *
+   * @throws AssertionError if this {@code AsyncInvocation} is not done.
    */
   public Throwable getException() {
-    if (this.isAlive()) {
-      throw new InternalGemFireError("Exception status not available while thread is alive.");
+    try {
+      checkIsDone("Exception status not available while thread is alive.");
+    } catch (IllegalStateException illegalStateException) {
+      throw new AssertionError(illegalStateException);
     }
-    if (this.exception instanceof RMIException) {
-      return ((RMIException) this.exception).getCause();
+
+    if (this.resultThrowable.get() instanceof RMIException) { // TODO:klund: delete our RMIException
+      return this.resultThrowable.get().getCause();
 
     } else {
-      return this.exception;
+      return this.resultThrowable.get();
     }
   }
 
-  //////////////////////  Inner Classes  //////////////////////
+  /**
+   * Throws {@code AssertionError} wrapping any {@code Exception} thrown by
+   * this {@code AsyncInvocation}.
+   *
+   * @return this {@code AsyncInvocation}
+   *
+   * @throws AssertionError wrapping any {@code Exception} thrown by this
+   *         {@code AsyncInvocation}.
+   */
+  public AsyncInvocation<V> checkException() {
+    if (this.resultThrowable.get() != null) {
+      throw new AssertionError("An exception occurred during asynchronous invocation.", getException());
+    }
+    return this;
+  }
 
   /**
-   * A <code>ThreadGroup</code> that notices when an exception occurs
-   * during an <code>AsyncInvocation</code>.
-   * 
-   * TODO: reimplement using Futures
+   * Returns the result of this {@code AsyncInvocation}.
+   *
+   * @return the result of this {@code AsyncInvocation}
+   *
+   * @throws AssertionError wrapping any {@code Exception} thrown by this
+   *         {@code AsyncInvocation}.
+   *
+   * @throws AssertionError wrapping a {@code TimeoutException} if this
+   *         {@code AsyncInvocation} fails to complete within the default
+   *         timeout of 60 seconds as defined by {@link #DEFAULT_JOIN_MILLIS}.
+   *
+   * @throws InterruptedException if the current thread is interrupted.
+   *
+   * @deprecated Please use {@link #get()} instead.
    */
-  private static class AsyncInvocationGroup extends ThreadGroup {
-    AsyncInvocationGroup() {
-      super("Async Invocations");
+  public V getResult() throws InterruptedException {
+    join();
+    checkException();
+    checkIsDone("Return value not available while thread is alive.");
+    return this.resultValue.get();
+  }
+
+  /**
+   * Returns the result of this {@code AsyncInvocation}.
+   *
+   * @param  millis
+   *         the time to wait in milliseconds
+   *
+   * @return the result of this {@code AsyncInvocation}
+   *
+   * @throws AssertionError wrapping any {@code Exception} thrown by this
+   *         {@code AsyncInvocation}.
+   *
+   * @throws AssertionError wrapping a {@code TimeoutException} if this
+   *         {@code AsyncInvocation} fails to complete within the specified
+   *         timeout of {@code millis}.
+   *
+   * @throws InterruptedException if the current thread is interrupted.
+   *
+   * @deprecated Please use {@link #get(long, TimeUnit)} instead.
+   */
+  public V getResult(final long millis) throws InterruptedException {
+    try {
+      return get(millis, TimeUnit.MILLISECONDS);
+    } catch (ExecutionException executionException) {
+      throw new AssertionError(executionException);
+    } catch (TimeoutException timeoutException) {
+      throw new AssertionError(timeoutException);
     }
+  }
 
-    public void uncaughtException(Thread thread, Throwable throwable) {
-      if (throwable instanceof VirtualMachineError) {
-        SystemFailure.setFailure((VirtualMachineError)throwable); // don't throw
-      }
-      if (thread instanceof AsyncInvocation) {
-        ((AsyncInvocation) thread).exception = throwable;
+  /**
+   * Returns the result of this {@code AsyncInvocation}.
+   *
+   * @return the result of this {@code AsyncInvocation}
+   *
+   * @throws AssertionError if this {@code AsyncInvocation} is not done.
+   *
+   * @deprecated Please use {@link #get()} instead.
+   */
+  public V getReturnValue() {
+    checkIsDone("Return value not available while thread is alive.");
+    return this.resultValue.get();
+  }
+
+  /**
+   * Waits at most {@code millis} milliseconds for this
+   * {@code AsyncInvocation} to complete. A timeout of {@code 0} means to wait
+   * forever.
+   *
+   * @param  millis
+   *         the time to wait in milliseconds
+   *
+   * @return this {@code AsyncInvocation}
+   *
+   * @throws IllegalArgumentException if the value of {@code millis} is
+   *         negative.
+   *
+   * @throws InterruptedException if the current thread is interrupted.
+   */
+  public synchronized AsyncInvocation<V> join(final long millis) throws InterruptedException {
+    this.thread.join(millis);
+    return this;
+  }
+
+  /**
+   * Waits at most {@code millis} milliseconds plus {@code nanos} nanoseconds
+   * for this {@code AsyncInvocation} to complete.
+   *
+   * @param  millis
+   *         the time to wait in milliseconds
+   * @param  nanos
+   *         {@code 0-999999} additional nanoseconds to wait
+   *
+   * @return this {@code AsyncInvocation}
+   *
+   * @throws IllegalArgumentException
+   *         if the value of {@code millis} is negative, or the value
+   *         of {@code nanos} is not in the range {@code 0-999999}.
+   *
+   * @throws InterruptedException if the current thread is interrupted.
+   */
+  public synchronized AsyncInvocation<V> join(final long millis, final int nanos) throws InterruptedException {
+    this.thread.join(millis, nanos);
+    return this;
+  }
+
+  /**
+   * Waits for this thread to die up to a default of 60 seconds as defined by
+   * {@link #DEFAULT_JOIN_MILLIS}.
+   *
+   * @return this {@code AsyncInvocation}
+   *
+   * @throws InterruptedException if the current thread is interrupted.
+   */
+  public AsyncInvocation<V> join() throws InterruptedException {
+    // do NOT invoke Thread#join() without a timeout
+    join(DEFAULT_JOIN_MILLIS);
+    return this;
+  }
+
+  /**
+   * Start this {@code AsyncInvocation}.
+   *
+   * @return this {@code AsyncInvocation}
+   */
+  public synchronized AsyncInvocation<V> start() {
+    this.thread.start();
+    return this;
+  }
+
+  /**
+   * Return this {@code AsyncInvocation}'s work thread.
+   *
+   * @return this {@code AsyncInvocation}'s work thread.
+   */
+  public synchronized Thread getThread() {
+    return this.thread;
+  }
+
+  /**
+   * Tests if this {@code AsyncInvocation}'s thread is alive. A thread is alive
+   * if it has been started and has not yet died.
+   *
+   * @return {@code true} if this {@code AsyncInvocation}'s thread is alive;
+   *         {@code false} otherwise.
+   */
+  public synchronized boolean isAlive() {
+    return this.thread.isAlive();
+  }
+
+  @Override
+  public synchronized boolean isCancelled() {
+    return this.cancelled;
+  }
+
+  @Override
+  public synchronized boolean isDone() {
+    return !this.thread.isAlive(); //state != NEW;
+  }
+
+  @Override
+  public synchronized boolean cancel(final boolean mayInterruptIfRunning) {
+    if (this.thread.isAlive()) {
+      if (mayInterruptIfRunning) {
+        this.cancelled = true;
+        this.thread.interrupt();
+        return true;
       }
     }
+    return false;
   }
-  
-  public T getResult() throws Throwable {
-    join();
-    if(this.exceptionOccurred()) {
-      throw new Exception("An exception occured during async invocation", this.exception);
+
+  /**
+   * Waits if necessary for the work to complete, and then returns the result
+   * of this {@code AsyncInvocation}.
+   *
+   * @return the result of this {@code AsyncInvocation}
+   *
+   * @throws AssertionError wrapping any {@code Exception} thrown by this
+   *         {@code AsyncInvocation}.
+   *
+   * @throws AssertionError wrapping a {@code TimeoutException} if this
+   *         {@code AsyncInvocation} fails to complete within the default
+   *         timeout of 60 seconds as defined by {@link #DEFAULT_JOIN_MILLIS}.
+   *
+   * @throws CancellationException if the computation was cancelled
+   *
+   * @throws ExecutionException if the computation threw an exception
+   *
+   * @throws InterruptedException if the current thread is interrupted.
+   */
+  @Override
+  public V get() throws ExecutionException, InterruptedException {
+    try {
+      return get(DEFAULT_JOIN_MILLIS, TimeUnit.MILLISECONDS);
+    } catch (TimeoutException timeoutException) {
+      throw new AssertionError(timeoutException);
     }
-    return this.returnedObj;
   }
-  
-  public T getResult(long waitTime) throws Throwable {
-    join(waitTime);
-    if(this.isAlive()) {
-      throw new TimeoutException();
-    }
-    if(this.exceptionOccurred()) {
-      throw new Exception("An exception occured during async invocation", this.exception);
+
+  /**
+   * Waits if necessary for at most the given time for the computation
+   * to complete, and then retrieves its result, if available.
+   *
+   * @param  timeout the maximum time to wait
+   * @param  unit the time unit of the timeout argument
+   *
+   * @return the result of this {@code AsyncInvocation}
+   *
+   * @throws AssertionError wrapping any {@code Exception} thrown by this
+   *         {@code AsyncInvocation}.
+   *
+   * @throws AssertionError wrapping a {@code TimeoutException} if this
+   *         {@code AsyncInvocation} fails to complete within the default
+   *         timeout of 60 seconds as defined by {@link #DEFAULT_JOIN_MILLIS}.
+   *
+   * @throws CancellationException if the computation was cancelled
+   *
+   * @throws ExecutionException if the computation threw an exception
+   *
+   * @throws InterruptedException if the current thread is interrupted.
+   *
+   * @throws TimeoutException if the wait timed out
+   */
+  @Override
+  public V get(final long timeout, final TimeUnit unit) throws ExecutionException, InterruptedException, TimeoutException {
+    long millis = unit.toMillis(timeout);
+    join(millis);
+    timeoutIfAlive(millis);
+    checkException();
+    return this.resultValue.get();
+  }
+
+  /**
+   * Returns the identifier of this {@code AsyncInvocation}'s thread. The
+   * thread ID is a positive <tt>long</tt> number generated when this thread
+   * was created. The thread ID is unique and remains unchanged during its
+   * lifetime. When a thread is terminated, this thread ID may be reused.
+   *
+   * @return this {@code AsyncInvocation}'s thread's ID.
+   */
+  public long getId() {
+    return this.thread.getId();
+  }
+
+  @Override
+  public String toString() {
+    return "AsyncInvocation{" + "target=" + target + ", methodName='" + methodName + '\'' + '}';
+  }
+
+  /**
+   * Throws {@code IllegalStateException} if this {@code AsyncInvocation} is
+   * not done.
+   *
+   * @param  message
+   *         The value to be used in constructing detail message
+   *
+   * @return this {@code AsyncInvocation}
+   *
+   * @throws IllegalStateException if this {@code AsyncInvocation} is not done.
+   */
+  private AsyncInvocation<V> checkIsDone(final String message) {
+    if (this.thread.isAlive()) {
+      throw new IllegalStateException(message);
     }
-    return this.returnedObj;
+    return this;
   }
 
-  public T getReturnValue() {
-    if (this.isAlive()) {
-      throw new InternalGemFireError("Return value not available while thread is alive.");
+  /**
+   * Throws {@code AssertionError} wrapping a {@code TimeoutException} if this
+   * {@code AsyncInvocation} fails to complete within the default timeout of 60
+   * seconds as defined by {@link #DEFAULT_JOIN_MILLIS}.
+   *
+   * @return this {@code AsyncInvocation}
+   *
+   * @throws TimeoutException if this {@code AsyncInvocation} fails to complete
+   *         within the default timeout of 60 seconds as defined by
+   *         {@link #DEFAULT_JOIN_MILLIS}.
+   */
+  private AsyncInvocation<V> timeoutIfAlive(final long timeout) throws TimeoutException {
+    if (this.thread.isAlive()) {
+      throw new TimeoutException("Timed out waiting " + timeout + " milliseconds for AsyncInvocation to complete.");
     }
-    return this.returnedObj;
+    return this;
   }
-  
-  public void run() {
-    super.run();
-    this.returnedObj = (T) returnValue.get();
-    returnValue.set(null);
+
+  private Runnable runnable(final Callable<V> work) {
+    return () -> {
+        try {
+          resultValue.set(work.call());
+        } catch (Throwable throwable) {
+          resultThrowable.set(throwable);
+        }
+    };
+  }
+
+  /**
+   * Returns the name of a {@code AsyncInvocation} based on its
+   * {@code targetObject} and {@code methodName}.
+   */
+  private static String getName(final Object target, final String methodName) {
+    StringBuilder sb = new StringBuilder(methodName);
+    sb.append(" invoked on ");
+    if (target instanceof Class) {
+      sb.append("class ");
+      sb.append(((Class) target).getName());
+
+    } else {
+      sb.append("an instance of ");
+      sb.append(target.getClass().getName());
+    }
+
+    return sb.toString();
   }
 
-  static void setReturnValue(Object v) {
-    returnValue.set(v);
+  /**
+   * A {@code ThreadGroup} that notices when an exception occurs
+   * during an {@code AsyncInvocation}.
+   */
+  private class AsyncInvocationGroup extends ThreadGroup {
+
+    private AsyncInvocationGroup() {
+      super("Async Invocations");
+    }
+
+    @Override
+    public void uncaughtException(Thread thread, Throwable throwable) {
+      if (throwable instanceof VirtualMachineError) {
+        SystemFailure.setFailure((VirtualMachineError)throwable); // don't throw
+      }
+      resultThrowable.set(throwable);
+    }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
index c0245f2..b7d33b0 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
@@ -16,24 +16,22 @@
  */
 package com.gemstone.gemfire.test.dunit;
 
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.test.dunit.internal.JUnit3DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.standalone.DUnitLauncher;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import org.junit.experimental.categories.Category;
 
 /**
  * This class is the superclass of all distributed unit tests.
- *
  */
 @Category(DistributedTest.class)
 @SuppressWarnings("serial")
 public abstract class DistributedTestCase extends JUnit3DistributedTestCase {
   
   /**
-   * Creates a new <code>DistributedTestCase</code> test with the given name.
+   * Creates a new {@code DistributedTestCase} test with the given name.
    */
   public DistributedTestCase(final String name) {
     super(name);
-    DUnitLauncher.launchIfNeeded();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestUtils.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestUtils.java
index c1850de..9f69dab 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestUtils.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestUtils.java
@@ -16,7 +16,7 @@
  */
 package com.gemstone.gemfire.test.dunit;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.*;
 
 import java.io.File;
 import java.util.Iterator;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/ThreadUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/ThreadUtils.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/ThreadUtils.java
index fe8f260..6ac6449 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/ThreadUtils.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/ThreadUtils.java
@@ -16,8 +16,8 @@
  */
 package com.gemstone.gemfire.test.dunit;
 
-import static org.junit.Assert.fail;
 import static com.gemstone.gemfire.test.dunit.Jitter.*;
+import static org.junit.Assert.*;
 
 import org.apache.logging.log4j.Logger;
 
@@ -108,6 +108,17 @@ public class ThreadUtils {
 
   /**
    * Wait for a thread to join.
+   *
+   * @param async async invocation to wait on
+   * @param timeoutMilliseconds maximum time to wait
+   * @throws AssertionError if the thread does not terminate
+   */
+  public static void join(final AsyncInvocation<?> async, final long timeoutMilliseconds) {
+    join(async.getThread(), timeoutMilliseconds);
+  }
+
+  /**
+   * Wait for a thread to join.
    * 
    * @param thread thread to wait on
    * @param timeoutMilliseconds maximum time to wait

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
index 962978f..eb52ffc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
@@ -21,15 +21,18 @@ import java.io.PrintWriter;
 import java.io.Serializable;
 import java.io.StringWriter;
 import java.rmi.RemoteException;
+import java.util.concurrent.Callable;
 
+import com.jayway.awaitility.Awaitility;
+import hydra.MethExecutorResult;
+
+import com.gemstone.gemfire.internal.process.ProcessUtils;
 import com.gemstone.gemfire.test.dunit.standalone.BounceResult;
 import com.gemstone.gemfire.test.dunit.standalone.RemoteDUnitVMIF;
-
-import hydra.MethExecutorResult;
+import com.gemstone.gemfire.test.dunit.standalone.StandAloneDUnitEnv;
 
 /**
  * This class represents a Java Virtual Machine that runs on a host.
- *
  */
 @SuppressWarnings("serial")
 public class VM implements Serializable {
@@ -46,11 +49,33 @@ public class VM implements Serializable {
   /** The state of this VM */
   private volatile boolean available;
 
-  ////////////////////  Constructors  ////////////////////
+  /**
+   * Returns the {@code VM} identity. For {@link StandAloneDUnitEnv} the number
+   * returned is a zero-based sequence representing the order in with
+   * the DUnit {@code VM}s were launched.
+   */
+  public static int getCurrentVMNum() {
+    return DUnitEnv.get().getVMID();
+  }
+
+  /**
+   * Returns the total number of {@code VM}s on all {@code Host}s (note that
+   * DUnit currently only supports one {@code Host}).
+   */
+  public static int getVMCount() {
+    int count = 0;
+    for (int h = 0; h < Host.getHostCount(); h++) {
+      Host host = Host.getHost(h);
+      count += host.getVMCount();
+    }
+    return count;
+  }
 
   /**
-   * Creates a new <code>VM</code> that runs on a given host with a
-   * given process id.
+   * Creates a new {@code VM} that runs on a given host with a given process 
+   * id.
+   * 
+   * TODO: change pid to reflect value from {@link ProcessUtils#identifyPid()}
    */
   public VM(final Host host, final int pid, final RemoteDUnitVMIF client) {
     this.host = host;
@@ -59,452 +84,378 @@ public class VM implements Serializable {
     this.available = true;
   }
 
-  //////////////////////  Accessors  //////////////////////
-
   /**
-   * Returns the host on which this <code>VM</code> runs
+   * Returns the {@code Host} on which this {@code VM} is running.
    */
   public Host getHost() {
     return this.host;
   }
 
   /**
-   * Returns the process id of this <code>VM</code>
+   * Returns the process id of this {@code VM}.
    */
   public int getPid() {
     return this.pid;
   }
 
-  /////////////////  Remote Method Invocation  ///////////////
-
   /**
-   * Invokes a static zero-arg method  with an {@link Object} or
-   * <code>void</code> return type in this VM.  If the return type of
-   * the method is <code>void</code>, <code>null</code> is returned.
-   *
-   * @param targetClass
-   *        The class on which to invoke the method
-   * @param methodName
-   *        The name of the method to invoke
+   * Invokes a static zero-arg method  with an {@link Object} or {@code void} 
+   * return type in this {@code VM}.  If the return type of the method is
+   * {@code void}, {@code null} is returned.
    *
+   * @param  targetClass
+   *         The class on which to invoke the method
+   * @param  methodName
+   *         The name of the method to invoke
+   *         
    * @throws RMIException
-   *         An exception occurred on while invoking the method in
+   *         Wraps any underlying exception thrown while invoking the method in
    *         this VM
-   * @deprecated Use {@link #invoke(SerializableCallableIF)} instead        
+   *         
+   * @deprecated Please use {@link #invoke(SerializableCallableIF)} instead        
    */
   public Object invoke(final Class targetClass, final String methodName) {
     return invoke(targetClass, methodName, new Object[0]);
   }
 
   /**
-   * Asynchronously invokes a static zero-arg method with an {@link
-   * Object} or <code>void</code> return type in this VM.  If the
-   * return type of the method is <code>void</code>, <code>null</code>
-   * is returned.
+   * Asynchronously invokes a static zero-arg method with an {@code Object} or
+   * {@code void} return type in this VM.  If the return type of the method is
+   * {@code void}, {@code null} is returned.
    *
-   * @param targetClass
-   *        The class on which to invoke the method
-   * @param methodName
-   *        The name of the method to invoke
-   * @deprecated Use {@link #invoke(SerializableCallableIF)} instead       
+   * @param  targetClass
+   *         The class on which to invoke the method
+   * @param  methodName
+   *         The name of the method to invoke
+   *         
+   * @deprecated Please use {@link #invoke(SerializableCallableIF)} instead       
    */
   public AsyncInvocation invokeAsync(final Class targetClass, final String methodName) {
     return invokeAsync(targetClass, methodName, null);
   }
 
   /**
-   * Invokes a static method with an {@link Object} or
-   * <code>void</code> return type in this VM.  If the return type of
-   * the method is <code>void</code>, <code>null</code> is returned.
-   *
-   * @param targetClass
-   *        The class on which to invoke the method
-   * @param methodName
-   *        The name of the method to invoke
-   * @param args
-   *        Arguments passed to the method call (must be {@link
-   *        java.io.Serializable}). 
+   * Invokes a static method with an {@link Object} or {@code void} return type
+   * in this VM.  If the return type of the method is {@code void},
+   * {@code null} is returned.
    *
+   * @param  targetClass
+   *         The class on which to invoke the method
+   * @param  methodName
+   *         The name of the method to invoke
+   * @param  args
+   *         Arguments passed to the method call (must be
+   *         {@link java.io.Serializable}).
+   *         
    * @throws RMIException
-   *         An exception occurred on while invoking the method in
-   *         this VM
-   * @deprecated Use {@link #invoke(SerializableCallableIF)} instead        
+   *         Wraps any underlying exception thrown while invoking the method in
+   *         this {@code VM}
+   *         
+   * @deprecated Please use {@link #invoke(SerializableCallableIF)} instead        
    */
-  public Object invoke(Class targetClass, String methodName, Object[] args) {
+  public Object invoke(final Class targetClass, final String methodName, final Object[] args) {
     if (!this.available) {
-      String s = "VM not available: " + this;
-      throw new RMIException(this, targetClass.getName(), methodName,
-            new IllegalStateException(s));
-    }
-    MethExecutorResult result = null;
-    int retryCount = 120;
-    do {
-    try {
-      result = this.client.executeMethodOnClass(targetClass.getName(), methodName, args);
-      break; // out of while loop
-    } catch( RemoteException e ) {
-      boolean isWindows = false;
-      String os = System.getProperty("os.name");
-      if (os != null) {
-        if (os.indexOf("Windows") != -1) {
-          isWindows = true;
-        }
-      }
-      if (isWindows && retryCount-- > 0) {
-        boolean interrupted = Thread.interrupted();
-        try { Thread.sleep(1000); } catch (InterruptedException ignore) {interrupted = true;}
-        finally {
-          if (interrupted) {
-            Thread.currentThread().interrupt();
-          }
-        }
-      } else {
-        throw new RMIException(this, targetClass.getName(), methodName, e );
-      }
+      throw new RMIException(this, targetClass.getName(), methodName, new IllegalStateException("VM not available: " + this));
     }
-    } while (true);
+
+    MethExecutorResult result = execute(targetClass, methodName, args);
 
     if (!result.exceptionOccurred()) {
       return result.getResult();
 
     } else {
-      Throwable thr = result.getException();
-      throw new RMIException(this, targetClass.getName(), methodName, thr,
-                             result.getStackTrace()); 
+      throw new RMIException(this, targetClass.getName(), methodName, result.getException(), result.getStackTrace()); 
     }
   }
 
   /**
-   * Asynchronously invokes a static method with an {@link Object} or
-   * <code>void</code> return type in this VM.  If the return type of
-   * the method is <code>void</code>, <code>null</code> is returned.
+   * Asynchronously invokes an instance method with an {@link Object} or 
+   * {@code void} return type in this {@code VM}.  If the return type of the
+   * method is {@code void}, {@code null} is returned.
    *
-   * @param targetClass
-   *        The class on which to invoke the method
-   * @param methodName
-   *        The name of the method to invoke
-   * @param args
-   *        Arguments passed to the method call (must be {@link
-   *        java.io.Serializable}).
-   * @deprecated Use {@link #invoke(SerializableCallableIF)} instead 
+   * @param  targetObject
+   *         The object on which to invoke the method
+   * @param  methodName
+   *         The name of the method to invoke
+   * @param  args
+   *         Arguments passed to the method call (must be {@link
+   *         java.io.Serializable}).
+   *         
+   * @deprecated Please use {@link #invoke(SerializableCallableIF)} instead
    */
-  public AsyncInvocation invokeAsync(final Class targetClass, 
-                                     final String methodName,
-                                     final Object[] args) {
-    AsyncInvocation ai =
-      new AsyncInvocation(targetClass, methodName, new Runnable() {
-        public void run() {
-          final Object o = invoke(targetClass, methodName, args);
-          AsyncInvocation.setReturnValue(o);
-        }
-      });
-    ai.start();
-    return ai;
+  public AsyncInvocation invokeAsync(final Object targetObject, final String methodName, final Object[] args) {
+    return new AsyncInvocation(targetObject, methodName, () -> invoke(targetObject, methodName, args)).start();
   }
 
   /**
    * Asynchronously invokes an instance method with an {@link Object} or
-   * <code>void</code> return type in this VM.  If the return type of
-   * the method is <code>void</code>, <code>null</code> is returned.
+   * {@code void} return type in this {@code VM}.  If the return type of the
+   * method is {@code void}, {@code null} is returned.
+   *
+   * @param  targetClass
+   *         The class on which to invoke the method
+   * @param  methodName
+   *         The name of the method to invoke
+   * @param  args
+   *         Arguments passed to the method call (must be {@link
+   *         java.io.Serializable}).
    *
-   * @param o
-   *        The object on which to invoke the method
-   * @param methodName
-   *        The name of the method to invoke
-   * @param args
-   *        Arguments passed to the method call (must be {@link
-   *        java.io.Serializable}).
-   * @deprecated Use {@link #invoke(SerializableCallableIF)} instead
+   * @deprecated Please use {@link #invoke(SerializableCallableIF)} instead
    */
-  public AsyncInvocation invokeAsync(final Object o, 
-                                     final String methodName,
-                                     final Object[] args) {
-    AsyncInvocation ai =
-      new AsyncInvocation(o, methodName, new Runnable() {
-        public void run() {
-          final Object ret = invoke(o, methodName, args);
-          AsyncInvocation.setReturnValue(ret);
-        }
-      });
-    ai.start();
-    return ai;
+  public AsyncInvocation invokeAsync(final Class<?> targetClass, final String methodName, final Object[] args) {
+    return new AsyncInvocation(targetClass, methodName, () -> invoke(targetClass, methodName, args)).start();
   }
 
   /**
-   * Invokes the <code>run</code> method of a {@link Runnable} in this
-   * VM.  Recall that <code>run</code> takes no arguments and has no
-   * return value.
-   *
-   * @param r
-   *        The <code>Runnable</code> to be run
+   * Invokes the {@code run} method of a {@link Runnable} in this VM.  Recall
+   * that {@code run} takes no arguments and has no return value.
    *
+   * @param  runnable
+   *         The {@code Runnable} to be run
+   *         
    * @see SerializableRunnable
    */
-  public AsyncInvocation invokeAsync(SerializableRunnableIF r) {
-    return invokeAsync(r, "run", new Object[0]);
+  public AsyncInvocation invokeAsync(final SerializableRunnableIF runnable) {
+    return invokeAsync(runnable, "run", new Object[0]);
   }
   
   /**
-   * Invokes the <code>run</code> method of a {@link Runnable} in this
-   * VM.  Recall that <code>run</code> takes no arguments and has no
-   * return value.  The Runnable is wrapped in a NamedRunnable having
-   * the given name so it shows up in dunit logs.
+   * Invokes the {@code run} method of a {@link Runnable} in this VM.  Recall 
+   * that {@code run} takes no arguments and has no return value.  The 
+   * {@code Runnable} is wrapped in a {@link NamedRunnable} having the given 
+   * name so it shows up in DUnit logs.
    *
-   * @param r
-   *        The <code>Runnable</code> to be run
-   * @param name the name of the runnable, which will be logged in dunit output
+   * @param  runnable
+   *         The {@code Runnable} to be run
+   * @param  name 
+   *         The name of the {@code Runnable}, which will be logged in DUnit 
+   *         output
    *
    * @see SerializableRunnable
    */
-  public AsyncInvocation invokeAsync(String name, SerializableRunnableIF r) {
-    NamedRunnable nr = new NamedRunnable(name, r);
-    return invokeAsync(nr, "run", new Object[0]);
+  public AsyncInvocation invokeAsync(final String name, final SerializableRunnableIF runnable) {
+    return invokeAsync(new NamedRunnable(name, runnable), "run", new Object[0]);
   }
   
   /**
-   * Invokes the <code>call</code> method of a {@link Runnable} in this
-   * VM.  
+   * Invokes the {@code call} method of a {@link Callable} in this {@code VM}.  
    *
-   * @param c
-   *        The <code>Callable</code> to be run
-   * @param name the name of the callable, which will be logged in dunit output
+   * @param  callable
+   *         The {@code Callable} to be run
+   * @param  name 
+   *         The name of the {@code Callable}, which will be logged in dunit 
+   *         output
    *
    * @see SerializableCallable
    */
-  public <T> AsyncInvocation<T> invokeAsync(String name, SerializableCallableIF<T> c) {
-    return invokeAsync(new NamedCallable(name, c), "call", new Object[0]);
+  public <T> AsyncInvocation<T> invokeAsync(final String name, final SerializableCallableIF<T> callable) {
+    return invokeAsync(new NamedCallable(name, callable), "call", new Object[0]);
   }
 
   /**
-   * Invokes the <code>call</code> method of a {@link Runnable} in this
-   * VM.  
+   * Invokes the {@code call} method of a {@link Callable} in this {@code VM}.
    *
-   * @param c
-   *        The <code>Callable</code> to be run
+   * @param  callable
+   *         The {@code Callable} to be run
    *
    * @see SerializableCallable
    */
-  public <T> AsyncInvocation<T> invokeAsync(SerializableCallableIF<T> c) {
-    return invokeAsync(c, "call", new Object[0]);
+  public <T> AsyncInvocation<T> invokeAsync(final SerializableCallableIF<T> callable) {
+    return invokeAsync(callable, "call", new Object[0]);
   }
 
   /**
-   * Invokes the <code>run</code> method of a {@link Runnable} in this
-   * VM.  Recall that <code>run</code> takes no arguments and has no
-   * return value.
+   * Invokes the {@code run} method of a {@link Runnable} in this {@code VM}.
+   * Recall that {@code run} takes no arguments and has no return value.
    *
-   * @param r
-   *        The <code>Runnable</code> to be run
-   * @param name the name of the runnable, which will be logged in dunit output
+   * @param  runnable
+   *         The {@code Runnable} to be run
+   * @param  name 
+   *         The name of the {@code Runnable}, which will be logged in DUnit 
+   *         output
    *
    * @see SerializableRunnable
    */
-  public void invoke(String name, SerializableRunnableIF r) {
-    invoke(new NamedRunnable(name, r), "run");
+  public void invoke(final String name, final SerializableRunnableIF runnable) {
+    invoke(new NamedRunnable(name, runnable), "run");
   }
 
   /**
-   * Invokes the <code>run</code> method of a {@link Runnable} in this
-   * VM.  Recall that <code>run</code> takes no arguments and has no
-   * return value.
+   * Invokes the {@code run} method of a {@link Runnable} in this {@code VM}.
+   * Recall that {@code run} takes no arguments and has no return value.
    *
-   * @param r
-   *        The <code>Runnable</code> to be run
+   * @param  runnable
+   *         The {@code Runnable} to be run
    *
    * @see SerializableRunnable
    */
-  public void invoke(SerializableRunnableIF r) {
-    invoke(r, "run");
+  public void invoke(final SerializableRunnableIF runnable) {
+    invoke(runnable, "run");
   }
   
   /**
-   * Invokes the <code>run</code> method of a {@link Runnable} in this
-   * VM.  Recall that <code>run</code> takes no arguments and has no
-   * return value.
+   * Invokes the {@code call} method of a {@link Callable} in this {@code VM}.
    *
-   * @param c
-   *        The <code>Callable</code> to be run
-   * @param name the name of the callable, which will be logged in dunit output
+   * @param  callable
+   *         The {@code Callable} to be run
+   * @param  name 
+   *         The name of the {@code Callable}, which will be logged in DUnit 
+   *         output
    *
    * @see SerializableCallable
    */
-  public <T>  T invoke(String name, SerializableCallableIF<T> c) {
-    return (T) invoke(new NamedCallable(name, c), "call");
+  public <T>  T invoke(final String name, final SerializableCallableIF<T> callable) {
+    return (T) invoke(new NamedCallable(name, callable), "call");
   }
   
   /**
-   * Invokes the <code>run</code> method of a {@link Runnable} in this
-   * VM.  Recall that <code>run</code> takes no arguments and has no
-   * return value.
+   * Invokes the {@code call} method of a {@link Callable} in this {@code VM}. 
    *
-   * @param c
-   *        The <code>Callable</code> to be run
+   * @param  callable
+   *         The {@code Callable} to be run
    *
    * @see SerializableCallable
    */
-  public <T>  T invoke(SerializableCallableIF<T> c) {
-    return (T) invoke(c, "call");
+  public <T>  T invoke(final SerializableCallableIF<T> callable) {
+    return (T) invoke(callable, "call");
   }
   
   /**
-   * Invokes the <code>run</code> method of a {@link Runnable} in this
-   * VM.  If the invocation throws AssertionFailedError, and repeatTimeoutMs
-   * is >0, the <code>run</code> method is invoked repeatedly until it
+   * Invokes the {@code run} method of a {@link Runnable} in this {@code VM}.
+   * If the invocation throws AssertionFailedError, and repeatTimeoutMs
+   * is >0, the {@code run} method is invoked repeatedly until it
    * either succeeds, or repeatTimeoutMs has passed.  The AssertionFailedError
-   * is thrown back to the sender of this method if <code>run</code> has not
+   * is thrown back to the sender of this method if {@code run} has not
    * completed successfully before repeatTimeoutMs has passed.
    * 
-   * @deprecated Please use {@link com.jayway.awaitility.Awaitility} with {@link #invoke(SerializableCallableIF)} instead.
+   * @deprecated Please use {@link Awaitility} to await condition and then {@link #invoke(SerializableCallableIF)} instead.
    */
-  public void invokeRepeatingIfNecessary(RepeatableRunnable o, long repeatTimeoutMs) {
-    invoke(o, "runRepeatingIfNecessary", new Object[] {new Long(repeatTimeoutMs)});
+  public void invokeRepeatingIfNecessary(final RepeatableRunnable runnable, final long repeatTimeoutMs) {
+    invoke(runnable, "runRepeatingIfNecessary", new Object[] { repeatTimeoutMs });
   }
 
   /**
-   * Invokes an instance method with no arguments on an object that is
-   * serialized into this VM.  The return type of the method can be
-   * either {@link Object} or <code>void</code>.  If the return type
-   * of the method is <code>void</code>, <code>null</code> is
-   * returned.
+   * Invokes an instance method with no arguments on an object that is 
+   * serialized into this {@code VM}.  The return type of the method can be
+   * either {@link Object} or {@code void}.  If the return type of the method
+   * is {@code void}, {@code null} is returned.
    *
-   * @param o
-   *        The receiver of the method invocation
-   * @param methodName
-   *        The name of the method to invoke
+   * @param  targetObject
+   *         The receiver of the method invocation
+   * @param  methodName
+   *         The name of the method to invoke
    *
    * @throws RMIException
-   *         An exception occurred on while invoking the method in
-   *         this VM
-   * @deprecated Use {@link #invoke(SerializableCallableIF)} instead        
+   *         Wraps any underlying exception thrown while invoking the method in
+   *         this {@code VM}
+   *         
+   * @deprecated Please use {@link #invoke(SerializableCallableIF)} instead.        
    */
-  public Object invoke(Object o, String methodName) {
-    return invoke(o, methodName, new Object[0]);
+  public Object invoke(final Object targetObject, final String methodName) {
+    return invoke(targetObject, methodName, new Object[0]);
   }
   
   /**
-   * Invokes an instance method on an object that is serialized into
-   * this VM.  The return type of the method can be either {@link
-   * Object} or <code>void</code>.  If the return type of the method
-   * is <code>void</code>, <code>null</code> is returned.
+   * Invokes an instance method on an object that is serialized into this
+   * {@code VM}.  The return type of the method can be either {@link Object} or
+   * {@code void}.  If the return type of the method is {@code void},
+   * {@code null} is returned.
    *
-   * @param o
-   *        The receiver of the method invocation
-   * @param methodName
-   *        The name of the method to invoke
-   * @param args
-   *        Arguments passed to the method call (must be {@link
-   *        java.io.Serializable}). 
+   * @param  targetObject
+   *         The receiver of the method invocation
+   * @param  methodName
+   *         The name of the method to invoke
+   * @param  args
+   *         Arguments passed to the method call (must be {@link
+   *         java.io.Serializable}).
    *
    * @throws RMIException
-   *         An exception occurred on while invoking the method in
-   *         this VM
-   * @deprecated Use {@link #invoke(SerializableCallableIF)} instead        
+   *         Wraps any underlying exception thrown while invoking the method in
+   *         this {@code VM}
+   *
+   * @deprecated Please use {@link #invoke(SerializableCallableIF)} instead.
    */
-  public Object invoke(Object o, String methodName, Object[] args) {
+  public Object invoke(final Object targetObject, final String methodName, final Object[] args) {
     if (!this.available) {
-      String s = "VM not available: " + this;
-      throw new RMIException(this, o.getClass().getName(), methodName,
-            new IllegalStateException(s));
+      throw new RMIException(this, targetObject.getClass().getName(), methodName, new IllegalStateException("VM not available: " + this));
     }
-    MethExecutorResult result = null;
-    int retryCount = 120;
-    do {
-    try {
-      if ( args == null )
-        result = this.client.executeMethodOnObject(o, methodName);
-      else
-        result = this.client.executeMethodOnObject(o, methodName, args);
-      break; // out of while loop
-    } catch( RemoteException e ) {
-      if (retryCount-- > 0) {
-        boolean interrupted = Thread.interrupted();
-        try { Thread.sleep(1000); } catch (InterruptedException ignore) {interrupted = true;}
-        finally {
-          if (interrupted) {
-            Thread.currentThread().interrupt();
-          }
-        }
-      } else {
-        throw new RMIException(this, o.getClass().getName(), methodName, e );
-      }
-    }
-    } while (true);
+
+    MethExecutorResult result = execute(targetObject, methodName, args);
 
     if (!result.exceptionOccurred()) {
       return result.getResult();
 
     } else {
-      Throwable thr = result.getException();
-      throw new RMIException(this, o.getClass().getName(), methodName, thr,
-                             result.getStackTrace()); 
+      throw new RMIException(this, targetObject.getClass().getName(), methodName, result.getException(), result.getStackTrace());
     }
   }
 
-
-
-
   /**
-   * Synchronously bounces (mean kills and restarts) this <code>VM</code>.
-   * Concurrent bounce attempts are synchronized but attempts to invoke
-   * methods on a bouncing VM will cause test failure.  Tests using bounce
-   * should be placed at the end of the dunit test suite, since an exception
-   * here will cause all tests using the unsuccessfully bounced VM to fail.
+   * Synchronously bounces (mean kills and restarts) this {@code VM}.
+   * Concurrent bounce attempts are synchronized but attempts to invoke methods
+   * on a bouncing {@code VM} will cause test failure.  Tests using bounce
+   * should be placed at the end of the DUnit test suite, since an exception
+   * here will cause all tests using the unsuccessfully bounced {@code VM} to
+   * fail.
    * 
-   * This method is currently not supported by the standalone dunit
-   * runner.
+   * This method is currently not supported by the standalone DUnit runner.
    *
-   * @throws RMIException if an exception occurs while bouncing this VM, for
-   *  example a HydraTimeoutException if the VM fails to stop within 
-   *  hydra.Prms#maxClientShutdownWaitSec or restart within 
-   *  hydra.Prms#maxClientStartupWaitSec.
+   * @throws RMIException if an exception occurs while bouncing this
+   *         {@code VM}, for example a {@code HydraTimeoutException} if the
+   *         {@code VM} fails to stop within
+   *         {@code hydra.Prms#maxClientShutdownWaitSec} or restart within
+   *         {@code hydra.Prms#maxClientStartupWaitSec}.
    */
   public synchronized void bounce() {
     if (!this.available) {
-      String s = "VM not available: " + this;
-      throw new RMIException(this, this.getClass().getName(), "bounceVM",
-            new IllegalStateException(s));
+      throw new RMIException(this, getClass().getName(), "bounceVM", new IllegalStateException("VM not available: " + this));
     }
+
     this.available = false;
+
     try {
       BounceResult result = DUnitEnv.get().bounce(this.pid);
-      
       this.pid = result.getNewPid();
       this.client = result.getNewClient();
       this.available = true;
+
     } catch (UnsupportedOperationException e) {
       this.available = true;
       throw e;
+
     } catch (RemoteException e) {
       StringWriter sw = new StringWriter();
       e.printStackTrace(new PrintWriter(sw, true));
-      RMIException rmie = new RMIException(this, this.getClass().getName(),
-        "bounceVM", e, sw.toString());
+      RMIException rmie = new RMIException(this, getClass().getName(), "bounceVM", e, sw.toString());
       throw rmie;
     }
   }
 
-  /////////////////////  Utility Methods  ////////////////////
-
   public String toString() {
-    return "VM " + this.getPid() + " running on " + this.getHost();
+    return "VM " + getPid() + " running on " + getHost();
   }
 
-  public static int getCurrentVMNum() {
-    return DUnitEnv.get().getVMID();
-  }
-  
   public File getWorkingDirectory() {
-    return DUnitEnv.get().getWorkingDirectory(this.getPid());
+    return DUnitEnv.get().getWorkingDirectory(getPid());
   }
 
-  /** Return the total number of VMs on all hosts */
-  public static int getVMCount() {
-    int count = 0;
-    for (int h = 0; h < Host.getHostCount(); h++) {
-      Host host = Host.getHost(h);
-      count += host.getVMCount();
+  private MethExecutorResult execute(final Class targetClass, final String methodName, final Object[] args) {
+    try {
+      return this.client.executeMethodOnClass(targetClass.getName(), methodName, args);
+    } catch (RemoteException exception) {
+      throw new RMIException(this, targetClass.getName(), methodName, exception);
     }
-    return count;
   }
 
+  private MethExecutorResult execute(final Object targetObject, final String methodName, final Object[] args) {
+    try {
+      if (args == null) {
+        return this.client.executeMethodOnObject(targetObject, methodName);
+      } else {
+        return this.client.executeMethodOnObject(targetObject, methodName, args);
+      }
+    } catch (RemoteException exception) {
+      throw new RMIException(this, targetObject.getClass().getName(), methodName, exception);
+    }
+  }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java
index b73a25c..564fb91 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java
@@ -16,8 +16,8 @@
  */
 package com.gemstone.gemfire.test.dunit;
 
-import static org.junit.Assert.fail;
 import static com.gemstone.gemfire.test.dunit.Jitter.*;
+import static org.junit.Assert.*;
 
 import org.apache.logging.log4j.Logger;
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
index b5bd5f7..6a719ab 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/cache/internal/JUnit4CacheTestCase.java
@@ -18,13 +18,14 @@ package com.gemstone.gemfire.test.dunit.cache.internal;
 
 import java.io.File;
 import java.io.FileWriter;
-import java.io.FilenameFilter;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.Arrays;
 import java.util.Map;
 import java.util.Properties;
 
+import org.apache.logging.log4j.Logger;
+
 import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheException;
@@ -56,7 +57,6 @@ import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.logging.log4j.Logger;
 
 /**
  * This class is the base class for all distributed tests using JUnit 4 that

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f2d5969e/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit3DistributedTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit3DistributedTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit3DistributedTestCase.java
index f453e7e..71dee9b 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit3DistributedTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/test/dunit/internal/JUnit3DistributedTestCase.java
@@ -19,14 +19,15 @@ package com.gemstone.gemfire.test.dunit.internal;
 import java.io.Serializable;
 import java.util.Properties;
 
+import junit.framework.TestCase;
+import org.apache.logging.log4j.Logger;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import junit.framework.TestCase;
-import org.apache.logging.log4j.Logger;
-import org.junit.experimental.categories.Category;
 
 /**
  * This class is the superclass of all distributed tests using JUnit 3.
@@ -36,7 +37,7 @@ public abstract class JUnit3DistributedTestCase extends TestCase implements Dist
 
   private static final Logger logger = LogService.getLogger();
 
-  private final JUnit4DistributedTestCase delegate = new JUnit4DistributedTestCase(this);
+  private final JUnit4DistributedTestCase delegate = new JUnit4DistributedTestCase(this) {};
 
   /**
    * Constructs a new distributed test. All JUnit 3 test classes need to have a



Mime
View raw message