geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sai_boorlaga...@apache.org
Subject [04/90] [abbrv] [partial] incubator-geode git commit: GEODE-837: update tests from JUnit3 to JUnit4
Date Tue, 14 Jun 2016 19:10:14 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PartitionedRegionCqQueryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PartitionedRegionCqQueryDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PartitionedRegionCqQueryDUnitTest.java
index f306cb9..2b34dbd 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PartitionedRegionCqQueryDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PartitionedRegionCqQueryDUnitTest.java
@@ -17,10 +17,14 @@
 package com.gemstone.gemfire.cache.query.cq.dunit;
 
 import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
 
 import java.io.IOException;
 import java.util.HashSet;
 
+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.CacheException;
@@ -43,7 +47,6 @@ import com.gemstone.gemfire.cache.query.Struct;
 import com.gemstone.gemfire.cache.query.data.Portfolio;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.cache30.ClientServerTestCase;
 import com.gemstone.gemfire.internal.cache.LocalRegion;
 import com.gemstone.gemfire.test.dunit.Assert;
@@ -53,26 +56,25 @@ import com.gemstone.gemfire.test.dunit.NetworkUtils;
 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.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * Test class for Partitioned Region and CQs
  * 
  * @since GemFire 5.5
  */
-public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionedRegionCqQueryDUnitTest extends JUnit4CacheTestCase {
 
-  public PartitionedRegionCqQueryDUnitTest(String name) {
-    super(name);
-  }
-  
-  static public final String[] regions = new String[] {
+  public static final String[] regions = new String[] {
       "regionA",
       "regionB"
   };
+
+  public static final String KEY = "key-";
   
-  static public final String KEY = "key-";
-  
-  protected final CqQueryDUnitTest cqHelper = new CqQueryDUnitTest("HelperPartitonedRegionCqTest");
+  protected final CqQueryDUnitTest cqHelper = new CqQueryDUnitTest();
   
   public final String[] cqs = new String [] {
       //0 - Test for ">" 
@@ -109,11 +111,11 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
   public final String[] cqsWithoutRoot = new String [] {
       //0 - Test for ">" 
       "SELECT ALL * FROM /" + regions[0] + " p where p.ID > 0"
-      
   };
   
   private static int bridgeServerPort;
   
+  @Test
   public void testCQLeakWithPartitionedRegion() throws Exception {
     // creating servers.
     final Host host = Host.getHost(0);
@@ -124,8 +126,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
     createServer(server1);       
     createServer(server2);    
        
-    
-    // create client 
+    // create client
     
     final int port = server1.invoke(() -> PartitionedRegionCqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server1.getHost());
@@ -155,8 +156,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryUpdates: */ 0,
         /* queryDeletes: */ 0,
         /* totalEvents: */ size);
-    
-    
+
     int cc1 = server1.invoke(() -> PartitionedRegionCqQueryDUnitTest.getCqCountFromRegionProfile());
     int cc2 = server2.invoke(() -> PartitionedRegionCqQueryDUnitTest.getCqCountFromRegionProfile());
     assertEquals("Should have one", 1, cc1);
@@ -166,7 +166,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
     
     cqHelper.closeClient(client);
     Wait.pause(10 * 1000);
-    //cc1 = server1.invoke(() -> PartitionedRegionCqQueryDUnitTest.getCqCountFromRegionProfile());
     cc2 = server2.invoke(() -> PartitionedRegionCqQueryDUnitTest.getCqCountFromRegionProfile());
     
     //assertIndexDetailsEquals("Should have one", 0, cc1);
@@ -176,6 +175,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
     //cqHelper.closeServer(server1);
   }
   
+  @Test
   public void testCQAndPartitionedRegion() throws Exception {
     // creating servers.
     final Host host = Host.getHost(0);
@@ -218,8 +218,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ size);
     
-    //size = 2;
-    
     // do updates
     createValues(server1, regions[0], size);
     
@@ -236,16 +234,14 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ (size+size));
     
-    
     // destroy all the values.
     int numDestroys = size;
     cqHelper.deleteValues(server2,regions[0], numDestroys);
     
     cqHelper.waitForDestroyed(client, "testCQEvents_0", KEY+numDestroys);
     
-    // validate cqs after destroyes on server2.
+    // validate cqs after destroys on server2.
  
-        
     cqHelper.validateCQ(client, "testCQEvents_0",
         /* resultSize: */ CqQueryDUnitTest.noTest,
         /* creates: */ size,
@@ -256,30 +252,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ numDestroys,
         /* totalEvents: */ (size+size+numDestroys));
     
-    // invalidate some entries.
-    /*final int numInvalidates = 5;
-    
-    server2.invoke(new CacheSerializableRunnable("Invalidate values") {
-      public void run2() throws CacheException {
-        Region region1 = getRootRegion().getSubregion(regions[0]);
-        for (int i = numInvalidates; i <= (numInvalidates+4); i++) {
-          region1.invalidate(KEY+i);
-        }
-      }
-    });
-     
-    cqHelper.waitForInvalidated(client, "testCQEvents_0", KEY+(numInvalidates+4));
-    */
-   // cqHelper.validateCQ(client, "testCQEvents_0",
-    //    /* resultSize: */ cqHelper.noTest,
-    //    /* creates: */ size,
-    //    /* updates: */ size,
-    //    /* deletes; */ (numDestroys+numInvalidates),
-    //    /* queryInserts: */ size,
-     //   /* queryUpdates: */ size,
-     //   /* queryDeletes: */ (numDestroys+numInvalidates),
-    //    /* totalEvents: */ (size+size+numDestroys + numInvalidates));
-    
     cqHelper.closeClient(client);
     cqHelper.closeServer(server2);
     cqHelper.closeServer(server1);
@@ -288,8 +260,9 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
   /**
    * test for registering cqs on a bridge server with local max memory zero.
    */
+  @Test
   public void testPartitionedCqOnAccessorBridgeServer() throws Exception {
- // creating servers.
+    // creating servers.
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
     VM server2 = host.getVM(1);
@@ -333,8 +306,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ size);
     
-    //size = 2;
-    
     // do updates
     createValues(server1, regions[0], size);
     
@@ -362,9 +333,8 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
       cqHelper.waitForDestroyed(client, "testCQEvents_0", KEY+i);
     }
     
-    // validate cqs after destroyes on server2.
+    // validate cqs after destroys on server2.
  
