You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2016/06/09 20:15:17 UTC

[49/70] [abbrv] [partial] incubator-geode git commit: GEODE-837: update tests from JUnit3 to JUnit4

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
index fddf108..ff2f6fa 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/AutoConnectionSourceDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.NoAvailableLocatorsException;
@@ -43,6 +52,7 @@ import java.util.List;
  * - dynamically discovering servers, locators, handling
  * locator disappearance, etc.
  */
+@Category(DistributedTest.class)
 public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
 
   protected static final Object BRIDGE_LISTENER = "BRIDGE_LISTENER";
@@ -53,10 +63,11 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     IgnoredException.addIgnoredException("NoAvailableLocatorsException");
   }
 
-  public AutoConnectionSourceDUnitTest(String name) {
-    super(name);
+  public AutoConnectionSourceDUnitTest() {
+    super();
   }
 
+  @Test
   public void testDiscoverBridgeServers() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -78,6 +89,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     Assert.assertEquals("value", getInVM(vm1, "key"));
   }
 
+  @Test
   public void testNoLocators() {
 
     final Host host = Host.getHost(0);
@@ -93,6 +105,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     }
   }
 
+  @Test
   public void testNoBridgeServer() {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -110,6 +123,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     }
   }
 
+  @Test
   public void testDynamicallyFindBridgeServer() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -138,6 +152,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     Assert.assertEquals("value2", getInVM(vm3, "key2"));
   }
 
+  @Test
   public void testDynamicallyFindLocators() throws Exception {
     try {
       final Host host = Host.getHost(0);
@@ -182,6 +197,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     }
   }
 
+  @Test
   public void testEmbeddedLocator() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -218,6 +234,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     });
   }
 
+  @Test
   public void testServerGroups() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -273,6 +290,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     Assert.assertEquals("value", getInVM(vm1, "B", "key7"));
   }
 
+  @Test
   public void testTwoServersInSameVM() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -300,6 +318,7 @@ public class AutoConnectionSourceDUnitTest extends LocatorTestBase {
     checkEndpoints(vm2, new int[] { serverPort1 });
   }
 
+  @Test
   public void testClientMembershipListener() throws Exception {
     final Host host = Host.getHost(0);
     VM locatorVM = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
index 3c675b8..6c2f3ec 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/CacheServerSSLConnectionDUnitTest.java
@@ -16,32 +16,40 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.security.AuthenticationRequiredException;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.IgnoredException;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 import com.gemstone.gemfire.util.test.TestUtil;
 
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
 /**
  * Tests cacheserver ssl support added. See https://svn.gemstone.com/trac/gemfire/ticket/48995 for details
  */
-public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
-
-  private static final long serialVersionUID = 1L;
+@Category(DistributedTest.class)
+public class CacheServerSSLConnectionDUnitTest extends JUnit4DistributedTestCase {
 
   private static final String TRUSTED_STORE = "trusted.keystore";
   private static final String CLIENT_KEY_STORE = "client.keystore";
@@ -49,7 +57,7 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
   private static final String SERVER_KEY_STORE = "cacheserver.keystore";
   private static final String SERVER_TRUST_STORE = "cacheserver.truststore";
 
-  private static CacheServerSSLConnectionDUnitTest instance = new CacheServerSSLConnectionDUnitTest("CacheServerSSLConnectionDUnit");
+  private static CacheServerSSLConnectionDUnitTest instance = new CacheServerSSLConnectionDUnitTest(); // TODO: memory leak
 
   private Cache cache;
   private CacheServer cacheServer;
@@ -62,10 +70,6 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
     disconnectAllFromDS();
   }
 
-  public CacheServerSSLConnectionDUnitTest(String name) {
-    super(name);
-  }
-
   public Cache createCache(Properties props) throws Exception
   {
     props.setProperty(MCAST_PORT, "0");
@@ -98,7 +102,6 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
     this.cacheServer.stop();
   }
 
-
   @SuppressWarnings("rawtypes")
   public void setUpServerVM(boolean cacheServerSslenabled) throws Exception {
     Properties gemFireProps = new Properties();
@@ -229,6 +232,7 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
     }
   }
 
+  @Test
   public void testCacheServerSSL() throws Exception {
     final Host host = Host.getHost(0);
     VM serverVM = host.getVM(1);
@@ -246,10 +250,9 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
     clientVM.invoke(() -> setUpClientVMTask(hostName, port, cacheClientSslenabled, cacheClientSslRequireAuth, CLIENT_KEY_STORE, CLIENT_TRUST_STORE));
     clientVM.invoke(() -> doClientRegionTestTask());
     serverVM.invoke(() -> doServerRegionTestTask());
-
   }
 
-
+  @Test
   public void testNonSSLClient() throws Exception {
     final Host host = Host.getHost(0);
     VM serverVM = host.getVM(1);
@@ -292,6 +295,7 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
     }
   }
 
+  @Test
   public void testSSLClientWithNoAuth() throws Exception {
     final Host host = Host.getHost(0);
     VM serverVM = host.getVM(1);
@@ -328,6 +332,7 @@ public class CacheServerSSLConnectionDUnitTest extends DistributedTestCase {
     }
   }
 