-        
     cqHelper.validateCQ(client, "testCQEvents_0",
         /* resultSize: */ CqQueryDUnitTest.noTest,
         /* creates: */ size,
@@ -385,10 +355,10 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
    * will generate all the events locally and should always have the old value 
    * and should not sent the profile update on wire.
    */
+  @Test
   public void testPartitionedCqOnSingleBridgeServer() throws Exception { 
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
-//    VM server2 = host.getVM(1);
     VM client = host.getVM(2);
     
     // creating an accessor vm with Bridge Server installed.
@@ -424,8 +394,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ size);
     
-    //size = 2;
-    
     // do updates
     createValues(server1, regions[0], size);
     
@@ -444,7 +412,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ (size+size));
     
-    
     // destroy all the values.
     int numDestroys = size;
     cqHelper.deleteValues(server1,regions[0], numDestroys);
@@ -453,9 +420,8 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
       cqHelper.waitForDestroyed(client, "testCQEvents_0", KEY+i);
     }
     
-    // validate cqs after destroyes on server2.
- 
-        
+    // validate cqs after destroys on server2.
+
     cqHelper.validateCQ(client, "testCQEvents_0",
         /* resultSize: */ CqQueryDUnitTest.noTest,
         /* creates: */ size,
@@ -468,7 +434,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
     
     cqHelper.closeClient(client);
     cqHelper.closeServer(server1);
-    
   }
   
   /**
@@ -476,6 +441,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
    * will generate all the events locally but the puts, updates and destroys originate
    * at an accessor vm.
    */
+  @Test
   public void testPRCqOnSingleBridgeServerUpdatesOriginatingAtAccessor() throws Exception { 
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
@@ -522,8 +488,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ size);
     
-    //size = 2;
-    
     // do updates
     createValues(server1, regions[0], size);
     
@@ -541,8 +505,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryUpdates: */ size,
         /* queryDeletes: */ 0,
         /* totalEvents: */ (size+size));
-    
-    
+
     // destroy all the values.
     int numDestroys = size;
     cqHelper.deleteValues(server1,regions[0], numDestroys);
@@ -551,9 +514,8 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
       cqHelper.waitForDestroyed(client, "testCQEvents_0", KEY+i);
     }
     
-    // validate cqs after destroyes on server2.
- 
-        
+    // validate cqs after destroys on server2.
+
     cqHelper.validateCQ(client, "testCQEvents_0",
         /* resultSize: */ CqQueryDUnitTest.noTest,
         /* creates: */ size,
@@ -572,6 +534,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
   /**
    * test to check invalidates on bridge server hosting datastores as well.
    */
+  @Test
   public void testPRCqWithInvalidatesOnBridgeServer()  {
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
@@ -585,7 +548,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
     // create another server with data store.
     createServer(server2);
     
-    
     final int port = server1.invoke(() -> PartitionedRegionCqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server1.getHost());
     
@@ -617,8 +579,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ size);
     
-    //size = 2;
-    
     // do updates
     createValues(server1, regions[0], size);
     
@@ -637,7 +597,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ (size+size));
     
-    
     // invalidate all the values.
     int numInvalidates = size;
     cqHelper.invalidateValues(server2,regions[0], numInvalidates);
@@ -665,10 +624,9 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
   
   /**
    * test cqs with invalidates on bridge server not hosting datastores.
-   * 
    */
+  @Test
   public void testPRCqWithInvalidatesOnAccessorBridgeServer() throws Exception {
-    
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
     VM server2 = host.getVM(1);
@@ -680,8 +638,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
      
     // create another server with data store.
     createServer(server2);
-    
-    
+
     final int port = server1.invoke(() -> PartitionedRegionCqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server1.getHost());
     
@@ -713,8 +670,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ size);
     
-    //size = 2;
-    
     // do updates
     createValues(server1, regions[0], size);
     
@@ -732,8 +687,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryUpdates: */ size,
         /* queryDeletes: */ 0,
         /* totalEvents: */ (size+size));
-    
-    
+
     // invalidate all the values.
     int numInvalidates = size;
     cqHelper.invalidateValues(server1,regions[0], numInvalidates);
@@ -762,8 +716,8 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
    * test cqs with create updates and destroys from client on bridge server
    * hosting datastores.
    */
+  @Test
   public void testPRCqWithUpdatesFromClients() throws Exception {
-    
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
     VM server2 = host.getVM(1);
@@ -777,7 +731,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
     // create another server with data store.
     createServer(server2, false , 1);
     
-    
     final int port = server1.invoke(() -> PartitionedRegionCqQueryDUnitTest.getCacheServerPort());
     final String host0 = NetworkUtils.getServerHostName(server1.getHost());
     
@@ -810,8 +763,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ size);
     
-    //size = 2;
-    
     // do updates
     createValues(client2, regions[0], size);
     
@@ -830,7 +781,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ (size+size));
     
-    
     // invalidate all the values.
     int numDelets = size;
     
@@ -860,10 +810,9 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
   
   /**
    * test cqs on multiple partitioned region hosted by bridge servers.
-   * 
    */
+  @Test
   public void testPRCqWithMultipleRegionsOnServer() throws Exception {
-    
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
     VM server2 = host.getVM(1);
@@ -924,14 +873,10 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ size);
     
-    
-    //size = 2;
-    
     // do updates
     createValues(client2, regions[0], size);
     createValues(client2, regions[1], size);