+  @Test
   public void testSSLClientWithNonSSLServer() throws Exception {
     final Host host = Host.getHost(0);
     VM serverVM = host.getVM(1);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
index ea105d3..1bc2322 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorLoadBalancingDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.internal.locator.ClientConnectionRequest;
@@ -55,6 +64,7 @@ import java.util.concurrent.TimeUnit;
 /**
  *
  */
+@Category(DistributedTest.class)
 public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
 
   /**
@@ -69,14 +79,15 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
   private static final int ALLOWABLE_ERROR_IN_COUNT = 1;
   protected static final long MAX_WAIT = 60000;
 
-  public LocatorLoadBalancingDUnitTest(String name) {
-    super(name);
+  public LocatorLoadBalancingDUnitTest() {
+    super();
   }
 
   /**
    * Test the locator discovers a bridge server and is initialized with
    * the correct load for that bridge server.
    */
+  @Test
   public void testDiscovery() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -112,6 +123,7 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
    * Test that the locator will properly estimate the load for servers when
    * it receives connection requests.
    */
+  @Test
   public void testEstimation() throws IOException, ClassNotFoundException {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -169,6 +181,7 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
    *
    * @throws Exception
    */
+  @Test
   public void testLoadMessaging() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -219,6 +232,7 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
    *
    * @throws Exception
    */
+  @Test
   public void testBalancing() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -284,6 +298,7 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
    *
    * @throws Exception
    */
+  @Test
   public void testIntersectingServerGroups() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -367,6 +382,7 @@ public class LocatorLoadBalancingDUnitTest extends LocatorTestBase {
 
   }
 
+  @Test
   public void testCustomLoadProbe() throws Exception {
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
index 7b1a513..2f79e50 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/LocatorTestBase.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import com.gemstone.gemfire.cache.*;
 import com.gemstone.gemfire.cache.client.Pool;
 import com.gemstone.gemfire.cache.client.PoolManager;
@@ -38,7 +47,7 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
 /**
  *
  */
-public abstract class LocatorTestBase extends DistributedTestCase {
+public abstract class LocatorTestBase extends JUnit4DistributedTestCase {
   protected static final String CACHE_KEY = "CACHE";
   protected static final String LOCATOR_KEY = "LOCATOR";
   protected static final String REGION_NAME = "A_REGION";
@@ -50,8 +59,8 @@ public abstract class LocatorTestBase extends DistributedTestCase {
    */
   protected static final HashMap remoteObjects = new HashMap();
 
-  public LocatorTestBase(String name) {
-    super(name);
+  public LocatorTestBase() {
+    super();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java
index e143462..c372374 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/internal/SSLNoClientAuthDUnitTest.java
@@ -16,31 +16,40 @@
  */
 package com.gemstone.gemfire.cache.client.internal;
 
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
 import com.gemstone.gemfire.cache.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionFactory;
 import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 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 com.gemstone.gemfire.util.test.TestUtil;
 
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
 /**
  * Test for GEODE-396
  */
-public class SSLNoClientAuthDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class SSLNoClientAuthDUnitTest extends JUnit4DistributedTestCase {
   
-  private static final long serialVersionUID = 1L;
   private Cache cache;
   private CacheServer cacheServer;
   private ClientCache clientCache;
@@ -49,17 +58,13 @@ public class SSLNoClientAuthDUnitTest extends DistributedTestCase {
   
   private static final String DEFAULT_STORE = "default.keystore";
   
-  private static SSLNoClientAuthDUnitTest instance = new SSLNoClientAuthDUnitTest("SSLNoClientAuthDUnitTest");
+  private static SSLNoClientAuthDUnitTest instance = new SSLNoClientAuthDUnitTest();
   
   @Override
   public final void preSetUp() throws Exception {
     disconnectAllFromDS();
   }
 
-  public SSLNoClientAuthDUnitTest(String name) {
-    super(name);
-  }  
-
   public Cache createCache(Properties props) throws Exception
   {
     props.setProperty(MCAST_PORT, "0");
@@ -228,6 +233,7 @@ public class SSLNoClientAuthDUnitTest extends DistributedTestCase {
   /**
    * Test for GEODE-396
    */
+  @Test
   public void testSSLServerWithNoAuth() throws Exception {
     final Host host = Host.getHost(0);
     VM serverVM = host.getVM(1);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsDUnitTest.java
index 68dfedc..412713f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsDUnitTest.java
@@ -16,13 +16,50 @@
  */
 package com.gemstone.gemfire.cache.management;
 
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.AttributesMutator;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.CacheLoaderException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.LoaderHelper;
+import com.gemstone.gemfire.cache.LowMemoryException;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.Pool;
 import com.gemstone.gemfire.cache.client.PoolFactory;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.ServerOperationException;
 import com.gemstone.gemfire.cache.control.ResourceManager;
-import com.gemstone.gemfire.cache.execute.*;
+import com.gemstone.gemfire.cache.execute.Execution;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.execute.FunctionException;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 import com.gemstone.gemfire.cache30.ClientServerTestCase;
@@ -37,28 +74,36 @@ import com.gemstone.gemfire.internal.cache.DistributedRegion;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.internal.cache.PartitionedRegionHelper;
-import com.gemstone.gemfire.internal.cache.control.*;
+import com.gemstone.gemfire.internal.cache.control.HeapMemoryMonitor;
+import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
 import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
+import com.gemstone.gemfire.internal.cache.control.MemoryEvent;
 import com.gemstone.gemfire.internal.cache.control.MemoryThresholds.MemoryState;
+import com.gemstone.gemfire.internal.cache.control.ResourceAdvisor;
+import com.gemstone.gemfire.internal.cache.control.ResourceListener;
+import com.gemstone.gemfire.internal.cache.control.TestMemoryThresholdListener;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+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.junit.categories.DistributedTest;
 import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import org.junit.experimental.categories.Category;
-import util.TestException;
-
-import java.io.Serializable;
-import java.util.*;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
 
 /**
  * Tests the Heap Memory thresholds of {@link ResourceManager}
  * @since GemFire 6.0
  */
+@Category(DistributedTest.class)
 public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
   
   public static class Range implements Serializable {
@@ -89,10 +134,6 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
   final String removeExpectedFunctionExString =
     "<ExpectedException action=remove>" + expectedFunctionEx + "</ExpectedException>";
   
-  public MemoryThresholdsDUnitTest(String name) {
-    super(name);
-  }
-  
   @Override
   protected final void postSetUpClientServerTestCase() throws Exception {
     Invoke.invokeInEveryVM(this.setHeapMemoryMonitorTestMode);
@@ -105,10 +146,12 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     Invoke.invokeInEveryVM(resetResourceManager);
   }
 
+  @Test
   public void testPRClientPutRejection() throws Exception {
     doClientServerTest("parRegReject", true/*createPR*/);
   }
 
+  @Test
   public void testDistributedRegionClientPutRejection() throws Exception {
     doClientServerTest("distrReject", false/*createPR*/);
   }
@@ -149,12 +192,15 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
         false/*catchLowMemoryException*/, new Range(Range.DEFAULT, Range.DEFAULT.width()+1));
   }
 
+  @Test
   public void testDistributedRegionRemotePutRejectionLocalDestroy() throws Exception {
     doDistributedRegionRemotePutRejection(true, false);
   }
+  @Test
   public void testDistributedRegionRemotePutRejectionCacheClose() throws Exception {
     doDistributedRegionRemotePutRejection(false, true);
   }
+  @Test
   public void testDistributedRegionRemotePutRejectionBelowThreshold() throws Exception {
     doDistributedRegionRemotePutRejection(false, false);
   }
@@ -242,22 +288,23 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
         false/*catchLowMemoryException*/, r2);
   }
 
+  @Test
   public void testBug45513() {
     ResourceManager rm = getCache().getResourceManager();
-    assertEquals(0.0f, rm.getCriticalHeapPercentage());
-    assertEquals(0.0f, rm.getEvictionHeapPercentage());
+    assertEquals(0.0f, rm.getCriticalHeapPercentage(),0);
+    assertEquals(0.0f, rm.getEvictionHeapPercentage(),0);
     
     rm.setEvictionHeapPercentage(50);
     rm.setCriticalHeapPercentage(90);
     
     // verify
-    assertEquals(50.0f, rm.getEvictionHeapPercentage());
-    assertEquals(90.0f, rm.getCriticalHeapPercentage());
+    assertEquals(50.0f, rm.getEvictionHeapPercentage(),0);
+    assertEquals(90.0f, rm.getCriticalHeapPercentage(),0);
     
     getCache().createRegionFactory(RegionShortcut.REPLICATE_HEAP_LRU).create(getName());
     
-    assertEquals(50.0f, rm.getEvictionHeapPercentage());
-    assertEquals(90.0f, rm.getCriticalHeapPercentage());
+    assertEquals(50.0f, rm.getEvictionHeapPercentage(),0);
+    assertEquals(90.0f, rm.getCriticalHeapPercentage(),0);
   }
 
   /**
@@ -265,6 +312,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
    * critical threshold
    * @throws Exception
    */
+  @Test
   public void testDistributedRegionRemoteClientPutRejection() throws Exception {
     final Host host = Host.getHost(0);
     final VM server1 = host.getVM(0);
@@ -306,6 +354,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
    * remote DISABLED events are delivered
    * @throws Exception
    */
+  @Test
   public void testDisabledThresholds() throws Exception {
     final Host host = Host.getHost(0);
     final VM server1 = host.getVM(0);
@@ -360,6 +409,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
    * @throws Exception
    */
   @Category(FlakyTest.class) // GEODE-427: random ports, time sensitive, waitForCriterions
+  @Test
   public void testEventDelivery() throws Exception {
     final Host host = Host.getHost(0);
     final VM server1 = host.getVM(0);
@@ -477,6 +527,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     verifyListenerValue(server1, MemoryState.NORMAL, 2, true);
   }
 
+  @Test
   public void testCleanAdvisorClose() throws Exception {
     final Host host = Host.getHost(0);
     final VM server1 = host.getVM(0);
@@ -508,27 +559,33 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     verifyProfiles(server3, 2);
   }
 
+  @Test
   public void testPR_RemotePutRejectionLocalDestroy() throws Exception {
     prRemotePutRejection(false, true, false);
   }
 
+  @Test
   public void testPR_RemotePutRejectionCacheClose() throws Exception {
     prRemotePutRejection(true, false, false);
   }
 
+  @Test
   public void testPR_RemotePutRejection() throws Exception {
     prRemotePutRejection(false, false, false);
   }
 
+  @Test
   public void testPR_RemotePutRejectionLocalDestroyWithTx() throws Exception {
     prRemotePutRejection(false, true, true);
   }
 
+  @Test
   public void testPR_RemotePutRejectionCacheCloseWithTx() throws Exception {
     prRemotePutRejection(true, false, true);
   }
 
   @Category(FlakyTest.class) // GEODE-987: random ports, failed to throw expected ResourceException, overly complex expected exception handling, memory and GC sensitive, expiration, waitForCriterion
+  @Test
   public void testPR_RemotePutRejectionWithTx() throws Exception {
     prRemotePutRejection(false, false, true);
   }
@@ -674,9 +731,9 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     doPutAlls(accessor, regionName, false, false, r1);
   }
 
-  // this test is DISABLED due to test issues.  It sometimes
-  // fails with a TransactionDataNotColocatedException.  See bug #52222
-  public void disabledtestTxCommitInCritical() throws Exception {
+  @Ignore("this test is DISABLED due to test issues.  It sometimes fails with a TransactionDataNotColocatedException.  See bug #52222")
+  @Test
+  public void testTxCommitInCritical() throws Exception {
     final Host host = Host.getHost(0);
     final VM accessor = host.getVM(0);
     final VM server1 = host.getVM(1);
@@ -781,6 +838,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     });
   }
 
+  @Test
   public void testDRFunctionExecutionRejection() throws Exception {
     IgnoredException.addIgnoredException("LowMemoryException");
     final Host host = Host.getHost(0);
@@ -894,8 +952,9 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     });
   }
 
-  // this test is DISABLED due to intermittent failures.  See bug #52222
-  public void disabledtestPRFunctionExecutionRejection() throws Exception {
+  @Ignore("this test is DISABLED due to intermittent failures.  See bug #52222")
+  @Test
+  public void testPRFunctionExecutionRejection() throws Exception {
     IgnoredException.addIgnoredException("LowMemoryException");
     final Host host = Host.getHost(0);
     final VM accessor = host.getVM(0);
@@ -1090,7 +1149,8 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
       }
     });
   }
-  
+
+  @Test
   public void testFunctionExecutionRejection() throws Exception {
     final Host host = Host.getHost(0);
     final VM server1 = host.getVM(0);
@@ -1612,6 +1672,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
   /**
    * putting this test here because junit does not have host stat sampler enabled
    */
+  @Test
   public void testLocalStatListenerRegistration() throws Exception{
     final CountDownLatch latch = new CountDownLatch(1);
     Cache cache = getCache();
@@ -1667,7 +1728,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     while (true) {
       count++;
       if (count > 75) {
-        throw new TestException("Did not receive a stat listener callback");
+        throw new AssertionError("Did not receive a stat listener callback");
       }
       byte[] value = new byte[(int)(maxTenuredMemory*0.01)];
       r.put("key-"+count, value);
@@ -1686,6 +1747,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
    * once the VM is no longer critical
    * @throws Exception
    */
+  @Test
   public void testLRLoadRejection() throws Exception {
     final Host host = Host.getHost(0);
     final VM vm = host.getVM(2);
@@ -1693,7 +1755,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     final float criticalHeapThresh = 0.90f;
     final int fakeHeapMaxSize = 1000;
 
-    vm.invoke(() -> DistributedTestCase.disconnectFromDS());
+    vm.invoke(() -> disconnectFromDS());
     
     vm.invoke(new CacheSerializableRunnable("test LocalRegion load passthrough when critical") {
       @Override
@@ -1802,6 +1864,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
    * to a safe state then test that they are allowed.
    * @throws Exception
    */
+  @Test
   public void testDRLoadRejection() throws Exception {
     final Host host = Host.getHost(0);
     final VM replicate1 = host.getVM(2);
@@ -1811,8 +1874,8 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     final int fakeHeapMaxSize = 1000;
 
     // Make sure the desired VMs will have a fresh DS.
-    AsyncInvocation d1 = replicate1.invokeAsync(() -> DistributedTestCase.disconnectFromDS());
-    AsyncInvocation d2 = replicate2.invokeAsync(() -> DistributedTestCase.disconnectFromDS());
+    AsyncInvocation d1 = replicate1.invokeAsync(() -> disconnectFromDS());
+    AsyncInvocation d2 = replicate2.invokeAsync(() -> disconnectFromDS());
     d1.join();
     assertFalse(d1.exceptionOccurred());
     d2.join();
@@ -1984,6 +2047,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
    * if the VM with the bucket is in a critical state.
    * @throws Exception
    */
+  @Test
   public void testPRLoadRejection() throws Exception {
     final Host host = Host.getHost(0);
     final VM accessor = host.getVM(1);
@@ -1993,8 +2057,8 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     final int fakeHeapMaxSize = 1000;
 
     // Make sure the desired VMs will have a fresh DS.
-    AsyncInvocation d0 = accessor.invokeAsync(() -> DistributedTestCase.disconnectFromDS());
-    AsyncInvocation d1 = ds1.invokeAsync(() -> DistributedTestCase.disconnectFromDS());
+    AsyncInvocation d0 = accessor.invokeAsync(() -> disconnectFromDS());
+    AsyncInvocation d1 = ds1.invokeAsync(() -> disconnectFromDS());
     d0.join();
     assertFalse(d0.exceptionOccurred());
     d1.join();
@@ -2215,6 +2279,7 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
     };
   };
 
+  @Test
   public void testCriticalMemoryEventTolerance() {
     final Host host = Host.getHost(0);
     final VM vm = host.getVM(0);
@@ -2245,7 +2310,8 @@ public class MemoryThresholdsDUnitTest extends ClientServerTestCase {
       }
     });
   }
-  
+
+  @Test
   public void testEvictionMemoryEventTolerance() {
     final Host host = Host.getHost(0);
     final VM vm = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java
index 3cd1d98..d89641c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/MemoryThresholdsOffHeapDUnitTest.java
@@ -16,7 +16,34 @@
  */
 package com.gemstone.gemfire.cache.management;
 
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.AttributesMutator;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.CacheLoaderException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.LoaderHelper;
+import com.gemstone.gemfire.cache.LowMemoryException;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.PoolFactory;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.ServerOperationException;
@@ -28,29 +55,46 @@ import com.gemstone.gemfire.cache30.ClientServerTestCase;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
-import com.gemstone.gemfire.internal.cache.*;
-import com.gemstone.gemfire.internal.cache.control.*;
+import com.gemstone.gemfire.internal.cache.DistributedRegion;
+import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegion;
+import com.gemstone.gemfire.internal.cache.PartitionedRegionHelper;
+import com.gemstone.gemfire.internal.cache.ProxyBucketRegion;
+import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
 import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
+import com.gemstone.gemfire.internal.cache.control.MemoryEvent;
 import com.gemstone.gemfire.internal.cache.control.MemoryThresholds.MemoryState;
+import com.gemstone.gemfire.internal.cache.control.OffHeapMemoryMonitor;
 import com.gemstone.gemfire.internal.cache.control.OffHeapMemoryMonitor.OffHeapMemoryMonitorObserver;
+import com.gemstone.gemfire.internal.cache.control.ResourceAdvisor;
+import com.gemstone.gemfire.internal.cache.control.ResourceListener;
+import com.gemstone.gemfire.internal.cache.control.TestMemoryThresholdListener;
 import com.gemstone.gemfire.internal.cache.partitioned.RegionAdvisor;
 import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+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.junit.categories.DistributedTest;
 import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import org.junit.experimental.categories.Category;
-
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
 
 /**
  * Tests the Off-Heap Memory thresholds of {@link ResourceManager}
  * 
  * @since Geode 1.0
  */
+@Category(DistributedTest.class)
 public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
-  private static final long serialVersionUID = -684231183212051910L;
 
   final String expectedEx = LocalizedStrings.MemoryMonitor_MEMBER_ABOVE_CRITICAL_THRESHOLD.getRawText().replaceAll("\\{[0-9]+\\}",
       ".*?");
@@ -61,10 +105,6 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
   final String addExpectedBelow = "<ExpectedException action=add>" + this.expectedBelow + "</ExpectedException>";
   final String removeExpectedBelow = "<ExpectedException action=remove>" + this.expectedBelow + "</ExpectedException>";
 
-  public MemoryThresholdsOffHeapDUnitTest(String name) {
-    super(name);
-  }
-  
   @Override
   public final void postSetUpClientServerTestCase() throws Exception {
     IgnoredException.addIgnoredException(expectedEx);
@@ -93,9 +133,8 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
 
   /**
    * Make sure appropriate events are delivered when moving between states.
-   * 
-   * @throws Exception
    */
+  @Test
   public void testEventDelivery() throws Exception {
     final Host host = Host.getHost(0);
     final VM server1 = host.getVM(0);
@@ -191,8 +230,8 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
   /**
    * test that disabling threshold does not cause remote event and
    * remote DISABLED events are delivered
-   * @throws Exception
    */
+  @Test
   public void testDisabledThresholds() throws Exception {
     final Host host = Host.getHost(0);
     final VM server1 = host.getVM(0);
@@ -304,8 +343,8 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
   /**
    * test that puts in a client are rejected when a remote VM crosses
    * critical threshold
-   * @throws Exception
    */
+  @Test
   public void testDistributedRegionRemoteClientPutRejection() throws Exception {
     final Host host = Host.getHost(0);
     final VM server1 = host.getVM(0);
@@ -344,35 +383,39 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
     setUsageBelowEviction(server2, regionName);
   }
 
+  @Test
   public void testDistributedRegionRemotePutRejectionLocalDestroy() throws Exception {
     doDistributedRegionRemotePutRejection(true, false);
   }
-  
+
+  @Test
   public void testDistributedRegionRemotePutRejectionCacheClose() throws Exception {
     doDistributedRegionRemotePutRejection(false, true);
   }
-  
+
+  @Test
   public void testDistributedRegionRemotePutRejectionBelowThreshold() throws Exception {
     doDistributedRegionRemotePutRejection(false, false);
   }
-  
+
+  @Test
   public void testGettersAndSetters() {
     getSystem(getOffHeapProperties());
     ResourceManager rm = getCache().getResourceManager();
-    assertEquals(0.0f, rm.getCriticalOffHeapPercentage());
-    assertEquals(0.0f, rm.getEvictionOffHeapPercentage());
+    assertEquals(0.0f, rm.getCriticalOffHeapPercentage(),0);
+    assertEquals(0.0f, rm.getEvictionOffHeapPercentage(),0);
     
     rm.setEvictionOffHeapPercentage(50);
     rm.setCriticalOffHeapPercentage(90);
     
     // verify
-    assertEquals(50.0f, rm.getEvictionOffHeapPercentage());
-    assertEquals(90.0f, rm.getCriticalOffHeapPercentage());
+    assertEquals(50.0f, rm.getEvictionOffHeapPercentage(),0);
+    assertEquals(90.0f, rm.getCriticalOffHeapPercentage(),0);
     
     getCache().createRegionFactory(RegionShortcut.REPLICATE_HEAP_LRU).create(getName());
     
-    assertEquals(50.0f, rm.getEvictionOffHeapPercentage());
-    assertEquals(90.0f, rm.getCriticalOffHeapPercentage());
+    assertEquals(50.0f, rm.getEvictionOffHeapPercentage(),0);
+    assertEquals(90.0f, rm.getCriticalOffHeapPercentage(),0);
   }
   
   /**
@@ -464,9 +507,9 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
    * Test that DistributedRegion cacheLoade and netLoad are passed through to the 
    * calling thread if the local VM is in a critical state.  Once the VM has moved
    * to a safe state then test that they are allowed.
-   * @throws Exception
    */
   @Category(FlakyTest.class) // GEODE-438: test pollution, async actions, time sensitive, waitForCriterion, TODO: consider disconnect DS in setup
+  @Test
   public void testDRLoadRejection() throws Exception {
     final Host host = Host.getHost(0);
     final VM replicate1 = host.getVM(1);
@@ -474,8 +517,8 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
     final String rName = getUniqueName();
     
     // Make sure the desired VMs will have a fresh DS.
-    AsyncInvocation d1 = replicate1.invokeAsync(() -> DistributedTestCase.disconnectFromDS());
-    AsyncInvocation d2 = replicate2.invokeAsync(() -> DistributedTestCase.disconnectFromDS());
+    AsyncInvocation d1 = replicate1.invokeAsync(() -> disconnectFromDS());
+    AsyncInvocation d2 = replicate2.invokeAsync(() -> disconnectFromDS());
     d1.join();
     assertFalse(d1.exceptionOccurred());
     d2.join();
@@ -675,28 +718,34 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
       getCache().getLoggerI18n().fine(removeExpectedBelow);
     };
   };
-  
+
+  @Test
   public void testPR_RemotePutRejectionLocalDestroy() throws Exception {
     prRemotePutRejection(false, true, false);
   }
 
+  @Test
   public void testPR_RemotePutRejectionCacheClose() throws Exception {
     prRemotePutRejection(true, false, false);
   }
 
+  @Test
   public void testPR_RemotePutRejection() throws Exception {
     prRemotePutRejection(false, false, false);
   }
 
+  @Test
   public void testPR_RemotePutRejectionLocalDestroyWithTx() throws Exception {
     prRemotePutRejection(false, true, true);
   }
 
+  @Test
   public void testPR_RemotePutRejectionCacheCloseWithTx() throws Exception {
     prRemotePutRejection(true, false, true);
   }
 
   @Category(FlakyTest.class) // GEODE-500: time sensitive, memory sensitive and GC dependent, waitForCriterions
+  @Test
   public void testPR_RemotePutRejectionWithTx() throws Exception {
     prRemotePutRejection(false, false, true);
   }
@@ -869,9 +918,9 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
   /**
    * Test that a Partitioned Region loader invocation is rejected
    * if the VM with the bucket is in a critical state.
-   * @throws Exception
    */
   @Category(FlakyTest.class) // GEODE-551: waitForCriterion, memory sensitive
+  @Test
   public void testPRLoadRejection() throws Exception {
     final Host host = Host.getHost(0);
     final VM accessor = host.getVM(1);
@@ -879,8 +928,8 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
     final String rName = getUniqueName();
 
     // Make sure the desired VMs will have a fresh DS. TODO: convert these from AsyncInvocation to invoke
-    AsyncInvocation d0 = accessor.invokeAsync(() -> DistributedTestCase.disconnectFromDS());
-    AsyncInvocation d1 = ds1.invokeAsync(() -> DistributedTestCase.disconnectFromDS());
+    AsyncInvocation d0 = accessor.invokeAsync(() -> disconnectFromDS());
+    AsyncInvocation d1 = ds1.invokeAsync(() -> disconnectFromDS());
     d0.join();
     assertFalse(d0.exceptionOccurred());
     d1.join();
@@ -1096,14 +1145,14 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
    * Test that LocalRegion cache Loads are not stored in the Region
    * if the VM is in a critical state, then test that they are allowed
    * once the VM is no longer critical
-   * @throws Exception
    */
+  @Test
   public void testLRLoadRejection() throws Exception {
     final Host host = Host.getHost(0);
     final VM vm = host.getVM(2);
     final String rName = getUniqueName();
 
-    vm.invoke(() -> DistributedTestCase.disconnectFromDS());
+    vm.invoke(() -> disconnectFromDS());
     
     vm.invoke(new CacheSerializableRunnable("test LocalRegion load passthrough when critical") {
       @Override
@@ -1214,7 +1263,8 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
     }
     return ret;
   }
-  
+
+  @Test
   public void testCleanAdvisorClose() throws Exception {
     final Host host = Host.getHost(0);
     final VM server1 = host.getVM(0);
@@ -1246,11 +1296,13 @@ public class MemoryThresholdsOffHeapDUnitTest extends ClientServerTestCase {
     verifyProfiles(server1, 2);
     verifyProfiles(server3, 2);
   }
-  
+
+  @Test
   public void testPRClientPutRejection() throws Exception {
     doClientServerTest("parRegReject", true/*createPR*/);
   }
 
+  @Test
   public void testDistributedRegionClientPutRejection() throws Exception {
     doClientServerTest("distrReject", false/*createPR*/);
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/management/ResourceManagerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/ResourceManagerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/ResourceManagerDUnitTest.java
index b8d5008..361ac2e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/management/ResourceManagerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/management/ResourceManagerDUnitTest.java
@@ -16,12 +16,15 @@
  */
 package com.gemstone.gemfire.cache.management;
 
+import static org.junit.Assert.*;
+
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Set;
 
 import org.apache.logging.log4j.Logger;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.AttributesFactory;
@@ -36,7 +39,6 @@ import com.gemstone.gemfire.cache.partition.PartitionRegionInfo;
 import com.gemstone.gemfire.cache.query.QueryException;
 import com.gemstone.gemfire.cache.query.QueryInvalidException;
 import com.gemstone.gemfire.cache.query.SelectResults;
-import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
 import com.gemstone.gemfire.internal.cache.BucketAdvisor;
@@ -47,9 +49,9 @@ import com.gemstone.gemfire.internal.cache.PartitionedRegion;
 import com.gemstone.gemfire.internal.cache.PartitionedRegionDataStore;
 import com.gemstone.gemfire.internal.cache.PartitionedRegionDataStore.CreateBucketResult;
 import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
+import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
 import com.gemstone.gemfire.internal.cache.control.ResourceEvent;
 import com.gemstone.gemfire.internal.cache.control.ResourceListener;
-import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
 import com.gemstone.gemfire.internal.cache.partitioned.BecomePrimaryBucketMessage;
 import com.gemstone.gemfire.internal.cache.partitioned.BecomePrimaryBucketMessage.BecomePrimaryBucketResponse;
 import com.gemstone.gemfire.internal.cache.partitioned.Bucket;
@@ -60,13 +62,14 @@ import com.gemstone.gemfire.internal.cache.partitioned.InternalPartitionDetails;
 import com.gemstone.gemfire.internal.cache.partitioned.PRLoad;
 import com.gemstone.gemfire.internal.cache.partitioned.RemoveBucketMessage;
 import com.gemstone.gemfire.internal.cache.partitioned.RemoveBucketMessage.RemoveBucketResponse;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.test.dunit.Assert;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.SerializableCallable;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 import com.gemstone.gemfire.test.junit.categories.FlakyTest;
 
 /**
@@ -75,19 +78,17 @@ import com.gemstone.gemfire.test.junit.categories.FlakyTest;
  * TODO: javadoc this test properly and cleanup the helper methods to be
  * more flexible and understandable
  */
-public class ResourceManagerDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class ResourceManagerDUnitTest extends JUnit4CacheTestCase {
   private static final Logger logger = LogService.getLogger();
 
-  public static final int SYSTEM_LISTENERS = 1;
-
-  public ResourceManagerDUnitTest(final String name) {
-    super(name);
-  }
+  private static final int SYSTEM_LISTENERS = 1;
 
   /**
    * Creates a cache in the controller and exercises all methods on the
    * ResourceManager without having any partitioned regions defined.
    */
+  @Test
   public void testResourceManagerBasics() {
     Cache cache = getCache();
     
@@ -131,6 +132,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
    * Creates partitioned regions in multiple vms and fully exercises the
    * getPartitionedRegionDetails API on ResourceManager.
    */
+  @Test
   public void testGetPartitionedRegionDetails() {
     // two regions
     final String[] regionPath = new String[] {
@@ -299,6 +301,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
    * Creates partitioned regions in multiple vms and fully exercises the
    * internal-only getInternalPRDetails API on ResourceManager.
    */
+  @Test
   public void testGetInternalPRDetails() {
     // two regions
     final String[] regionPath = new String[] {
@@ -459,7 +462,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
                 PRLoad load = mbrDetails.getPRLoad();
                 assertNotNull(load);
                 assertEquals((float)localMaxMemory[membersIdx], 
-                             load.getWeight());
+                             load.getWeight(),0);
                 
                 int totalBucketBytes = 0;
                 int primaryCount = 0;
@@ -469,7 +472,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
                   totalBucketBytes += bucketBytes;
                   
                   // validate against the PRLoad
-                  assertEquals((float)bucketBytes, load.getReadLoad(bid));
+                  assertEquals((float)bucketBytes, load.getReadLoad(bid),0);
                   if (load.getWriteLoad(bid) > 0) { // found a primary
                     primaryCount++;
                   }
@@ -681,6 +684,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
     });
   }
   
+  @Test
   public void testDeposePrimaryBucketMessage() {
     final String[] regionPath = new String[] {
         getUniqueName() + "-PR-0"
@@ -749,6 +753,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
     assertTrue(deposedPrimary);
   }
 
+  @Test
   public void testBecomePrimaryBucketMessage() {
     final String[] regionPath = new String[] {
         getUniqueName() + "-PR-0"
@@ -959,6 +964,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
     });
   }
 
+  @Test
   public void testRemoveDuringGetEntry() {
     doOpDuringBucketRemove(new OpDuringBucketRemove() {
         public void runit(PartitionedRegion pr, Object key, Object value) {
@@ -971,6 +977,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
   }
 
   @Category(FlakyTest.class) // GEODE-755: thread unsafe test hook (bucketReadHook), remove bucket fails, possible product bug in rebalancing
+  @Test
   public void testRemoveDuringGet() {
     doOpDuringBucketRemove(new OpDuringBucketRemove() {
         public void runit(PartitionedRegion pr, Object key, Object value) {
@@ -980,6 +987,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
   }
 
   @Category(FlakyTest.class) // GEODE-673: thread unsafe test hook (bucketReadHook), remove bucket fails, possible product bug in rebalancing
+  @Test
   public void testRemoveDuringContainsKey() {
     doOpDuringBucketRemove(new OpDuringBucketRemove() {
         public void runit(PartitionedRegion pr, Object key, Object value) {
@@ -988,6 +996,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
       });
   }
 
+  @Test
   public void testRemoveDuringContainsValueForKey() {
     doOpDuringBucketRemove(new OpDuringBucketRemove() {
         public void runit(PartitionedRegion pr, Object key, Object value) {
@@ -996,6 +1005,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
       });
   }
 
+  @Test
   public void testRemoveDuringKeySet() {
     doOpDuringBucketRemove(new OpDuringBucketRemove() {
         public void runit(PartitionedRegion pr, Object key, Object value) {
@@ -1004,6 +1014,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
       });
   }
 
+  @Test
   public void testRemoveDuringValues() {
     doOpDuringBucketRemove(new OpDuringBucketRemove() {
         public void runit(PartitionedRegion pr, Object key, Object value) {
@@ -1012,6 +1023,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
       });
   }
 
+  @Test
   public void testRemoveDuringEntrySet() {
     doOpDuringBucketRemove(new OpDuringBucketRemove() {
         public void runit(PartitionedRegion pr, Object key, Object value) {
@@ -1024,6 +1036,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
       });
   }
 
+  @Test
   public void testRemoveDuringQuery() {
     doOpDuringBucketRemove(new OpDuringBucketRemove() {
         public void runit(PartitionedRegion pr, Object key, Object value) {
@@ -1040,6 +1053,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
       });
   }
 
+  @Test
   public void testRemoveBucketMessage() {
     final String[] regionPath = new String[] {
         getUniqueName() + "-PR-0"
@@ -1139,6 +1153,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
    * to make sure that all colocated buckets are removed together.
    */
   @Category(FlakyTest.class) // GEODE-928: RemoveBucketMessage failure?
+  @Test
   public void testRemoveColocatedBuckets() {
     final String[] regionPath = new String[] {
         getUniqueName() + "-PR-0", 
@@ -1259,6 +1274,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
    * Creates a bucket on two members. Then brings up a third member and creates
    * an extra redundant copy of the bucket on it.
    */
+  @Test
   public void testCreateRedundantBucket() {
     final String[] regionPath = new String[] {
         getUniqueName() + "-PR-0"
@@ -1370,6 +1386,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
    * Creates colocated buckets on two members. Then brings up a third member
    * and creates an extra redundant copy of the buckets on it.
    */
+  @Test
   public void testCreateRedundantColocatedBuckets() {
     final String[] regionPath = new String[] {
         getUniqueName() + "-PR-0", 
@@ -1508,6 +1525,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
    * Creates a bucket on two members. Then brings up a third member and moves
    * the non-primary bucket to it.
    */
+  @Test
   public void testMoveBucket() {
     final String[] regionPath = new String[] {
         getUniqueName() + "-PR-0"
@@ -1652,6 +1670,7 @@ public class ResourceManagerDUnitTest extends CacheTestCase {
    * Creates colocated buckets on two members. Then brings up a third member 
    * and moves the non-primary colocated buckets to it.
    */
+  @Test
   public void testMoveColocatedBuckets() {
     final String[] regionPath = new String[] {
         getUniqueName() + "-PR-0", 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/mapInterface/PutAllGlobalLockJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/mapInterface/PutAllGlobalLockJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/mapInterface/PutAllGlobalLockJUnitTest.java
index 0e9256c..1e018f6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/mapInterface/PutAllGlobalLockJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/mapInterface/PutAllGlobalLockJUnitTest.java
@@ -16,34 +16,36 @@
  */
 package com.gemstone.gemfire.cache.mapInterface;
 
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.test.dunit.ThreadUtils;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
 
 import java.util.Properties;
 import java.util.TreeMap;
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
 @Category(IntegrationTest.class)
-public class PutAllGlobalLockJUnitTest {
+public class PutAllGlobalLockJUnitTest { // TODO: reformat
     
     Region testRegion = null;
     volatile boolean done = false;
     boolean testOK = false;
     Thread thread;
     
-    public PutAllGlobalLockJUnitTest() {
-    }
-    
     @Before
     public void setUp() throws Exception {
         try {
@@ -59,8 +61,7 @@ public class PutAllGlobalLockJUnitTest {
             RegionAttributes regionAttributes = factory.create();
             testRegion = cache.createRegion("TestRegion", regionAttributes);
         } catch (Exception e) {
-            e.printStackTrace();
-            fail("test failed to create a distributed system/cache");
+            throw new AssertionError("test failed to create a distributed system/cache", e);
         }
     }
     
@@ -76,7 +77,7 @@ public class PutAllGlobalLockJUnitTest {
             ThreadUtils.join(this.thread, 30 * 1000);
             assertTrue(this.testOK);
         } catch (Exception e) {
-            fail("Test has failed due to "+e);
+            throw new AssertionError("Test has failed due to ", e);
         }      
     }
        

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/partition/PartitionRegionHelperDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/partition/PartitionRegionHelperDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/partition/PartitionRegionHelperDUnitTest.java
index 6910089..b96d1e5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/partition/PartitionRegionHelperDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/partition/PartitionRegionHelperDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.partition;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import java.net.UnknownHostException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
@@ -53,12 +62,14 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.internal.cache.partitioned.fixed.QuarterPartitionResolver;
 
-public class PartitionRegionHelperDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionRegionHelperDUnitTest extends JUnit4CacheTestCase {
 
-  public PartitionRegionHelperDUnitTest(String name) {
-    super(name);
+  public PartitionRegionHelperDUnitTest() {
+    super();
   }
 
+  @Test
   public void testAssignBucketsToPartitions() throws Throwable {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -124,6 +135,7 @@ public class PartitionRegionHelperDUnitTest extends CacheTestCase {
   }
 
   
+  @Test
   public void testAssignBucketsToPartitions_FPR() throws Throwable {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -288,6 +300,7 @@ public class PartitionRegionHelperDUnitTest extends CacheTestCase {
     
   }
   
+  @Test
   public void testMembersForKey() throws Exception {
     Host host = Host.getHost(0);
     VM accessor = host.getVM(0);
@@ -520,6 +533,7 @@ public class PartitionRegionHelperDUnitTest extends CacheTestCase {
     }
   }
   
+  @Test
   public void testMoveSingleBucket() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -618,6 +632,7 @@ public class PartitionRegionHelperDUnitTest extends CacheTestCase {
     });
   }
   
+  @Test
   public void testMovePercentage() {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryJUnitTest.java
index 455cb32..d677b17 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryJUnitTest.java
@@ -26,9 +26,8 @@
  */
 package com.gemstone.gemfire.cache.query;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
-import static org.junit.runners.MethodSorters.NAME_ASCENDING;
+import static org.junit.Assert.*;
+import static org.junit.runners.MethodSorters.*;
 
 import java.util.Arrays;
 import java.util.HashSet;
@@ -44,8 +43,6 @@ import org.junit.FixMethodOrder;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import util.TestException;
-
 import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.PartitionAttributesFactory;
@@ -415,7 +412,7 @@ public class QueryJUnitTest {
       try {
         q.execute(params);
       } catch (Exception e) {
-        throw new TestException("exception occured while executing query", e);
+        throw new AssertionError("exception occured while executing query", e);
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryTestUtils.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryTestUtils.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryTestUtils.java
index 16784c4..fa8980c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryTestUtils.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/QueryTestUtils.java
@@ -16,11 +16,7 @@
  */
 package com.gemstone.gemfire.cache.query;
 
-import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-import com.gemstone.gemfire.test.dunit.VM;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
 
 import java.io.File;
 import java.io.IOException;
@@ -29,12 +25,23 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.Properties;
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.ExpirationAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
 
 /**
  * Utility class for testing supported queries
- * 
- * 
  */
 public class QueryTestUtils implements Serializable {
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CloseCacheAuthorization.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CloseCacheAuthorization.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CloseCacheAuthorization.java
index 720168f..da26f4e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CloseCacheAuthorization.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CloseCacheAuthorization.java
@@ -18,8 +18,6 @@ package com.gemstone.gemfire.cache.query.dunit;
 
 import java.security.Principal;
 
-import junit.framework.TestCase;
-
 import com.gemstone.gemfire.LogWriter;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheClosedException;
@@ -29,7 +27,11 @@ import com.gemstone.gemfire.distributed.DistributedMember;
 import com.gemstone.gemfire.security.AccessControl;
 import com.gemstone.gemfire.security.NotAuthorizedException;
 
-public class CloseCacheAuthorization extends TestCase implements AccessControl {
+/**
+ * Used by CqStateDUnitTest
+ */
+public class CloseCacheAuthorization implements AccessControl {
+
   private DistributedMember remoteDistributedMember;
   private Cache cache;
   private LogWriter logger;
@@ -43,8 +45,7 @@ public class CloseCacheAuthorization extends TestCase implements AccessControl {
   }
 
   @Override
-  public void init(Principal principal, DistributedMember remoteMember,
-      Cache cache) throws NotAuthorizedException {
+  public void init(Principal principal, DistributedMember remoteMember, Cache cache) throws NotAuthorizedException {
     this.remoteDistributedMember = remoteMember;
     this.cache = cache;
     this.logger = cache.getSecurityLogger();

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompactRangeIndexDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompactRangeIndexDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompactRangeIndexDUnitTest.java
index 611c461..eb30e65 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompactRangeIndexDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/CompactRangeIndexDUnitTest.java
@@ -16,8 +16,13 @@
  */
 package com.gemstone.gemfire.cache.query.dunit;
 
+import static org.junit.Assert.*;
+
 import java.util.Properties;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.CacheException;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.query.QueryTestUtils;
@@ -25,26 +30,23 @@ import com.gemstone.gemfire.cache.query.data.Portfolio;
 import com.gemstone.gemfire.cache.query.internal.index.IndexManager;
 import com.gemstone.gemfire.cache.query.internal.index.IndexManager.TestHook;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheSerializableRunnable.CacheSerializableRunnableException;
 import com.gemstone.gemfire.test.dunit.Assert;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.Invoke;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
 import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
-public class CompactRangeIndexDUnitTest extends DistributedTestCase{
+@Category(DistributedTest.class)
+public class CompactRangeIndexDUnitTest extends JUnit4DistributedTestCase {
 
   QueryTestUtils utils;
   VM vm0;
   
-  public CompactRangeIndexDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     getSystem();
@@ -65,6 +67,7 @@ public class CompactRangeIndexDUnitTest extends DistributedTestCase{
   /*
    * Tests that the message component of the exception is not null
    */
+  @Test
   public void testIndexInvalidDueToExpressionOnPartitionedRegion() throws Exception {
     Host host = Host.getHost(0);
     utils.createPartitionRegion("examplePartitionedRegion", Portfolio.class, vm0);
@@ -84,6 +87,7 @@ public class CompactRangeIndexDUnitTest extends DistributedTestCase{
   }
   
 
+  @Test
   public void testCompactRangeIndexForIndexElemArray() throws Exception{
     doPut(200);// around 66 entries for a key in the index (< 100 so does not create a ConcurrentHashSet)
     doQuery();
@@ -94,6 +98,7 @@ public class CompactRangeIndexDUnitTest extends DistributedTestCase{
     Thread.sleep(5000);
   }
   
+  @Test
   public void testCompactRangeIndexForConcurrentHashSet() throws Exception{
     doPut(333); //111 entries for a key in the index (> 100 so creates a ConcurrentHashSet)
     doQuery();
@@ -103,6 +108,7 @@ public class CompactRangeIndexDUnitTest extends DistributedTestCase{
     doQuery();
   }
 
+  @Test
   public void testNoSuchElemException() throws Exception{
     setHook();
     doPutSync(300);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByDUnitImpl.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByDUnitImpl.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByDUnitImpl.java
index 06636e9..c25cae5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByDUnitImpl.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByDUnitImpl.java
@@ -16,6 +16,10 @@
  */
 package com.gemstone.gemfire.cache.query.dunit;
 
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.query.Index;
 import com.gemstone.gemfire.cache.query.IndexExistsException;
@@ -29,21 +33,19 @@ import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
 
 /**
  * 
  *
  */
-public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByTestInterface{
-
+public abstract class GroupByDUnitImpl extends JUnit4CacheTestCase implements GroupByTestInterface{
 
-  public GroupByDUnitImpl(String name) {
-    super(name);
-  }
 
   protected abstract GroupByTestInterface createTestInstance();
 
   @Override
+  @Test
   public void testAggregateFuncAvg() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -57,6 +59,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
 
   @Override
+  @Test
   public void testAggregateFuncAvgDistinct() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -70,6 +73,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
 
   @Override
+  @Test
   public void testAggregateFuncCountDistinctStar_1()
       throws Exception {
     Host host = Host.getHost(0);
@@ -84,6 +88,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
 
   @Override
+  @Test
   public void testAggregateFuncCountDistinctStar_2()
       throws Exception {
     Host host = Host.getHost(0);
@@ -98,6 +103,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
 
   @Override
+  @Test
   public void testAggregateFuncCountStar()
       throws Exception {
     Host host = Host.getHost(0);
@@ -112,6 +118,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
 
   @Override
+  @Test
   public void testAggregateFuncMax()
       throws Exception {
     Host host = Host.getHost(0);
@@ -126,6 +133,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
 
   @Override
+  @Test
   public void testAggregateFuncMin() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -139,6 +147,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
 
   @Override
+  @Test
   public void testAggregateFuncNoGroupBy() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -152,6 +161,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
 
   @Override
+  @Test
   public void testAggregateFuncSum() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -165,6 +175,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
 
   @Override
+  @Test
   public void testAggregateFuncSumDistinct() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -178,6 +189,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
   
   @Override
+  @Test
   public void testConvertibleGroupByQuery_1() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -191,6 +203,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
   
   @Override
+  @Test
   public void testConvertibleGroupByQuery_refer_column() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -204,6 +217,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
   
   @Override
+  @Test
   public void testConvertibleGroupByQuery_refer_column_alias_Bug520141() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -217,6 +231,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
   
   @Override
+  @Test
   public void testSumWithMultiColumnGroupBy() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -230,6 +245,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
   
   @Override
+  @Test
   public void testComplexValueAggregateFuncAvgDistinct() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -243,6 +259,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
   
   @Override
+  @Test
   public void testAggregateFuncWithOrderBy() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -256,6 +273,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
   
   @Override
+  @Test
   public void testCompactRangeIndex() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -269,6 +287,7 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
   }
 
   @Override
+  @Test
   public void testDistinctCountWithoutGroupBy() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);
@@ -280,7 +299,8 @@ public abstract class GroupByDUnitImpl extends CacheTestCase implements GroupByT
     test.testDistinctCountWithoutGroupBy();
     this.closeCache(vm0, vm1, vm2, vm3);
   }
-  
+
+  @Test
   public void testLimitWithGroupBy() throws Exception {
     Host host = Host.getHost(0);
     final VM vm0 = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByPartitionedQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByPartitionedQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByPartitionedQueryDUnitTest.java
index b005463..cf261ac 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByPartitionedQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByPartitionedQueryDUnitTest.java
@@ -17,6 +17,15 @@
 package com.gemstone.gemfire.cache.query.dunit;
 
 import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.PartitionAttributesFactory;
@@ -41,10 +50,6 @@ import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 @Category(DistributedTest.class)
 public class GroupByPartitionedQueryDUnitTest extends GroupByDUnitImpl {
 
-  public GroupByPartitionedQueryDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   protected GroupByTestImpl createTestInstance() {
     Host host = Host.getHost(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByQueryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByQueryDUnitTest.java
index b9ff7cb..3dae466 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByQueryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/GroupByQueryDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.dunit;
 
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
 import java.util.Iterator;
 
 import org.junit.experimental.categories.Category;
@@ -47,12 +56,9 @@ import com.gemstone.gemfire.test.junit.categories.DistributedTest;
  *
  */
 @Category(DistributedTest.class)
-public class GroupByQueryDUnitTest extends CacheTestCase {
-
-  public GroupByQueryDUnitTest(String name) {
-    super(name);
-  }
+public class GroupByQueryDUnitTest extends JUnit4CacheTestCase {
 
+  @Test
   public void testConvertibleGroupByNoIndex() throws Exception {
 
     Host host = Host.getHost(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HashIndexDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HashIndexDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HashIndexDUnitTest.java
index 95a2580..072bef0 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HashIndexDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/query/dunit/HashIndexDUnitTest.java
@@ -18,27 +18,28 @@ package com.gemstone.gemfire.cache.query.dunit;
 
 import java.util.Properties;
 
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.CacheException;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.query.QueryTestUtils;
 import com.gemstone.gemfire.cache.query.data.Portfolio;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.Invoke;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
-public class HashIndexDUnitTest extends DistributedTestCase{
+@Category(DistributedTest.class)
+public class HashIndexDUnitTest extends JUnit4DistributedTestCase {
 
   QueryTestUtils utils;
   VM vm0;
   
-  public HashIndexDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     getSystem();
@@ -57,6 +58,7 @@ public class HashIndexDUnitTest extends DistributedTestCase{
   }
   
 
+  @Test
   public void testHashIndexForIndexElemArray() throws Exception{
     doPut(200);// around 66 entries for a key in the index (< 100 so does not create a ConcurrentHashSet)
     doQuery();
@@ -67,6 +69,7 @@ public class HashIndexDUnitTest extends DistributedTestCase{
     Thread.sleep(5000);
   }
   
+  @Test
   public void testHashIndexForConcurrentHashSet() throws Exception{
     doPut(333); //111 entries for a key in the index (> 100 so creates a ConcurrentHashSet)
     doQuery();