-    
- 
+
     for (int i=1; i <= size; i++){
       cqHelper.waitForUpdated(client, "testCQEvents_0", KEY+i);
       cqHelper.waitForUpdated(client, "testCQEvents_1", KEY+i);
@@ -964,13 +909,11 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
     cqHelper.deleteValues(client2,regions[0], numInvalidates);
     cqHelper.deleteValues(client2,regions[1], numInvalidates);
     
-
     for (int i=1; i <= numInvalidates; i++){
       cqHelper.waitForDestroyed(client, "testCQEvents_0", KEY+i);
       cqHelper.waitForDestroyed(client, "testCQEvents_1", KEY+i);
     }
-    
-    
+
     // validate cqs after invalidates on server2.
          
     cqHelper.validateCQ(client, "testCQEvents_0",
@@ -982,8 +925,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryUpdates: */ size,
         /* queryDeletes: */ numInvalidates,
         /* totalEvents: */ (size+size+numInvalidates));
-    
-    
+
     cqHelper.validateCQ(client, "testCQEvents_1",
         /* resultSize: */ CqQueryDUnitTest.noTest,
         /* creates: */ size,
@@ -1003,10 +945,9 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
   /**
    * tests multiple cqs on partitioned region on bridge servers with profile update 
    * for not requiring old values.
-   * 
    */
+  @Test
   public void testPRWithCQsAndProfileUpdates() throws Exception {
-    
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
     VM server2 = host.getVM(1);
@@ -1065,9 +1006,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ 0,
         /* totalEvents: */ size);
     
-    
-    //size = 2;
-    
     // do updates
     createValues(client2, regions[0], size);
     createValues(client2, regions[1], size);
@@ -1108,8 +1046,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
       cqHelper.waitForDestroyed(client,"testPRWithCQsAndProfileUpdates_0",KEY+i);
       cqHelper.waitForDestroyed(client,"testPRWithCQsAndProfileUpdates_1",KEY+i);
     }
-    
-    
+
     // validate cqs after invalidates on server2.
          
     cqHelper.validateCQ(client, "testPRWithCQsAndProfileUpdates_0",
@@ -1121,8 +1058,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryUpdates: */ size,
         /* queryDeletes: */ numInvalidates,
         /* totalEvents: */ (size+size+numInvalidates));
-    
-    
+
     cqHelper.validateCQ(client, "testPRWithCQsAndProfileUpdates_1",
         /* resultSize: */ CqQueryDUnitTest.noTest,
         /* creates: */ size,
@@ -1133,86 +1069,9 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         /* queryDeletes: */ numInvalidates,
         /* totalEvents: */ (size+size+numInvalidates));
     
-    // check for requries old value set.
-    /*
-    server1.invoke(new CacheSerializableRunnable("Check requires old value") {
-      public void run2()
-      {
-        Cache cc = getCache();
-        PartitionedRegion region1 = (PartitionedRegion)cc
-            .getRegion("/root/regionA");
-        Set requiresOldValue = region1.getRegionAdvisor()
-            .adviseRequiresOldValue();
-        getLogWriter().info(
-            "ize of requires old value at server1 before closing cqs : "
-                + requiresOldValue.size());
-        assertTrue("The size of requiresOldValue shoule be zero on server1",
-            (0 == requiresOldValue.size()));
-      }
-    });
-
-    server2.invoke(new CacheSerializableRunnable("Check requires old value") {
-      public void run2()
-      {
-        Cache cc = getCache();
-        PartitionedRegion region1 = (PartitionedRegion)cc
-            .getRegion("/root/regionA");
-        Set requiresOldValue = region1.getRegionAdvisor()
-            .adviseRequiresOldValue();
-        getLogWriter().info(
-            "size of requires old value at server2 before closing cqs :"
-                + requiresOldValue.size());
-        assertTrue("The size of requiresOldValue should be one on server2 ",
-            (1 == requiresOldValue.size()));
-      }
-    });
-    */
-    
     cqHelper.closeCQ(client, "testPRWithCQsAndProfileUpdates_0");
     cqHelper.closeCQ(client, "testPRWithCQsAndProfileUpdates_1");
     
-    
-    // check for requires old value set after closing all the cqs.
-    /*
-    REQUIRES OLD VALUES requirement is removed in the eventFilterOpt_dev_Jun09 
-    branch. The old values are no more sent to the peer, instead CQs are processed
-    at the source (where change happens). Replace requiresOldValue test with 
-    appropriate test.
-    
-    server1.invoke(new CacheSerializableRunnable("Check requires old value") {
-      public void run2()
-      {
-        Cache cc = getCache();
-        PartitionedRegion region1 = (PartitionedRegion)cc
-            .getRegion("/root/regionA");
-        Set requiresOldValue = region1.getRegionAdvisor()
-            .adviseRequiresOldValue();
-        getLogWriter().info(
-            "size of requires old value set at the end server1 : "
-                + requiresOldValue.size());
-        assertTrue("The size of requiresOldValue shoule be zero on server1",
-            (0 == requiresOldValue.size()));
-      }
-    });
-    
-    
-    server2.invoke(new CacheSerializableRunnable("Check requires old value") {
-      public void run2()
-      {
-        Cache cc = getCache();
-        PartitionedRegion region1 = (PartitionedRegion)cc
-            .getRegion("/root/regionA");
-        Set requiresOldValue = region1.getRegionAdvisor()
-            .adviseRequiresOldValue();
-        getLogWriter().info(
-            " size of requires old value set at the end server2 : "
-                + requiresOldValue.size());
-        assertTrue(
-            "The size of requiresOldValue shoule be zero on server2 as well after closing all the cqs",
-            (0 == requiresOldValue.size()));
-      }
-    });
-    */
     cqHelper.closeClient(client);
     cqHelper.closeClient(client2);
     cqHelper.closeServer(server2);
@@ -1225,8 +1084,8 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
    * there may be possibility that the region changes during
    * that time may not be reflected in the query result set
    * thus making the query data and region data inconsistent.
-   * @throws Exception
    */
+  @Test
   public void testEventsDuringQueryExecution() throws Exception {
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
@@ -1289,14 +1148,9 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         try {
           cqResults = cq1.executeWithInitialResults();
         } catch (Exception ex){
-          AssertionError err = new AssertionError("Failed to execute  CQ " + cqName);
-          err.initCause(ex);
-          throw err;
+          fail("Failed to execute  CQ " + cqName, ex);
         }
         
-        //getLogWriter().info("initial result size = " + cqResults.size());
-        
-        
         CqQueryTestListener cqListener = (CqQueryTestListener)cq1.getCqAttributes().getCqListener();
         // Wait for the last key to arrive.
         for (int i=0; i < 4; i++) {
@@ -1330,13 +1184,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
           ids.add(s.get("key"));
         }
 
-        //Iterator iter = cqResults.asSet().iterator();
-        //while (iter.hasNext()) {
-        //  Portfolio p = (Portfolio)iter.next();
-        //  ids.add(p.getPk());
-        //  //getLogWriter().info("Result set value : " + p.getPk());
-        //}
-        
         HashSet missingIds = new HashSet();
         String key = "";
         for (int i = 1; i <= totalObjects; i++) {
@@ -1351,8 +1198,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
               " Missing keys : [size : " + missingIds.size() + "]" + missingIds +
               " Ids in ResultSet and CQ Events :" + ids);
         }
-        
-      } 
+      }
     });
     
     cqHelper.closeClient(client);
@@ -1360,8 +1206,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
     cqHelper.closeServer(server1);    
   }
 
-  
-  
+  @Test
   public void testDestroyRegionEventOnClientsWithCQRegistered() throws Exception{
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -1394,7 +1239,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
           region.put("KEY-"+i, p);
         }
       }
-      
     });
     
     client1.invokeAsync(new CacheSerializableRunnable("Wait for CqEvent") {
@@ -1409,7 +1253,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         assertNotNull(cqListener);
         
         cqListener.waitForTotalEvents(numObjects + 1 /*Destroy region event*/);
-                
       }
     });
     
@@ -1447,7 +1290,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
               "Region is still available on client1 even after performing destroyRegion from client2 on server."
                   + "Client1 must have received destroyRegion message from server with CQ parts in it.",
               getCache().getRegion("/" + regions[0]));
-
         }
       }
     });
@@ -1455,8 +1297,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
     cqHelper.closeServer(server);
   }
   
-  // helper methods.
-  
   /**
    * create bridge server with default attributes for partitioned region.
    */
@@ -1496,36 +1336,27 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         "Create Cache Server") {
       public void run2() throws CacheException
       {
-          LogWriterUtils.getLogWriter().info("### Create Cache Server. ###");
-          //AttributesFactory factory = new AttributesFactory();
-          //factory.setScope(Scope.DISTRIBUTED_ACK);
-          //factory.setMirrorType(MirrorType.KEYS_VALUES);
-          
-          //int maxMem = 0;
-          AttributesFactory attr = new AttributesFactory();
-          //attr.setValueConstraint(valueConstraint);
-          PartitionAttributesFactory paf = new PartitionAttributesFactory();
-          if (isAccessor){
-            paf.setLocalMaxMemory(0);
-          }
-          PartitionAttributes prAttr = paf.setTotalNumBuckets(197).setRedundantCopies(redundantCopies).create();
-          attr.setPartitionAttributes(prAttr);
-          
-          assertFalse(getSystem().isLoner());
-          //assertTrue(getSystem().getDistributionManager().getOtherDistributionManagerIds().size() > 0);
-          for (int i = 0; i < regions.length; i++) {
-            Region r = createRegion(regions[i], attr.create());
-            LogWriterUtils.getLogWriter().info("Server created the region: "+r);
-          }
-//          pause(2000);
-          try {
-            startBridgeServer(port, true);
-          }
-          catch (Exception ex) {
-            Assert.fail("While starting CacheServer", ex);
-          }
-//          pause(2000);
-       
+        LogWriterUtils.getLogWriter().info("### Create Cache Server. ###");
+        AttributesFactory attr = new AttributesFactory();
+        PartitionAttributesFactory paf = new PartitionAttributesFactory();
+        if (isAccessor){
+          paf.setLocalMaxMemory(0);
+        }
+        PartitionAttributes prAttr = paf.setTotalNumBuckets(197).setRedundantCopies(redundantCopies).create();
+        attr.setPartitionAttributes(prAttr);
+
+        assertFalse(getSystem().isLoner());
+        //assertTrue(getSystem().getDistributionManager().getOtherDistributionManagerIds().size() > 0);
+        for (int i = 0; i < regions.length; i++) {
+          Region r = createRegion(regions[i], attr.create());
+          LogWriterUtils.getLogWriter().info("Server created the region: "+r);
+        }
+        try {
+          startBridgeServer(port, true);
+        }
+        catch (Exception ex) {
+          Assert.fail("While starting CacheServer", ex);
+        }
       }
     };
 
@@ -1545,35 +1376,27 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         "Create Cache Server") {
       public void run2() throws CacheException
       {
-          LogWriterUtils.getLogWriter().info("### Create Cache Server. ###");
-          //AttributesFactory factory = new AttributesFactory();
-          //factory.setScope(Scope.DISTRIBUTED_ACK);
-          //factory.setMirrorType(MirrorType.KEYS_VALUES);
-          
-          //int maxMem = 0;
-          AttributesFactory attr = new AttributesFactory();
-          //attr.setValueConstraint(valueConstraint);
-          PartitionAttributesFactory paf = new PartitionAttributesFactory();
-          if (isAccessor){
-            paf.setLocalMaxMemory(0);
-          }
-          PartitionAttributes prAttr = paf.setTotalNumBuckets(1).setRedundantCopies(redundantCopies).create();
-          attr.setPartitionAttributes(prAttr);
-          
-          assertFalse(getSystem().isLoner());
-          //assertTrue(getSystem().getDistributionManager().getOtherDistributionManagerIds().size() > 0);
-          for (int i = 0; i < regions.length; i++) {
-            Region r = createRegionWithoutRoot(regions[i], attr.create());
-            LogWriterUtils.getLogWriter().info("Server created the region: "+r);
-          }
-//          pause(2000);
-          try {
-            startBridgeServer(port, true);
-          }
-          catch (Exception ex) {
-            Assert.fail("While starting CacheServer", ex);
-          }
-//          pause(2000);
+        LogWriterUtils.getLogWriter().info("### Create Cache Server. ###");
+        AttributesFactory attr = new AttributesFactory();
+        PartitionAttributesFactory paf = new PartitionAttributesFactory();
+        if (isAccessor){
+          paf.setLocalMaxMemory(0);
+        }
+        PartitionAttributes prAttr = paf.setTotalNumBuckets(1).setRedundantCopies(redundantCopies).create();
+        attr.setPartitionAttributes(prAttr);
+
+        assertFalse(getSystem().isLoner());
+        //assertTrue(getSystem().getDistributionManager().getOtherDistributionManagerIds().size() > 0);
+        for (int i = 0; i < regions.length; i++) {
+          Region r = createRegionWithoutRoot(regions[i], attr.create());
+          LogWriterUtils.getLogWriter().info("Server created the region: "+r);
+        }
+        try {
+          startBridgeServer(port, true);
+        }
+        catch (Exception ex) {
+          Assert.fail("While starting CacheServer", ex);
+        }
       }
 
       private Region createRegionWithoutRoot(String regionName,
@@ -1585,6 +1408,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
 
     server.invoke(createServer);
   }
+
   /**
    * Starts a bridge server on the given port, using the given
    * deserializeValues and notifyBySubscription to serve up the
@@ -1594,7 +1418,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
    */
   protected void startBridgeServer(int port, boolean notifyBySubscription)
   throws IOException {
-    
     Cache cache = getCache();
     CacheServer bridge = cache.addCacheServer();
     bridge.setPort(port);
@@ -1608,8 +1431,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
     int[] serverPorts = new int[] {serverPort};
     createClient(client, serverPorts, serverHost, null); 
   }
-  
-  
+
   /* Create Client */
   public void createClient(VM client, final int[] serverPorts, final String serverHost, final String redundancyLevel) {
     SerializableRunnable createQService =
@@ -1624,8 +1446,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         try {
           getCache().getQueryService();
         } catch (Exception cqe) {
-          cqe.printStackTrace();
-          fail("Failed to getCQService.");
+          fail("Failed to getCQService.", cqe);
         }
         
         AttributesFactory regionFactory = new AttributesFactory();
@@ -1640,7 +1461,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         for (int i=0; i < regions.length; i++) {        
           Region clientRegion = createRegion(regions[i], regionFactory.createRegionAttributes());
           LogWriterUtils.getLogWriter().info("### Successfully Created Region on Client :" + clientRegion);
-          //region1.getAttributesMutator().setCacheListener(new CqListener());
         }
       }
     };
@@ -1651,18 +1471,14 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
   public void createCQ(VM vm, final String cqName, final String queryStr) {
     vm.invoke(new CacheSerializableRunnable("Create CQ :" + cqName) {
       public void run2() throws CacheException {
-        //pause(60 * 1000);
-        //getLogWriter().info("### DEBUG CREATE CQ START ####");
-        //pause(20 * 1000);
-        
+
         LogWriterUtils.getLogWriter().info("### Create CQ. ###" + cqName);
         // Get CQ Service.
         QueryService cqService = null;
         try {
           cqService = getCache().getQueryService();
         } catch (Exception cqe) {
-          cqe.printStackTrace();
-          fail("Failed to getCQService.");
+          fail("Failed to getCQService.", cqe);
         }
         // Create CQ Attributes.
         CqAttributesFactory cqf = new CqAttributesFactory();
@@ -1678,16 +1494,13 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
           assertTrue("newCq() state mismatch", cq1.getState().isStopped());
           LogWriterUtils.getLogWriter().info("Created a new CqQuery : "+cq1);
         } catch (Exception ex){
-          AssertionError err = new AssertionError("Failed to create CQ " + cqName + " . ");
-          err.initCause(ex);
-          LogWriterUtils.getLogWriter().info("CqService is :" + cqService, err);
-          throw err;
+          fail("Failed to create CQ " + cqName, ex);
         }
       }
     });   
   } 
   
-  /* Returs Cache Server Port */
+  /** Return Cache Server Port */
   protected static int getCacheServerPort() {
     return bridgeServerPort;
   }
@@ -1705,9 +1518,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
   }
   
   private static int getCqCountFromRegionProfile() {
-    
     LocalRegion region1 = (LocalRegion)CacheFactory.getAnyInstance().getRegion("/root/regionA");
-    
     return region1.getFilterProfile().getCqCount();
   }
   
@@ -1737,8 +1548,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
       }
     });
   }
-  
-  
+
   public void createCacheClient(VM client, final int serverPort, final String serverHost){
     createCacheClient(client, new String[]{serverHost}, new int[]{serverPort}, null);
   }
@@ -1762,8 +1572,7 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
         try {
           getCache().getQueryService();
         } catch (Exception cqe) {
-          cqe.printStackTrace();
-          fail("Failed to getCQService.");
+          fail("Failed to getCQService.", cqe);
         }
         
         AttributesFactory regionFactory = new AttributesFactory();
@@ -1779,7 +1588,6 @@ public class PartitionedRegionCqQueryDUnitTest extends CacheTestCase {
           Region clientRegion = ((ClientCache)getCache()).createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY)
           .create(regions[i]);
           LogWriterUtils.getLogWriter().info("### Successfully Created Region on Client :" + clientRegion);
-          //region1.getAttributesMutator().setCacheListener(new CqListener());
         }
       }
     });   

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PartitionedRegionCqQueryOptimizedExecuteDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PartitionedRegionCqQueryOptimizedExecuteDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PartitionedRegionCqQueryOptimizedExecuteDUnitTest.java
index 7b25430..730aec9 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PartitionedRegionCqQueryOptimizedExecuteDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PartitionedRegionCqQueryOptimizedExecuteDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.cq.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 com.gemstone.gemfire.cache.CacheException;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.query.data.Portfolio;
@@ -26,10 +35,11 @@ import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.test.dunit.*;
 
+@Category(DistributedTest.class)
 public class PartitionedRegionCqQueryOptimizedExecuteDUnitTest extends PartitionedRegionCqQueryDUnitTest{
 
-  public PartitionedRegionCqQueryOptimizedExecuteDUnitTest(String name) {
-    super(name);
+  public PartitionedRegionCqQueryOptimizedExecuteDUnitTest() {
+    super();
   }
 
   @Override
@@ -51,6 +61,7 @@ public class PartitionedRegionCqQueryOptimizedExecuteDUnitTest extends Partition
     });
   }
   
+  @Test
   public void testCqExecuteWithoutQueryExecution() throws Exception {
     final Host host = Host.getHost(0);
     final VM server = host.getVM(0);
@@ -142,6 +153,7 @@ public class PartitionedRegionCqQueryOptimizedExecuteDUnitTest extends Partition
     cqHelper.closeServer(server);    
   }
   
+  @Test
   public void testCqExecuteWithoutQueryExecutionAndNoRSCaching() throws Exception {
     final Host host = Host.getHost(0);
     final VM server = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PrCqUsingPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PrCqUsingPoolDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PrCqUsingPoolDUnitTest.java
index 0af556f..8ab74da 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PrCqUsingPoolDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PrCqUsingPoolDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.cq.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.io.IOException;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -58,10 +67,11 @@ import com.gemstone.gemfire.test.junit.categories.FlakyTest;
  * 
  * @since GemFire 5.5
  */
-public class PrCqUsingPoolDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PrCqUsingPoolDUnitTest extends JUnit4CacheTestCase {
 
-  public PrCqUsingPoolDUnitTest(String name) {
-    super(name);
+  public PrCqUsingPoolDUnitTest() {
+    super();
   }
   
   static public final String[] regions = new String[] {
@@ -71,9 +81,9 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
   
   static public final String KEY = "key-";
   
-  private final CqQueryUsingPoolDUnitTest cqHelper = new CqQueryUsingPoolDUnitTest("HelperPartitonedRegionCqTest");
+  private final CqQueryUsingPoolDUnitTest cqHelper = new CqQueryUsingPoolDUnitTest();
   
-  private final CqStatsDUnitTest cqStatsHelper = new CqStatsDUnitTest("HelperPrCqUsingPool");
+  private final CqStatsDUnitTest cqStatsHelper = new CqStatsDUnitTest();
 
   public final String[] cqs = new String [] {
       //0 - Test for ">" 
@@ -109,6 +119,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
   
   private static int bridgeServerPort;
   
+  @Test
   public void testCQAndPartitionedRegion() throws Exception {
     // creating servers.
     final Host host = Host.getHost(0);
@@ -223,6 +234,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
   /**
    * test for registering cqs on a bridge server with local max memory zero.
    */
+  @Test
   public void testPartitionedCqOnAccessorBridgeServer() throws Exception {
  // creating servers.
     final Host host = Host.getHost(0);
@@ -386,6 +398,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
    * will generate all the events locally and should always have the old value 
    * and should not sent the profile update on wire.
    */
+  @Test
   public void testPartitionedCqOnSingleBridgeServer() throws Exception { 
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
@@ -479,6 +492,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
    * will generate all the events locally but the puts, updates and destroys originate
    * at an accessor vm.
    */
+  @Test
   public void testPRCqOnSingleBridgeServerUpdatesOriginatingAtAccessor() throws Exception { 
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
@@ -578,6 +592,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
   /**
    * test to check invalidates on bridge server hosting datastores as well.
    */
+  @Test
   public void testPRCqWithInvalidatesOnBridgeServer()  {
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
@@ -677,6 +692,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
    * test cqs with invalidates on bridge server not hosting datastores.
    * 
    */
+  @Test
   public void testPRCqWithInvalidatesOnAccessorBridgeServer() throws Exception {
     
     final Host host = Host.getHost(0);
@@ -777,6 +793,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
    * test cqs with create updates and destroys from client on bridge server
    * hosting datastores.
    */
+  @Test
   public void testPRCqWithUpdatesFromClients() throws Exception {
     
     final Host host = Host.getHost(0);
@@ -884,6 +901,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
    * test cqs on multiple partitioned region hosted by bridge servers.
    * 
    */
+  @Test
   public void testPRCqWithMultipleRegionsOnServer() throws Exception {
     
     final Host host = Host.getHost(0);
@@ -1030,6 +1048,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
    * for not requiring old values.
    * 
    */
+  @Test
   public void testPRWithCQsAndProfileUpdates() throws Exception {
     
     final Host host = Host.getHost(0);
@@ -1256,6 +1275,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
    * @throws Exception
    */
   @Category(FlakyTest.class) // GEODE-1181: random ports, eats exceptions (fixed some), async behavior
+  @Test
   public void testEventsDuringQueryExecution() throws Exception {
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
@@ -1384,6 +1404,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
 
   }
 
+  @Test
   public void testCQsWithPutalls() throws Exception {
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
@@ -1478,6 +1499,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
     cqHelper.closeServer(server1);   
   }
   
+  @Test
   public void testCQsWithPutallsValidateStats() throws Exception {
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
@@ -1580,6 +1602,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
     cqHelper.closeServer(server1);   
   }
   
+  @Test
   public void testCQsWithPutallsWithTx() throws Exception {
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);
@@ -1702,6 +1725,7 @@ public class PrCqUsingPoolDUnitTest extends CacheTestCase {
   
   }
   
+  @Test
   public void testCQsWithPutallsWithTxValidateStats() throws Exception {
     final Host host = Host.getHost(0);
     VM server1 = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PrCqUsingPoolOptimizedExecuteDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PrCqUsingPoolOptimizedExecuteDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PrCqUsingPoolOptimizedExecuteDUnitTest.java
index bc552aa..d788b77 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PrCqUsingPoolOptimizedExecuteDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/PrCqUsingPoolOptimizedExecuteDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.cache.query.cq.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 com.gemstone.gemfire.cache.query.internal.cq.CqServiceImpl;
 import com.gemstone.gemfire.test.dunit.Invoke;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
@@ -24,10 +33,11 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
  * Test class for testing {@link CqServiceImpl#EXECUTE_QUERY_DURING_INIT} flag
  *
  */
+@Category(DistributedTest.class)
 public class PrCqUsingPoolOptimizedExecuteDUnitTest extends PrCqUsingPoolDUnitTest {
 
-  public PrCqUsingPoolOptimizedExecuteDUnitTest(String name) {
-    super(name);
+  public PrCqUsingPoolOptimizedExecuteDUnitTest() {
+    super();
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQDUnitTest.java
index 8180b31..ac60c14 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQDUnitTest.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.ArrayList;
 import java.util.List;
 
@@ -46,15 +55,17 @@ import com.gemstone.gemfire.test.dunit.Assert;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 
 
+@Category(DistributedTest.class)
 public class PdxQueryCQDUnitTest extends PdxQueryCQTestBase {
 
-  public PdxQueryCQDUnitTest(String name) {
-    super(name);
+  public PdxQueryCQDUnitTest() {
+    super();
   }
   
   /**
    * Tests client-server query on PdxInstance.
    */
+  @Test
   public void testCq() throws CacheException {
     
     final Host host = Host.getHost(0);
@@ -234,6 +245,7 @@ public class PdxQueryCQDUnitTest extends PdxQueryCQTestBase {
    * Tests client-server query on PdxInstance.
    */
   
+  @Test
   public void testCqAndInterestRegistrations() throws CacheException {
     
     final Host host = Host.getHost(0);
@@ -429,6 +441,7 @@ public class PdxQueryCQDUnitTest extends PdxQueryCQTestBase {
   /**
    * Tests client-server query on PdxInstance.
    */
+  @Test
   public void testCqAndInterestRegistrationsWithFailOver() throws CacheException {
     
     final Host host = Host.getHost(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQTestBase.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQTestBase.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQTestBase.java
index ab4c203..06f1383 100755
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQTestBase.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/PdxQueryCQTestBase.java
@@ -16,16 +16,36 @@
  */
 package com.gemstone.gemfire.cache.query.dunit;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
 import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.cache.*;
+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.DataPolicy;
+import com.gemstone.gemfire.cache.PartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+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.query.*;
+import com.gemstone.gemfire.cache.query.CacheUtils;
+import com.gemstone.gemfire.cache.query.Query;
+import com.gemstone.gemfire.cache.query.QueryService;
+import com.gemstone.gemfire.cache.query.SelectResults;
+import com.gemstone.gemfire.cache.query.Struct;
 import com.gemstone.gemfire.cache.query.data.PortfolioPdx;
 import com.gemstone.gemfire.cache.query.data.PositionPdx;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.compression.Compressor;
 import com.gemstone.gemfire.compression.SnappyCompressor;
 import com.gemstone.gemfire.i18n.LogWriterI18n;
@@ -37,14 +57,9 @@ import com.gemstone.gemfire.test.dunit.Assert;
 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;
 
-import java.io.IOException;
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-
-public abstract class PdxQueryCQTestBase extends CacheTestCase {
+public abstract class PdxQueryCQTestBase extends JUnit4CacheTestCase {
 
   /** The port on which the bridge server was started in this VM */
   private static int bridgeServerPort;
@@ -93,8 +108,8 @@ public abstract class PdxQueryCQTestBase extends CacheTestCase {
 
   public void createPool(VM vm, String poolName, String server, int port,
       boolean subscriptionEnabled) {
-        createPool(vm, poolName, new String[]{server}, new int[]{port}, subscriptionEnabled);  
-      }
+      createPool(vm, poolName, new String[]{server}, new int[]{port}, subscriptionEnabled);
+    }
 
   public void createPool(VM vm, String poolName, String server, int port) {
     createPool(vm, poolName, new String[]{server}, new int[]{port}, false);  
@@ -477,8 +492,8 @@ public abstract class PdxQueryCQTestBase extends CacheTestCase {
         bridgeServerPort = bridge.getPort();
       }
 
-  public PdxQueryCQTestBase(String name) {
-    super(name);
+  public PdxQueryCQTestBase() {
+    super();
   }
 
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUpdateRIDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUpdateRIDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUpdateRIDUnitTest.java
index 476caf1..bb417c2 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUpdateRIDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryIndexUpdateRIDUnitTest.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.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -59,7 +68,8 @@ import com.gemstone.gemfire.cache30.CertifiableTestCacheListener;
  * 
  *
  */
-public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
+@Category(DistributedTest.class)
+public class QueryIndexUpdateRIDUnitTest extends JUnit4CacheTestCase{
 
   /** The port on which the bridge server was started in this VM */
   private static int bridgeServerPort;
@@ -76,8 +86,8 @@ public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
 
   private static final String ROOT = "root";
   
-  public QueryIndexUpdateRIDUnitTest(String name) {
-    super(name);
+  public QueryIndexUpdateRIDUnitTest() {
+    super();
   }
 
   /* Test creates 1 Client and 1 Server. Client and Server create same region in their cache.
@@ -85,9 +95,10 @@ public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
    * Query must fail as registerInterest does not update indexes on client.
    */
 
+  @Test
   public void testClientIndexUpdateWithRIOnKeys() throws Exception{
     
-    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("CqRegisterInterestIndexUpdateDunitTest");
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest();
     
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -130,9 +141,10 @@ public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
    * with client region on register interest.
    * @throws Exception
    */
+  @Test
   public void testClientIndexUpdateWithRIOnOverlapKeys() throws Exception{
     
-    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("CqRegisterInterestIndexUpdateDunitTest");
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest();
     
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -180,9 +192,10 @@ public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
     cqDUnitTest.closeServer(server);
   }
 
+  @Test
   public void testClientIndexUpdateWithRIOnRegion() throws Exception{
     
-    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("CqRegisterInterestIndexUpdateDunitTest");
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest();
     
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -220,9 +233,10 @@ public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
     cqDUnitTest.closeServer(server);
   }
 
+  @Test
   public void testClientIndexUpdateWithRIOnRegEx() throws Exception{
     
-    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("QueryIndexUpdateRIDunitTest");
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest();
     
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -266,9 +280,10 @@ public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
    * 
    * @throws Exception
    */
+  @Test
   public void testClientIndexUpdateWithRIOnClearedRegion() throws Exception{
     
-    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("QueryIndexUpdateRIDunitTest");
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest();
     
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -322,9 +337,10 @@ public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
    * Same tests as above using Partitioned Regions. 
    */
 
+  @Test
   public void testClientIndexUpdateWithRIOnPRRegion() throws Exception{
     
-    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("QueryIndexUpdateRIDunitTest");
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest();
     
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -362,9 +378,10 @@ public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
     cqDUnitTest.closeServer(server);
   }
 
+  @Test
   public void testClientIndexUpdateWithRIOnPRKeys() throws Exception{
     
-    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("QueryIndexUpdateRIDunitTest");
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest();
     
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -402,9 +419,10 @@ public class QueryIndexUpdateRIDUnitTest extends CacheTestCase{
     cqDUnitTest.closeServer(server);
   }
 
+  @Test
   public void testClientIndexUpdateWithRIOnPRRegEx() throws Exception{
     
-    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest("QueryIndexUpdateRIDunitTest");
+    CqQueryUsingPoolDUnitTest cqDUnitTest = new CqQueryUsingPoolDUnitTest();
     
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryMonitorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryMonitorDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryMonitorDUnitTest.java
index 8153ab2..98f5721 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryMonitorDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/query/dunit/QueryMonitorDUnitTest.java
@@ -16,7 +16,27 @@
  */
 package com.gemstone.gemfire.cache.query.dunit;
 
-import com.gemstone.gemfire.cache.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Properties;
+
+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.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+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;
@@ -34,27 +54,34 @@ import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.cache30.ClientServerTestCase;
 import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-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.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+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;
-import org.junit.experimental.categories.Category;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Properties;
 
 /**
  * Tests for QueryMonitoring service.
+ *
  * @since GemFire 6.0
  */
-public class QueryMonitorDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class QueryMonitorDUnitTest extends JUnit4CacheTestCase {
 
   private static int bridgeServerPort;
 
   private final String exampleRegionName = "exampleRegion";
   private final String exampleRegionName2 = "exampleRegion2";
   private final String poolName = "serverConnectionPool";
-  
-  
+
   /* Some of the queries are commented out as they were taking less time */
   String[]  queryStr = {
       "SELECT ID FROM /root/exampleRegion p WHERE  p.ID > 100",
@@ -117,29 +144,34 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
   
   private int numServers;
 
-  public QueryMonitorDUnitTest(String name) {
-    super(name);
+  @Override
+  public final void preTearDownCacheTestCase() throws Exception {
+    Host host = Host.getHost(0);
+    disconnectFromDS();
+    // shut down clients before servers
+    for (int i=numServers; i<4; i++) {
+      host.getVM(i).invoke(() -> CacheTestCase.disconnectFromDS());
+    }
   }
 
   public void setup(int numServers) throws Exception {
-    super.setUp();
     Host host = Host.getHost(0);
     this.numServers = numServers;
-    
+
     // avoid IllegalStateException from HandShake by connecting all vms tor
     // system before creating connection pools
     getSystem();
-    
+
     SerializableRunnable r = new SerializableRunnable("getSystem") {
       public void run() {
         getSystem();
       }
     };
-    
+
     for (int i=0; i<numServers; i++) {
       host.getVM(i).invoke(r);
     }
-    
+
     r = new SerializableRunnable("getClientSystem") {
       public void run() {
         Properties props = DistributedTestUtils.getAllDistributedSystemProperties(new Properties());
@@ -147,22 +179,12 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
         getSystem(props);
       }
     };
-    
+
     for (int i=numServers; i<4; i++) {
       host.getVM(i).invoke(r);
     }
   }
-  
-  @Override
-  public final void preTearDownCacheTestCase() throws Exception {
-    Host host = Host.getHost(0);
-    disconnectFromDS();
-    // shut down clients before servers
-    for (int i=numServers; i<4; i++) {
-      host.getVM(i).invoke(() -> CacheTestCase.disconnectFromDS());
-    }
-  }
-  
+
   public void createRegion(VM vm){
     createRegion(vm, false, null);
   }
@@ -290,6 +312,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
   /**
    * Tests query execution from client to server (single server).
    */
+  @Test
   public void testQueryMonitorClientServer() throws Exception {
 
     setup(1);
@@ -366,6 +389,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
   /**
    * Tests query execution from client to server (multi server).
    */
+  @Test
   public void testQueryMonitorMultiClientMultiServer() throws Exception {
 
     setup(2);
@@ -456,6 +480,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
    * Tests query execution on local vm.
    */
   @Category(FlakyTest.class) // GEODE-577: eats exceptions
+  @Test
   public void testQueryExecutionLocally() throws Exception {
 
     setup(2);
@@ -534,6 +559,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
   /**
    * Tests query execution on local vm.
    */
+  @Test
   public void testQueryExecutionLocallyAndCacheOp() throws Exception {
 
     setup(2);
@@ -620,6 +646,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
   /**
    * Tests query execution from client to server (multiple server) on Partition Region .
    */
+  @Test
   public void testQueryMonitorOnPR() throws Exception {
 
     setup(2);
@@ -703,6 +730,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
   /**
    * Tests query execution on Partition Region, executes query locally.
    */
+  @Test
   public void testQueryMonitorWithLocalQueryOnPR() throws Exception {
 
     setup(2);
@@ -776,7 +804,9 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
   /**
    * Tests query execution from client to server (multiple server) with eviction to disk.
    */
-  public void BUG46770WORKAROUNDtestQueryMonitorRegionWithEviction() throws CacheException {
+  @Ignore("TODO:BUG46770WORKAROUND: test is disabled")
+  @Test
+  public void testQueryMonitorRegionWithEviction() throws CacheException {
 
     final Host host = Host.getHost(0);
     
@@ -858,6 +888,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
   /**
    * Tests query execution on region with indexes.
    */
+  @Test
   public void testQueryMonitorRegionWithIndex() throws Exception {
 
     setup(2);
@@ -984,13 +1015,14 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
   }
   
   
-  protected CqQueryDUnitTest cqDUnitTest = new CqQueryDUnitTest("CqDataDUnitTest");
+  protected CqQueryDUnitTest cqDUnitTest = new CqQueryDUnitTest();
 
   /**
    * The following CQ test is added to make sure TEST_MAX_QUERY_EXECUTION_TIME is reset
    * and is not affecting other query related tests.
    * @throws Exception
    */
+  @Test
   public void testCQWithDestroysAndInvalidates() throws Exception
   {
     setup(1);
@@ -1068,6 +1100,7 @@ public class QueryMonitorDUnitTest extends CacheTestCase {
   /**
    * Tests cache operation right after query cancellation.
    */
+  @Test
   public void testCacheOpAfterQueryCancel() throws Exception {
 
     setup(4);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-cq/src/test/java/com/gemstone/gemfire/cache/snapshot/ClientSnapshotDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-cq/src/test/java/com/gemstone/gemfire/cache/snapshot/ClientSnapshotDUnitTest.java b/geode-cq/src/test/java/com/gemstone/gemfire/cache/snapshot/ClientSnapshotDUnitTest.java
index 9d487dc..327de28 100644
--- a/geode-cq/src/test/java/com/gemstone/gemfire/cache/snapshot/ClientSnapshotDUnitTest.java
+++ b/geode-cq/src/test/java/com/gemstone/gemfire/cache/snapshot/ClientSnapshotDUnitTest.java
@@ -16,9 +16,23 @@
  */
 package com.gemstone.gemfire.cache.snapshot;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.concurrent.atomic.AtomicBoolean;
+
 import com.examples.snapshot.MyObject;
 import com.examples.snapshot.MyPdxSerializer;
-import com.gemstone.gemfire.cache.*;
+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.EntryEvent;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.Region;
+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.ClientRegionShortcut;
@@ -30,26 +44,25 @@ import com.gemstone.gemfire.cache.snapshot.SnapshotOptions.SnapshotFormat;
 import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
 import com.gemstone.gemfire.cache.util.CqListenerAdapter;
-import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.test.dunit.Host;
 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.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
-import java.io.File;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class ClientSnapshotDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class ClientSnapshotDUnitTest extends JUnit4CacheTestCase {
 
   private transient Region<Integer, MyObject> region;
-  
-  public ClientSnapshotDUnitTest(String name) {
-    super(name);
+
+  @Override
+  public final void postSetUp() throws Exception {
+    loadCache();
   }
 
+  @Test
   public void testExport() throws Exception {
     int count = 10000;
     for (int i = 0; i < count; i++) {
@@ -82,6 +95,7 @@ public class ClientSnapshotDUnitTest extends CacheTestCase {
     }
   }
   
+  @Test
   public void testImport() throws Exception {
     int count = 1000;
     for (int i = 0; i < count; i++) {
@@ -153,6 +167,7 @@ public class ClientSnapshotDUnitTest extends CacheTestCase {
     }
   }
   
+  @Test
   public void testClientCallbacks() throws Exception {
     int count = 1000;
     for (int i = 0; i < count; i++) {
@@ -206,6 +221,7 @@ public class ClientSnapshotDUnitTest extends CacheTestCase {
     region.getSnapshotService().load(f, SnapshotFormat.GEMFIRE);
   }
   
+  @Test
   public void testInvalidate() throws Exception {
     SerializableCallable invalid = new SerializableCallable() {
       @Override
@@ -230,11 +246,6 @@ public class ClientSnapshotDUnitTest extends CacheTestCase {
     assertNull(region.get(1));
   }
 
-  @Override
-  public final void postSetUp() throws Exception {
-    loadCache();
-  }
-  
   @SuppressWarnings("serial")
   public void loadCache() throws Exception {
     CacheFactory cf = new CacheFactory().setPdxSerializer(new MyPdxSerializer());


Mime
View raw message