geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [50/54] [abbrv] [partial] incubator-geode git commit: GEODE-837: update tests from JUnit3 to JUnit4
Date Thu, 09 Jun 2016 18:50:18 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsQueryAndFEJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsQueryAndFEJUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsQueryAndFEJUnitTest.java
index f10d96b..b63b6ec 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsQueryAndFEJUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsQueryAndFEJUnitTest.java
@@ -16,33 +16,62 @@
  */
 package com.gemstone.gemfire.rest.internal.web.controllers;
 
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.execute.FunctionService;
-import com.gemstone.gemfire.distributed.ServerLauncher;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.internal.GemFireVersion;
-import com.gemstone.gemfire.internal.SocketCreator;
-import com.gemstone.gemfire.management.internal.AgentUtil;
-import com.gemstone.gemfire.management.internal.ManagementConstants;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import junit.framework.TestCase;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.springframework.http.*;
+import org.springframework.http.HttpEntity;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
 import org.springframework.util.StringUtils;
 import org.springframework.web.client.HttpClientErrorException;
 import org.springframework.web.client.HttpServerErrorException;
 
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.CacheWriter;
+import com.gemstone.gemfire.cache.CacheWriterException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Declarable;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.LoaderHelper;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.cache.RegionEvent;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.TimeoutException;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.distributed.ServerLauncher;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.internal.GemFireVersion;
+import com.gemstone.gemfire.internal.SocketCreator;
+import com.gemstone.gemfire.management.internal.AgentUtil;
+import com.gemstone.gemfire.management.internal.ManagementConstants;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
 
 @Category(IntegrationTest.class)
-public class RestAPIsQueryAndFEJUnitTest extends TestCase {
+public class RestAPIsQueryAndFEJUnitTest {
 
   private Cache c;
 
@@ -54,9 +83,6 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
   
   private final String CUSTOMER_REGION = "customers";
   
-  //DEBUG code
-  //private final String PEOPLE_REGION = "People";
-  
   private final String ITEM_REGION = "items";
   private final String ORDER_REGION = "orders";
   private final String PRIMITIVE_KV_STORE_REGION = "primitiveKVStore";
@@ -1252,9 +1278,9 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
       return baseURL + RestTestUtils.GEMFIRE_REST_API_CONTEXT + RestTestUtils.GEMFIRE_REST_API_VERSION + requestPart;
     }
   }
+
   public void initializeQueryTestData() {
-    
-    //LIST_ALL_NAMED_QUERY 
+    //LIST_ALL_NAMED_QUERY
     int size = PARAMETERIZED_QUERIES.length;
     List<String> queryIds = new ArrayList<>();
     for (int i=0; i < size; i++ ){
@@ -1293,10 +1319,8 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
     queryResultByIndex.put(48, qIndex48_resultData);
   }
   
-  @Override
-  @SuppressWarnings("deprecation")
+  @Before
   public void setUp() throws Exception {
-    
     AgentUtil agentUtil = new AgentUtil(GemFireVersion.getGemFireVersion());
     if (agentUtil.findWarLocation("geode-web-api") == null) {
       fail("unable to locate geode-web-api WAR file");
@@ -1329,33 +1353,6 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
     this.baseURL = "http://" + this.hostName + ":" + this.restServicePort;
     this.c = CacheFactory.getAnyInstance();
     
-    /*
-    //Debug code
-    this.baseURL = "http://" + "localhost" + ":" + "8080";
-   
-    this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0")
-        .set("rest-service-http-port", String.valueOf(this.restServicePort))
-        .set("rest-service-bind-address", this.hostName)
-        //.set("log-file", "./restJunitLogs/my.log")
-        .setPdxReadSerialized(true).create();
-    */
-    
-    /*
-    this.c = (GemFireCacheImpl) new CacheFactory().set("mcast-port", "0")
-        .set("rest-service-http-port", "8080")
-        .set("rest-service-bind-address", "localhost")
-        //.set("log-file", "./restJunitLogs/my.log")
-        .setPdxReadSerialized(true).create();
-    */
-    
-    //start cache-server, Gemfire cache clients will connect it
-    /*
-    BridgeServer server = c.addCacheServer();
-    final int serverPort = 40405;
-    server.setPort(serverPort);
-    server.start();
-    */
-    
     final AttributesFactory<String, String> attributesFactory = new AttributesFactory<>();
     attributesFactory.setDataPolicy(DataPolicy.REPLICATE);
 
@@ -1364,9 +1361,6 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
         .create();
     c.createRegion(CUSTOMER_REGION, regionAttributes);
     
-    //Debug code
-    //c.createRegion(PEOPLE_REGION, regionAttributes);
-    
     // Create region, items
     attributesFactory.setDataPolicy(DataPolicy.PARTITION);
     c.createRegion(ITEM_REGION, regionAttributes);
@@ -1399,10 +1393,9 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
     FunctionService.registerFunction(new AddFreeItemToOrders());
   }
 
-  @Override
+  @After
   public void tearDown() {
     // shutdown and clean up the manager node.
-    //this.c.close();
     ServerLauncher.getInstance().stop();
   }
   
@@ -1416,24 +1409,27 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
     return headers;
   }
 
- 
+  @Test
   public void testCreateAsJson() { 
     executeQueryTestCases();
   }
-    
+
+  private void caught(String message, Throwable cause) {
+    throw new AssertionError(message, cause);
+  }
+
   private void validateGetAllResult(int index, ResponseEntity<String> result){
-    if(index == 27  || index == 29  || index == 30) {
+    if (index == 27  || index == 29  || index == 30) {
       try {
         new JSONObject(result.getBody()).getJSONArray("customers");
       } catch (JSONException e) {
-        fail("Caught JSONException in validateGetAllResult :: " + e.getMessage());
+        caught("Caught JSONException in validateGetAllResult :: " + e.getMessage(), e);
       }
     }
   }
   
   private void verifyRegionSize(int index, ResponseEntity<String> result) {
-    
-    if(index == 59 ) {
+    if (index == 59 ) {
       HttpHeaders headers = result.getHeaders();
       String value = headers.getFirst("Resource-Count");
       assertEquals(Integer.parseInt(value), 55);
@@ -1441,8 +1437,7 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
   }
   
   private void validateQueryResult(int index, ResponseEntity<String> result){
-    
-    if(Query_URL_INDEXS.contains(index)) {
+    if (Query_URL_INDEXS.contains(index)) {
       queryResultByIndex = new HashMap<>();
       initializeQueryTestData();  
       QueryResultData queryResult =  queryResultByIndex.get(index);   
@@ -1458,7 +1453,7 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
             assertTrue("PREPARE_PARAMETERIZED_QUERY: function IDs are not matched", queryResult.getResult().contains(jsonArray.getJSONObject(i).getString("id")));
           }
         } catch (JSONException e) {
-          fail("Caught JSONException in validateQueryResult :: " + e.getMessage());
+          caught("Caught JSONException in validateQueryResult :: " + e.getMessage(), e);
         }
       }
       else if (index == 46 || index == 47 || index == 48) {
@@ -1469,16 +1464,13 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
           //verify query result size
           assertEquals(queryResult.getResultSize(), jsonArray.length());
         } catch (JSONException e) {
-          fail("Caught JSONException in validateQueryResult :: " + e.getMessage());
+          caught("Caught JSONException in validateQueryResult :: " + e.getMessage(), e);
         }
-        
       }
-        
     }
   }
   
   private String addExpectedException (int index) {
-  
     String expectedEx =  "appears to have started a thread named";
     if (index == 4 || index == 5 || index == 24) {
       expectedEx = "java.lang.UnsupportedOperationException";
@@ -1492,118 +1484,110 @@ public class RestAPIsQueryAndFEJUnitTest extends TestCase {
       expectedEx = "com.gemstone.gemfire.cache.CacheWriterException";
       c.getLogger().info("<ExpectedException action=add>" + expectedEx + "</ExpectedException>");
       return expectedEx;
-    }else if (index == 19) {
+    } else if (index == 19) {
       expectedEx = "java.lang.IllegalArgumentException";
       c.getLogger().info("<ExpectedException action=add>" + expectedEx + "</ExpectedException>");
       return expectedEx;
-    }else if (index == 38 || index == 41 ) {
+    } else if (index == 38 || index == 41 ) {
       expectedEx = "com.gemstone.gemfire.cache.RegionDestroyedException";
       c.getLogger().info("<ExpectedException action=add>" + expectedEx + "</ExpectedException>");
       return expectedEx;
     }
     
     return expectedEx;
-    
   }
-  private void executeQueryTestCases() {
 
+  private void executeQueryTestCases() {
     HttpHeaders headers = setAcceptAndContentTypeHeaders();
     HttpEntity<Object> entity;
     
     int totalRequests = TEST_DATA.length;
     String expectedEx = null;
       
-      for (int index=0; index < totalRequests; index++) { 
-      //Debug code
-      /*
-      c.getLogger().info("-------------------------------");
-      c.getLogger().info("Index:" + index+ " " +  TEST_DATA[index][METHOD_INDEX] + " " + TEST_DATA[index][URL_INDEX]);
-                 
-       if(index == 50){
-         System.out.println("Debug Here...!!");
-       }
-       */
-       try {    
-          expectedEx = addExpectedException(index);
-          final String restRequestUrl = createRestURL(this.baseURL, TEST_DATA[index][URL_INDEX]);  
-          
-          entity = new HttpEntity<>(TEST_DATA[index][REQUEST_BODY_INDEX], headers);
-          ResponseEntity<String> result = RestTestUtils.getRestTemplate().exchange(
-              restRequestUrl,
-              (HttpMethod)TEST_DATA[index][METHOD_INDEX], entity, String.class);
-        
-          validateGetAllResult(index, result);
-          validateQueryResult(index, result);
-          
-          assertEquals(result.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-          assertEquals(result.hasBody(), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
-          
-          verifyRegionSize(index, result);
-          //TODO:
-          //verify location header
-          
-        } catch (HttpClientErrorException e) {
-          
-          if( VALID_409_URL_INDEXS.contains(index)) { 
-            //create-409, conflict testcase. [create on already existing key]
-            
-            assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-            assertEquals(StringUtils.hasText(e.getResponseBodyAsString()),((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
-            
-          }else if (VALID_400_URL_INDEXS.contains(index)) { 
-            // 400, Bad Request testcases. [create with malformed Json]
-            
-            assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-            assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
-            
-          }
-          else if(VALID_404_URL_INDEXS.contains(index) ) { 
-            // create-404, Not Found testcase. [create on not-existing region]
-            
-            assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-            assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
-           
-          }
-          else if(VALID_405_URL_INDEXS.contains(index) ) { 
-            // create-404, Not Found testcase. [create on not-existing region]
-            
-            assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-            assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
-          }
-          else {
-          fail( "Index:" + index+ " " +  TEST_DATA[index][METHOD_INDEX] + " " + TEST_DATA[index][URL_INDEX] + " should not have thrown exception ");
-          }
-          
-        }catch (HttpServerErrorException se) { 
-          //index=4, create- 500, INTERNAL_SERVER_ERROR testcase. [create on Region with DataPolicy=Empty set]
-          //index=7, create- 500, INTERNAL_SERVER_ERROR testcase. [Get, attached cache loader throws Timeout exception]
-          //index=11, put- 500, [While doing R.put, CacheWriter.beforeCreate() has thrown CacheWriterException]
-          //.... and more test cases
-          assertEquals(se.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
-          assertEquals(StringUtils.hasText(se.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
-          
+    for (int index=0; index < totalRequests; index++) {
+      try {
+        expectedEx = addExpectedException(index);
+        final String restRequestUrl = createRestURL(this.baseURL, TEST_DATA[index][URL_INDEX]);
+
+        entity = new HttpEntity<>(TEST_DATA[index][REQUEST_BODY_INDEX], headers);
+        ResponseEntity<String> result = RestTestUtils.getRestTemplate().exchange(
+            restRequestUrl,
+            (HttpMethod)TEST_DATA[index][METHOD_INDEX], entity, String.class);
+
+        validateGetAllResult(index, result);
+        validateQueryResult(index, result);
+
+        assertEquals(result.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
+        assertEquals(result.hasBody(), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
+
+        verifyRegionSize(index, result);
+        //TODO:
+        //verify location header
+
+      } catch (HttpClientErrorException e) {
+
+        if( VALID_409_URL_INDEXS.contains(index)) {
+          //create-409, conflict testcase. [create on already existing key]
+
+          assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
+          assertEquals(StringUtils.hasText(e.getResponseBodyAsString()),((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
+
+        }else if (VALID_400_URL_INDEXS.contains(index)) {
+          // 400, Bad Request testcases. [create with malformed Json]
+
+          assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
+          assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
+
         }
-        catch (Exception e) {
-          throw new RuntimeException("caught Exception in executeQueryTestCases " + "Index:" + index+ " " +  TEST_DATA[index][METHOD_INDEX] + " " + TEST_DATA[index][URL_INDEX] + " :: Unexpected ERROR...!!", e);
-        }finally {
-          c.getLogger().info("<ExpectedException action=remove>" + expectedEx + "</ExpectedException>");
+        else if (VALID_404_URL_INDEXS.contains(index) ) {
+          // create-404, Not Found testcase. [create on not-existing region]
+
+          assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
+          assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
+
         }
-        
-      } 
-    
+        else if (VALID_405_URL_INDEXS.contains(index) ) {
+          // create-404, Not Found testcase. [create on not-existing region]
+
+          assertEquals(e.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
+          assertEquals(StringUtils.hasText(e.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
+        }
+        else {
+        fail( "Index:" + index+ " " +  TEST_DATA[index][METHOD_INDEX] + " " + TEST_DATA[index][URL_INDEX] + " should not have thrown exception ");
+        }
+
+      } catch (HttpServerErrorException se) {
+        //index=4, create- 500, INTERNAL_SERVER_ERROR testcase. [create on Region with DataPolicy=Empty set]
+        //index=7, create- 500, INTERNAL_SERVER_ERROR testcase. [Get, attached cache loader throws Timeout exception]
+        //index=11, put- 500, [While doing R.put, CacheWriter.beforeCreate() has thrown CacheWriterException]
+        //.... and more test cases
+        assertEquals(se.getStatusCode(), TEST_DATA[index][STATUS_CODE_INDEX]);
+        assertEquals(StringUtils.hasText(se.getResponseBodyAsString()), ((Boolean)TEST_DATA[index][RESPONSE_HAS_BODY_INDEX]).booleanValue());
+
+      }
+      catch (Exception e) {
+        caught("caught Exception in executeQueryTestCases " + "Index:" + index+ " " +  TEST_DATA[index][METHOD_INDEX] + " " + TEST_DATA[index][URL_INDEX] + " :: Unexpected ERROR...!!", e);
+      } finally {
+        c.getLogger().info("<ExpectedException action=remove>" + expectedEx + "</ExpectedException>");
+      }
+    }
   }
-  
 }
 
+// TODO: move following classes to be inner classes
+
 class SimpleCacheLoader implements CacheLoader<String, Object>, Declarable {
 	  
+  @Override
   public Object load(LoaderHelper helper) {
     //throws TimeoutException  
     throw new TimeoutException("Could not load, Request Timedout...!!");
   }
-  public void close() {  
-  
+
+  @Override
+  public void close() {
   }
+
   @Override
   public void init(Properties props) {
     
@@ -1613,10 +1597,12 @@ class SimpleCacheLoader implements CacheLoader<String, Object>, Declarable {
 class SampleCacheWriter  implements CacheWriter<String, Object> {
 
   @Override
-  public void close() { }
+  public void close() {
+  }
 
   @Override
-  public void beforeUpdate(EntryEvent event) throws CacheWriterException { }
+  public void beforeUpdate(EntryEvent event) throws CacheWriterException {
+  }
 
   @Override
   public void beforeCreate(EntryEvent event) throws CacheWriterException {
@@ -1629,16 +1615,18 @@ class SampleCacheWriter  implements CacheWriter<String, Object> {
   }
 
   @Override
-  public void beforeRegionDestroy(RegionEvent event) throws CacheWriterException { }
+  public void beforeRegionDestroy(RegionEvent event) throws CacheWriterException {
+  }
 
   @Override
-  public void beforeRegionClear(RegionEvent event) throws CacheWriterException { } 
+  public void beforeRegionClear(RegionEvent event) throws CacheWriterException {
+  }
 }
 
 enum QueryType {LIST_ALL_NAMED_QUERY, EXECUTE_NAMED_QUERY, EXECUTE_ADHOC_QUERY }
 
-class QueryResultData
-{
+class QueryResultData {
+
   private int queryIndex;
   private QueryType type; 
   private int resultSize;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
index e82d198..e6b16d0 100644
--- a/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
+++ b/geode-assembly/src/test/java/com/gemstone/gemfire/rest/internal/web/controllers/RestAPIsWithSSLDUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.rest.internal.web.controllers;
 
+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.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
@@ -58,6 +67,7 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
  * 
  * @since GemFire 8.0
  */
+@Category(DistributedTest.class)
 public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
 
   private static final long serialVersionUID = -254776154266339226L;
@@ -66,8 +76,8 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
 
   private File jks;
 
-  public RestAPIsWithSSLDUnitTest(String name) {
-    super(name);
+  public RestAPIsWithSSLDUnitTest() {
+    super();
     this.jks = findTrustedJKS();
   }
 
@@ -401,6 +411,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
 
   // Actual Tests starts here.
 
+  @Test
   public void testSimpleSSL() throws Exception {
 
     Properties props = new Properties();
@@ -412,6 +423,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     validateConnection(restEndpoint, "SSL");
   }
 
+  @Test
   public void testSSLWithoutKeyStoreType() throws Exception {
     Properties props = new Properties();
     props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
@@ -422,6 +434,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     validateConnection(restEndpoint, "SSL");
   }
 
+  @Test
   public void testSSLWithSSLProtocol() throws Exception {
     Properties props = new Properties();
     props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
@@ -433,6 +446,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     validateConnection(restEndpoint, "SSL");
   }
 
+  @Test
   public void testSSLWithTLSProtocol() throws Exception {
     Properties props = new Properties();
     props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
@@ -444,6 +458,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     validateConnection(restEndpoint, "TLS");
   }
 
+  @Test
   public void testSSLWithTLSv11Protocol() throws Exception {
     Properties props = new Properties();
     props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
@@ -455,6 +470,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     validateConnection(restEndpoint, "TLSv1.1");
   }
 
+  @Test
   public void testSSLWithTLSv12Protocol() throws Exception {
     Properties props = new Properties();
     props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
@@ -466,6 +482,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     validateConnection(restEndpoint, "TLSv1.2");
   }
 
+  @Test
   public void testWithMultipleProtocol() throws Exception {
     Properties props = new Properties();
     props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
@@ -477,6 +494,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     validateConnection(restEndpoint, "TLSv1.2");
   }
 
+  @Test
   public void testSSLWithCipherSuite() throws Exception {
     System.setProperty("javax.net.debug", "ssl");
     Properties props = new Properties();
@@ -496,6 +514,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     validateConnection(restEndpoint, "TLSv1.2");
   }
 
+  @Test
   public void testSSLWithMultipleCipherSuite() throws Exception {
     Properties props = new Properties();
     props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");
@@ -514,6 +533,7 @@ public class RestAPIsWithSSLDUnitTest extends LocatorTestBase {
     validateConnection(restEndpoint, "TLSv1.2");
   }
 
+  @Test
   public void testMutualAuthentication() throws Exception {
     Properties props = new Properties();
     props.setProperty(HTTP_SERVICE_SSL_ENABLED, "true");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/JUnitTestSetup.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/JUnitTestSetup.java b/geode-core/src/test/java/com/gemstone/gemfire/JUnitTestSetup.java
deleted file mode 100644
index deba960..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/JUnitTestSetup.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire;
-
-import junit.extensions.TestDecorator;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-import junit.framework.TestResult;
-import java.util.ArrayList;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-
-
-/*
- * This class is a decorator for junit.framework.Test to enable class wide setUp() and tearDown() 
- * In order to use this decorator, the Testcase must contain this code:
- * <code>
- * public static Test suite() {
- *   return JUnitTestSetup.createJUnitTestSetup(ExampleTestCase.class);
- * }
- * </code>
- * If a class being added to this suite has any static methods like this
- * <code>static void caseSetUp()</code>
- * then it will be called once for that test case before any of its test methods are invoked.
- * If a class being added to this suite has any static methods like this
- * <code>static void caseTearDown()</code>
- * then it will be called once for that test case after all of its test methods are invoked.
- * For both of these <em>case</em> methods the subclass one is called first
- * followed by any found in the parent classes.
- *
- * @see Test
- * @deprecated use @BeforeClass and @AfterClass instead
- */
-public class JUnitTestSetup extends TestDecorator {
-
-   /**   * List of Method instances to call once on a testCase before any of its test methods
-   */
-  private ArrayList fCaseSetUp = null;
-  /**
-   * List of Method instances to call once on a testCase after all of its test methods
-   */
-  private ArrayList fCaseTearDown = null;
-
-   /**
-   * Find a static method on the specified class with the specified name
-   * and puts it in the specified list
-   * given class
-   */
-  private void findCaseMethod(Class c, String methName, ArrayList l) {
-    Method m = null;
-    try {
-      m = c.getDeclaredMethod(methName, new Class[]{});
-      if (!Modifier.isStatic(m.getModifiers())) {
-        m = null;
-      }
-    } catch (NoSuchMethodException ex) {
-    }
-    if (m != null) {
-      l.add(m);
-    }
-  }
-
-  /*
-   * Factory method to use this Junit TestDecorator
-   * @params theClass this is the test you want to decorate
-   */
-  public static Test createJUnitTestSetup(final Class theClass) {
-    TestSuite ts = new TestSuite();
-    ts.addTestSuite(theClass);
-    return new JUnitTestSetup(ts, theClass);
-  }
-
-  public JUnitTestSetup(Test ts, Class theClass) {
-    super(ts);
-    Class superClass = theClass;
-    ArrayList caseSetUp = new ArrayList();
-    ArrayList caseTearDown = new ArrayList();
-    while (Test.class.isAssignableFrom(superClass)) { 
-//      Method[] methods= superClass.getDeclaredMethods();
-      //for (int i= 0; i < methods.length; i++) {
-      //  addTestMethod(methods[i], names, theClass);
-      //} 
-      findCaseMethod(superClass, "caseSetUp", caseSetUp);       
-      findCaseMethod(superClass, "caseTearDown", caseTearDown);  
-      superClass= superClass.getSuperclass();
-      if (this.countTestCases() != 0) {
-        if (caseSetUp.size() > 0) {
-          fCaseSetUp = caseSetUp;
-        }
-        if (caseTearDown.size() > 0) {
-          fCaseTearDown = caseTearDown;
-        }
-      }
-    }
-  }
-
-  public void run(TestResult result) {
-    try {
-      callCaseMethods(fCaseSetUp, result);    
-      basicRun(result);
-      //getTest().run(result);
-      //for (Enumeration e= tests(); e.hasMoreElements(); ) {
-      //  if (result.shouldStop() )
-      //    break;
-      //    Test test= (Test)e.nextElement();
-      //    test.run(result);
-      //  }
-    } finally {
-      callCaseMethods(fCaseTearDown, result);
-    }
-  }
-  
-  /**
-   * Used to invoke a caseSetUp method once, if one exists,
-   * before all the test methods have been invoked
-   */
-  private void callCaseMethods(ArrayList l, TestResult result) {
-    if (l != null) {
-      for (int i=0; i < l.size(); i++) {
-        try {
-          Method m = (Method)l.get(i);
-          m.invoke(null, new Object[]{});
-        } catch (Exception ex) {
-          result.addError(this, ex);
-        }
-      }
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/TestDataSerializer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/TestDataSerializer.java b/geode-core/src/test/java/com/gemstone/gemfire/TestDataSerializer.java
index 1eba6ca..5f1ee1f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/TestDataSerializer.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/TestDataSerializer.java
@@ -23,8 +23,6 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import util.TestException;
-
 import com.gemstone.gemfire.internal.cache.tier.sockets.DataSerializerPropogationDUnitTest;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/TimingTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/TimingTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/TimingTestCase.java
deleted file mode 100644
index 00d268c..0000000
--- a/geode-core/src/test/java/com/gemstone/gemfire/TimingTestCase.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.gemstone.gemfire;
-
-import junit.framework.TestCase;
-
-/**
- * TimingTestCase provides a nanosecond timing framework.  Extend
- * this class instead of TestCase to implement GemFire timing tests.
- */
-public abstract class TimingTestCase extends TestCase {
-
-    static private long nanosPerMilli = 1000000;
-
-    public TimingTestCase(String name) {
-        super(name);
-    }
-
-    /**
-     * backward compatibility
-     */
-    protected void time(String opDescription, int numPasses, int opsPerPass, final Runnable runnable) {
-      try {
-        time(opDescription, numPasses, opsPerPass, new RunBlock() {
-          public void run() {
-            runnable.run();
-          }});
-      } catch (Exception ex) {
-        ex.printStackTrace();
-        fail(ex.toString());
-      }
-    }
-
-    /**
-     * Invoke the Runnable numPasses times, then compute and display
-     * the duration of each operation in nanoseconds.
-     * @param opDescription a short description of the operation being timed
-     * @param numPasses the number of times to run runnable
-     * @param opsPerPass the number of operations occurring in each execution
-     *      of runnable.  This is used to compute the time of each operation -
-     *      invoking this method will execute the operation numPasses * opsPerPass
-     *      times.
-     * @param runnable contains the code to execute in the run() method
-     */
-    protected void time(String opDescription, int numPasses, int opsPerPass, RunBlock runnable) 
-    throws Exception {
-
-        // Measure elapsed time to invoke runnable numPasses times
-        long start = System.currentTimeMillis();
-        for (int pass=numPasses; pass > 0; pass--) {
-            runnable.run();
-        }
-        long elapsed = System.currentTimeMillis() - start;
-
-        // Compute time per operationS
-        long nanosPerOp = (long)((float)(elapsed * nanosPerMilli) / (float)(opsPerPass * numPasses));
-        System.out.println("Timing " + opDescription + ": " + nanosPerOp + " nanoseconds per operation");
-    }
-    
-    public static interface RunBlock {
-      public void run() throws Exception;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java
index 34f6bbb..ce43f70 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/CacheRegionClearStatsDUnitTest.java
@@ -16,23 +16,33 @@
  */
 package com.gemstone.gemfire.cache;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.internal.PoolImpl;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.Properties;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
 /**
  * verifies the count of clear operation
- *  
  */
-public class CacheRegionClearStatsDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class CacheRegionClearStatsDUnitTest extends JUnit4DistributedTestCase {
+
   /** the cache */
   private static GemFireCacheImpl cache = null;
 
@@ -53,11 +63,6 @@ public class CacheRegionClearStatsDUnitTest extends DistributedTestCase {
   
   private static final int clearOp = 2;
   
-  /** constructor */
-  public CacheRegionClearStatsDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     final Host host = Host.getHost(0);
@@ -76,11 +81,11 @@ public class CacheRegionClearStatsDUnitTest extends DistributedTestCase {
 
   public static void createClientCache(String host, Integer port1)
       throws Exception {
-    new CacheRegionClearStatsDUnitTest("temp");
+    new CacheRegionClearStatsDUnitTest();
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
-    new CacheRegionClearStatsDUnitTest("temp").createCache(props);
+    new CacheRegionClearStatsDUnitTest().createCache(props);
     PoolImpl p = (PoolImpl)PoolManager.createFactory().addServer(host,
         port1.intValue()).setSubscriptionEnabled(false)
         .setThreadLocalConnections(true).setMinConnections(1).setReadTimeout(
@@ -101,7 +106,7 @@ public class CacheRegionClearStatsDUnitTest extends DistributedTestCase {
   }
 
   private static Integer createCache(DataPolicy dataPolicy) throws Exception {
-    new CacheRegionClearStatsDUnitTest("temp").createCache(new Properties());
+    new CacheRegionClearStatsDUnitTest().createCache(new Properties());
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setDataPolicy(dataPolicy);
@@ -121,11 +126,11 @@ public class CacheRegionClearStatsDUnitTest extends DistributedTestCase {
 
   public static void createClientCacheDisk(String host, Integer port1)
       throws Exception {
-    new CacheRegionClearStatsDUnitTest("temp");
+    new CacheRegionClearStatsDUnitTest();
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
-    new CacheRegionClearStatsDUnitTest("temp").createCache(props);
+    new CacheRegionClearStatsDUnitTest().createCache(props);
     PoolImpl p = (PoolImpl)PoolManager.createFactory().addServer(host,
         port1.intValue()).setSubscriptionEnabled(false)
         .setThreadLocalConnections(true).setMinConnections(1).setReadTimeout(
@@ -140,10 +145,12 @@ public class CacheRegionClearStatsDUnitTest extends DistributedTestCase {
     Region region = cache.createRegion(REGION_NAME, attrs);
     //region.registerInterest("ALL_KEYS");
   }
+
   /**
    * This test does the following (<b> clear stats counter </b>):<br>
    * 1)Verifies that clear operation count matches with stats count<br>
    */
+  @Test
   public void testClearStatsWithNormalRegion(){
     Integer port1 = ((Integer)server1.invoke(() -> CacheRegionClearStatsDUnitTest.createServerCache()));
 
@@ -161,10 +168,12 @@ public class CacheRegionClearStatsDUnitTest extends DistributedTestCase {
     
     server1.invoke(() -> CacheRegionClearStatsDUnitTest.validationClearStat());
   }
+
   /**
    * This test does the following (<b> clear stats counter when disk involved </b>):<br>
    * 1)Verifies that clear operation count matches with stats count <br>
    */
+  @Test
   public void testClearStatsWithDiskRegion(){
     Integer port1 = ((Integer)server1.invoke(() -> CacheRegionClearStatsDUnitTest.createServerCacheDisk()));
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java
index 0932ff1..bbde730 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ClientServerTimeSyncDUnitTest.java
@@ -15,6 +15,15 @@
  * limitations under the License.
  */
 package com.gemstone.gemfire.cache;
+
+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.client.ClientCache;
 import com.gemstone.gemfire.cache.client.ClientCacheFactory;
@@ -32,10 +41,11 @@ import java.util.Properties;
 
 import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
 
-public class ClientServerTimeSyncDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class ClientServerTimeSyncDUnitTest extends JUnit4CacheTestCase {
 
-  public ClientServerTimeSyncDUnitTest(String name) {
-    super(name);
+  public ClientServerTimeSyncDUnitTest() {
+    super();
   }
 
   @Ignore("Bug 52327")
@@ -111,6 +121,7 @@ public class ClientServerTimeSyncDUnitTest extends CacheTestCase {
     }
   }
   
+  @Test
   public void testNothing() {
     // place-holder to keep dunit runner from barfing
   }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java
index 412d3ed..f414621 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAndLoaderDUnitTest.java
@@ -16,42 +16,40 @@
  */
 package com.gemstone.gemfire.cache;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.client.PoolFactory;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
-import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.test.dunit.*;
-import junit.framework.Assert;
-
-import java.io.IOException;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+import com.gemstone.gemfire.test.dunit.Host;
+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.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * This tests cases where we have both 
  * a connection pool and a bridge loader.
- *
  */
-public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
+@Category(DistributedTest.class)
+public class ConnectionPoolAndLoaderDUnitTest extends JUnit4CacheTestCase {
   
   private static int bridgeServerPort;
-  protected boolean useLocator;
+  private boolean useLocator;
 
-  public ConnectionPoolAndLoaderDUnitTest(String name) {
-    super(name);
-  }
-  
   @Override
   public final void preTearDownCacheTestCase() {
-    //TODO grid. This is a hack. The next dunit test to run after
-    //this one is the ConnectionPoolAutoDUnit test. That ends up calling
-    //getSystem() with no arguments and expects to get a system without
-    //a locator. But getSystem() is broken in that it only compares the 
-    //passed in properties (an empty list) with the  current properties.
     disconnectAllFromDS();
   }
   
@@ -62,9 +60,9 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
    * load from loader.
    * 
    * Anything that is loaded on the client is put on the server..
-   * 
    */
-  public void testPoolAndLoader() {
+  @Test
+  public void testPoolAndLoader() throws Exception {
     final String regionName = this.getName();
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -107,18 +105,18 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
         Region region = getRootRegion(regionName);
         region.put("a", "put-a");
         region.put("b", "put-b");
-        Assert.assertEquals("loaded-c", region.get("c"));
-        Assert.assertEquals("loaded-d", region.get("d"));
+        assertEquals("loaded-c", region.get("c"));
+        assertEquals("loaded-d", region.get("d"));
       }
     });
     
     server.invoke(new SerializableRunnable() {
       public void run() {
         Region region = getRootRegion(regionName);
-        Assert.assertEquals("put-a", region.get("a"));
-        Assert.assertEquals("put-b", region.get("b"));
-        Assert.assertEquals("loaded-c", region.get("c"));
-        Assert.assertEquals("loaded-d", region.get("d"));
+        assertEquals("put-a", region.get("a"));
+        assertEquals("put-b", region.get("b"));
+        assertEquals("loaded-c", region.get("c"));
+        assertEquals("loaded-d", region.get("d"));
         region.put("e", "server-e");
       }
     });
@@ -126,11 +124,11 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
     client.invoke(new SerializableRunnable() {
       public void run() {
         Region region = getRootRegion(regionName);
-        Assert.assertEquals("put-a", region.get("a"));
-        Assert.assertEquals("put-b", region.get("b"));
-        Assert.assertEquals("loaded-c", region.get("c"));
-        Assert.assertEquals("loaded-d", region.get("d"));
-        Assert.assertEquals("server-e", region.get("e"));
+        assertEquals("put-a", region.get("a"));
+        assertEquals("put-b", region.get("b"));
+        assertEquals("loaded-c", region.get("c"));
+        assertEquals("loaded-d", region.get("d"));
+        assertEquals("server-e", region.get("e"));
       }
     });
   }
@@ -143,7 +141,8 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
    * local writer
    * put on server
    */
-  public void testPoolAndWriter() {
+  @Test
+  public void testPoolAndWriter() throws Exception {
     final String regionName = this.getName();
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -194,31 +193,31 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
           region.put("a", "new-a");
           fail("Should have gotten a cache writer exception");
         } catch(CacheWriterException e) {
-          Assert.assertEquals("beforeUpdate", e.getMessage());
+          assertEquals("beforeUpdate", e.getMessage());
         }
         try {
           region.destroy("b");
           fail("Should have gotten a cache writer exception");
         } catch(CacheWriterException e) {
-          Assert.assertEquals("beforeDestroy", e.getMessage());
+          assertEquals("beforeDestroy", e.getMessage());
         }
         try {
           region.put("d", "d");
           fail("Should have gotten a cache writer exception");
         } catch(CacheWriterException e) {
-          Assert.assertEquals("beforeCreate", e.getMessage());
+          assertEquals("beforeCreate", e.getMessage());
         }
         try {
           region.clear();
           fail("Should have gotten a cache writer exception");
         } catch(CacheWriterException e) {
-          Assert.assertEquals("beforeRegionClear", e.getMessage());
+          assertEquals("beforeRegionClear", e.getMessage());
         }
         try {
           region.destroyRegion();
           fail("Should have gotten a cache writer exception");
         } catch(CacheWriterException e) {
-          Assert.assertEquals("beforeRegionDestroy", e.getMessage());
+          assertEquals("beforeRegionDestroy", e.getMessage());
         }
       }
     });
@@ -226,10 +225,10 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
     server.invoke(new SerializableRunnable() {
       public void run() {
         Region region = getRootRegion(regionName);
-        Assert.assertEquals("a", region.get("a"));
-        Assert.assertEquals("b", region.get("b"));
-        Assert.assertEquals(null, region.get("c"));
-        Assert.assertEquals(null, region.get("d"));
+        assertEquals("a", region.get("a"));
+        assertEquals("b", region.get("b"));
+        assertEquals(null, region.get("c"));
+        assertEquals(null, region.get("d"));
       }
     });
   }
@@ -244,7 +243,8 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
    * 3 server
    * 4 loader
    */
-  public void testPoolLoadAndPeer() {
+  @Test
+  public void testPoolLoadAndPeer() throws Exception {
     final String regionName = this.getName();
     final Host host = Host.getHost(0);
     VM server = host.getVM(0);
@@ -264,11 +264,7 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
         return null;
       }
     });
-    
-    
-    
-    
-    
+
     SerializableCallable createClient1 = new SerializableCallable() {
       public Object call() {
         //Make sure we get a distributed system that has the locator
@@ -289,8 +285,7 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
       }
     };
     client1.invoke(createClient1);
-    
-    
+
     SerializableCallable createClient2 = new SerializableCallable() {
       public Object call() {
         //Make sure we get a distributed system that has the locator
@@ -311,8 +306,6 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
       }
     };
     client2.invoke(createClient2);
-    
-    
 
     //We need to test what happens when
     //we do a load in client1 in each of these cases:
@@ -325,7 +318,6 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
     // f                                         X                X               client1
     // g                                                          X               client2 (loader does a netSearch)
     // h                                                                           client1 loader
-    
 
     //Setup scenarios
     client1.invoke(new SerializableRunnable() {
@@ -341,9 +333,9 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
     client2.invoke(new SerializableRunnable() {
       public void run() {
         Region region = getRootRegion(regionName);
-        Assert.assertEquals("client1-c", region.get("c"));
+        assertEquals("client1-c", region.get("c"));
         region.put("d", "client2-d");
-        Assert.assertEquals("client1-f", region.get("f"));
+        assertEquals("client1-f", region.get("f"));
         region.put("g", "client2-g");
       }
     });
@@ -362,48 +354,47 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
     client1.invoke(new SerializableRunnable() {
       public void run() {
         Region region = getRootRegion(regionName);
-        Assert.assertEquals("server-a", region.get("a"));
-        Assert.assertEquals("client1-b", region.get("b"));
-        Assert.assertEquals("client1-c", region.get("c"));
-        Assert.assertEquals("client2-d", region.get("d"));
-        Assert.assertEquals("client1-e", region.get("e"));
-        Assert.assertEquals("client1-f", region.get("f"));
-        Assert.assertEquals("client2-g", region.get("g"));
-        Assert.assertEquals("loaded1-h", region.get("h"));
+        assertEquals("server-a", region.get("a"));
+        assertEquals("client1-b", region.get("b"));
+        assertEquals("client1-c", region.get("c"));
+        assertEquals("client2-d", region.get("d"));
+        assertEquals("client1-e", region.get("e"));
+        assertEquals("client1-f", region.get("f"));
+        assertEquals("client2-g", region.get("g"));
+        assertEquals("loaded1-h", region.get("h"));
       }
     });
     
     server.invoke(new SerializableRunnable() {
       public void run() {
         Region region = getRootRegion(regionName);
-        Assert.assertEquals("server-a", region.get("a"));
-        Assert.assertEquals("client1-b", region.get("b"));
-        Assert.assertEquals("client1-c", region.get("c"));
-        Assert.assertEquals("client2-d", region.get("d"));
-        Assert.assertEquals(null, region.get("e"));
-        Assert.assertEquals(null, region.get("f"));
+        assertEquals("server-a", region.get("a"));
+        assertEquals("client1-b", region.get("b"));
+        assertEquals("client1-c", region.get("c"));
+        assertEquals("client2-d", region.get("d"));
+        assertEquals(null, region.get("e"));
+        assertEquals(null, region.get("f"));
         
         //dsmith - This result seems somewhat suspect. client1 did a net load
         //which found a value in client2, but it never propagated that result
         //to the server. After talking with Darrel we decided to keep it this
         //way for now.
-        Assert.assertEquals(null, region.get("g"));
-        Assert.assertEquals("loaded1-h", region.get("h"));
+        assertEquals(null, region.get("g"));
+        assertEquals("loaded1-h", region.get("h"));
       }
     });
   }
   
-  protected void startBridgeServer(int port, boolean notifyBySubscription)
-  throws IOException {
-
-  Cache cache = getCache();
-  CacheServer bridge = cache.addCacheServer();
-  bridge.setPort(port);
-  bridge.setNotifyBySubscription(notifyBySubscription);
-  bridge.start();
-  bridgeServerPort = bridge.getPort();
-}
+  private void startBridgeServer(int port, boolean notifyBySubscription) throws IOException {
+    Cache cache = getCache();
+    CacheServer bridge = cache.addCacheServer();
+    bridge.setPort(port);
+    bridge.setNotifyBySubscription(notifyBySubscription);
+    bridge.start();
+    bridgeServerPort = bridge.getPort();
+  }
 
+  @Override
   public Properties getDistributedSystemProperties() {
     Properties p = new Properties();
     if(!useLocator) {
@@ -413,45 +404,49 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
     return p;
   }
   
-  public static class MyCacheWriter extends CacheWriterAdapter {
+  private static class MyCacheWriter extends CacheWriterAdapter {
+
     protected boolean throwException = false;
 
+    @Override
     public void beforeCreate(EntryEvent event) throws CacheWriterException {
-      if(throwException) {
+      if (throwException) {
         throw new CacheWriterException("beforeCreate");
       }
     }
 
+    @Override
     public void beforeDestroy(EntryEvent event) throws CacheWriterException {
-      if(throwException) {
+      if (throwException) {
         throw new CacheWriterException("beforeDestroy");
       }
     }
 
+    @Override
     public void beforeRegionClear(RegionEvent event)
         throws CacheWriterException {
-      if(throwException) {
+      if (throwException) {
         throw new CacheWriterException("beforeRegionClear");
       }
     }
 
+    @Override
     public void beforeRegionDestroy(RegionEvent event)
         throws CacheWriterException {
-      if(throwException) {
+      if (throwException) {
         throw new CacheWriterException("beforeRegionDestroy");
       }
     }
 
+    @Override
     public void beforeUpdate(EntryEvent event) throws CacheWriterException {
-      if(throwException) {
+      if (throwException) {
         throw new CacheWriterException("beforeUpdate");
       }
     }
-
-    
   }
   
-  public static class MyCacheLoader implements CacheLoader {
+  private static class MyCacheLoader implements CacheLoader {
     
     private String message;
 
@@ -459,6 +454,7 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
       this.message = message;
     }
 
+    @Override
     public Object load(LoaderHelper helper) throws CacheLoaderException {
       if(helper.getRegion().getAttributes().getScope().equals(Scope.DISTRIBUTED_ACK)) {
         System.err.println("Doing a net search for " + helper.getKey());
@@ -473,10 +469,8 @@ public class ConnectionPoolAndLoaderDUnitTest  extends CacheTestCase {
       return message + "-" + key;
     }
 
+    @Override
     public void close() {
     }
   }
-  
-  
-
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAutoDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAutoDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAutoDUnitTest.java
index 3b43ab8..74c3037 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAutoDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolAutoDUnitTest.java
@@ -19,17 +19,16 @@ package com.gemstone.gemfire.cache;
 import com.gemstone.gemfire.cache30.ClientServerTestCase;
 import com.gemstone.gemfire.test.dunit.Invoke;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 import static org.junit.runners.MethodSorters.*;
 import org.junit.FixMethodOrder;
+import org.junit.experimental.categories.Category;
 
 @FixMethodOrder(NAME_ASCENDING)
+@Category(DistributedTest.class)
 public class ConnectionPoolAutoDUnitTest extends ConnectionPoolDUnitTest {
 
-  public ConnectionPoolAutoDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   protected final void postSetUpConnectionPoolDUnitTest() throws Exception {
     ClientServerTestCase.AUTO_LOAD_BALANCE = true;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
index b72734b..3ae6cf6 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/ConnectionPoolDUnitTest.java
@@ -16,7 +16,8 @@
  */
 package com.gemstone.gemfire.cache;
 
-import static org.junit.runners.MethodSorters.NAME_ASCENDING;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+import static org.junit.runners.MethodSorters.*;
 
 import java.io.IOException;
 import java.io.Serializable;
@@ -28,9 +29,9 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 
-import junit.framework.AssertionFailedError;
-
 import org.junit.FixMethodOrder;
+import org.junit.Ignore;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import com.gemstone.gemfire.CancelException;
@@ -42,10 +43,9 @@ import com.gemstone.gemfire.cache.client.internal.Endpoint;
 import com.gemstone.gemfire.cache.client.internal.PoolImpl;
 import com.gemstone.gemfire.cache.server.CacheServer;
 import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.cache30.ClientServerTestCase;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.cache30.CertifiableTestCacheListener;
+import com.gemstone.gemfire.cache30.ClientServerTestCase;
 import com.gemstone.gemfire.cache30.TestCacheLoader;
 import com.gemstone.gemfire.cache30.TestCacheWriter;
 import com.gemstone.gemfire.distributed.DistributedMember;
@@ -62,7 +62,6 @@ import com.gemstone.gemfire.internal.cache.tier.sockets.ClientProxyMembershipID;
 import com.gemstone.gemfire.internal.logging.InternalLogWriter;
 import com.gemstone.gemfire.internal.logging.LocalLogWriter;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.Invoke;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
@@ -71,6 +70,8 @@ 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.WaitCriterion;
+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;
 
 /**
@@ -80,14 +81,13 @@ import com.gemstone.gemfire.test.junit.categories.FlakyTest;
  * (this happens in the controller VM). the client then spins up
  * 10 different threads and issues gets on keys. The server data loader returns the
  * data to the client.
+ *
  * Test uses Groboutils TestRunnable objects to achieve multi threading behavior
  * in the test.
- *
  */
+@Category(DistributedTest.class)
 @FixMethodOrder(NAME_ASCENDING)
-public class ConnectionPoolDUnitTest extends CacheTestCase {
-
-  private static final long serialVersionUID = 1L;
+public class ConnectionPoolDUnitTest extends JUnit4CacheTestCase {
 
   /** The port on which the bridge server was started in this VM */
   private static int bridgeServerPort;
@@ -104,10 +104,6 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
   protected final static int TYPE_INVALIDATE = 2;
   protected final static int TYPE_DESTROY = 3;
 
-  public ConnectionPoolDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     // avoid IllegalStateException from HandShake by connecting all vms to
@@ -149,9 +145,11 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     }
     return result;
   }
+
   protected static TestCacheWriter getTestWriter(Region r) {
     return (TestCacheWriter)r.getAttributes().getCacheWriter();
   }
+
   /**
    * Create a bridge server on the given port without starting it.
    *
@@ -242,8 +240,6 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     return ds;
   }
 
-  
-  
   /**
    * Returns region attributes for a <code>LOCAL</code> region
    */
@@ -337,9 +333,6 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     }
   }
 
-  
-
-
   /**
    * Create a fake EntryEvent that returns the provided region for {@link CacheEvent#getRegion()}
    * and returns {@link com.gemstone.gemfire.cache.Operation#LOCAL_LOAD_CREATE} for {@link CacheEvent#getOperation()}
@@ -402,6 +395,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
                  + " but endpoints=" + outOfBalanceReport(pool),
                  true, balanced(pool, expectedConsPerServer));
   }
+
   protected boolean balanced(PoolImpl pool, int expectedConsPerServer) {
     Iterator it = pool.getEndpointMap().values().iterator();
     while (it.hasNext()) {
@@ -465,6 +459,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
   /**
    * Tests that the callback argument is sent to the server
    */
+  @Test
   public void test001CallbackArg() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -564,6 +559,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    * Tests that consecutive puts have the callback assigned
    * appropriately.
    */
+  @Test
   public void test002CallbackArg2() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -657,13 +653,13 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     });
   }
 
-  
   /**
    * Tests for bug 36684 by having two bridge servers with cacheloaders that should always return
    * a value and one client connected to each server reading values. If the bug exists, the
    * clients will get null sometimes. 
    * @throws InterruptedException 
    */
+  @Test
   public void test003Bug36684() throws CacheException, InterruptedException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -756,11 +752,11 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
       com.gemstone.gemfire.test.dunit.Assert.fail("Error occured in vm3", inv3.getException());
     }
   }
-  
 
   /**
    * Test for client connection loss with CacheLoader Exception on the server.
    */
+  @Test
   public void test004ForCacheLoaderException() throws CacheException, InterruptedException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -854,7 +850,6 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     
   }
 
-
   protected void validateDS() {
     List l = InternalDistributedSystem.getExistingSystems();
     if (l.size() > 1) {
@@ -868,12 +863,12 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     assertEquals(1, l.size());
   }
   
-
   /**
    * Tests the basic operations of the {@link Pool}
    *
    * @since GemFire 3.5
    */
+  @Test
   public void test006Pool() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -981,13 +976,11 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
         }
     });
   }
-  
-  
-    
-  
+
   /**
    * Tests the BridgeServer failover (bug 31832).
    */
+  @Test
   public void test007BridgeServerFailoverCnx1() throws CacheException {
     disconnectAllFromDS();
     basicTestBridgeServerFailover(1);
@@ -995,6 +988,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
   /**
    * Test BridgeServer failover with connectionsPerServer set to 0
    */
+  @Test
   public void test008BridgeServerFailoverCnx0() throws CacheException {
     basicTestBridgeServerFailover(0);
   }
@@ -1079,7 +1073,6 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
         }
       });
 
-
     SerializableRunnable verify1Server =
       new CacheSerializableRunnable("verify1Server") {
         public void run2() throws CacheException {
@@ -1165,7 +1158,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
 
     com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("FIXME: this thread does not terminate"); // FIXME
 //    // Verify that no exception has occurred in the putter thread
-//    DistributedTestCase.join(putAI, 5 * 60 * 1000, getLogWriter());
+//    join(putAI, 5 * 60 * 1000, getLogWriter());
 //    //assertTrue("Exception occurred while invoking " + putAI, !putAI.exceptionOccurred());
 //    if (putAI.exceptionOccurred()) {
 //      fail("While putting entries: ", putAI.getException());
@@ -1182,13 +1175,13 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     // Stop the last cache server
     vm1.invoke(stopCacheServer);
   }
-  
 
   /**
    * Make sure cnx lifetime expiration working on thread local cnxs.
    * @author darrel
    */
   @Category(FlakyTest.class) // GEODE-1197: random ports, BindException, FixMethodOrder, expiration, time sensitive, waitForCriterion, async actions
+  @Test
   public void test009LifetimeExpireOnTL() throws CacheException {
     basicTestLifetimeExpire(true);
   }
@@ -1197,6 +1190,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    * Make sure cnx lifetime expiration working on thread local cnxs.
    * @author darrel
    */
+  @Test
   public void test010LifetimeExpireOnPoolCnx() throws CacheException {
     basicTestLifetimeExpire(false);
   }
@@ -1402,7 +1396,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
             };
             try {
               Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
-            } catch (AssertionFailedError e) {
+            } catch (AssertionError e) {
 //              dumpStack();
               throw e;
             }
@@ -1473,6 +1467,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    *
    * @since GemFire 3.5
    */
+  @Test
   public void test011PoolCreate() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -1555,6 +1550,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    *
    * @since GemFire 3.5
    */
+  @Test
   public void test012PoolPut() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -1669,11 +1665,13 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
         }
     });
   }
-    /**
+
+  /**
    * Tests the put operation of the {@link Pool}
    *
    * @since GemFire 3.5
    */
+  @Test
   public void test013PoolPutNoDeserialize() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -1794,6 +1792,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    *
    * @since GemFire 3.5
    */
+  @Test
   public void test014InvalidateAndDestroyPropagation() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -1892,7 +1891,6 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
         }
       });
 
-
     vm2.invoke(new CacheSerializableRunnable("Validate original and destroy") {
         public void run2() throws CacheException {
           Region region = getRootRegion().getSubregion(name);
@@ -1986,12 +1984,14 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
         }
     });
   }
+
   /**
    * Tests that invalidates and destroys are propagated to {@link Pool}s
    * correctly to DataPolicy.EMPTY + InterestPolicy.ALL
    *
    * @since GemFire 5.0
    */
+  @Test
   public void test015InvalidateAndDestroyToEmptyAllPropagation() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -2106,7 +2106,6 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
         }
       });
 
-
     vm2.invoke(new CacheSerializableRunnable("Validate original and destroy") {
           public void run2() throws CacheException {
           Region region = getRootRegion().getSubregion(name);
@@ -2222,6 +2221,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    *
    * @since GemFire 5.0
    */
+  @Test
   public void test016InvalidateAndDestroyToEmptyCCPropagation() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -2391,10 +2391,10 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     });
   }
 
-
   /**
    * Tests interest key registration.
    */
+  @Test
   public void test017ExpireDestroyHasEntryInCallback() throws CacheException {
     disconnectAllFromDS();
     final String name = this.getName();
@@ -2561,10 +2561,11 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     return ret;
   }
 
-   /**
+  /**
    * Tests that updates are not sent to VMs that did not ask for
    * them.
    */
+  @Test
   public void test018OnlyRequestedUpdates() throws Exception {
     final String name1 = this.getName() + "-1";
     final String name2 = this.getName() + "-2";
@@ -2706,6 +2707,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
   /**
    * Tests interest key registration.
    */
+  @Test
   public void test019InterestKeyRegistration() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -2949,6 +2951,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
   /**
    * Tests interest list registration.
    */
+  @Test
   public void test020InterestListRegistration() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -3072,9 +3075,6 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     });
   }
 
-
-  
-
   protected class ConnectionPoolDUnitTestSerializable2 implements java.io.Serializable
   {
     protected ConnectionPoolDUnitTestSerializable2(String key)
@@ -3160,10 +3160,10 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
 //          fail("interrupted");
 //        }
 //        catch(ServerConnectivityException sce) {
-//            DistributedTestCase.fail("While getting value for ACK region", sce);
+//            fail("While getting value for ACK region", sce);
 //        }
 //        catch(TimeoutException te) {
-//          DistributedTestCase.fail("While getting value for ACK region", te);
+//          fail("While getting value for ACK region", te);
 //        }
 //      }
 //      assertTrue(pi.getConnectedServerCount() >= 1);
@@ -3193,10 +3193,10 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
 //          fail("interrupted");
 //        }
 //        catch(ServerConnectivityException sce) {
-//            DistributedTestCase.fail("While getting value for ACK region", sce);
+//            fail("While getting value for ACK region", sce);
 //        }
 //        catch(TimeoutException te) {
-//          DistributedTestCase.fail("While getting value for ACK region", te);
+//          fail("While getting value for ACK region", te);
 //        }
 //      }
 //      assertTrue(pi.getConnectedServerCount() >= 1);
@@ -3219,6 +3219,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     Cache z = getCache();
     return z;
   }
+
   /**
    * A handy method to poll for arrival of non-null/non-invalid entries
    * @param r the Region to poll
@@ -3268,6 +3269,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
 
     public void init(Properties props)  {}
   }
+
   /**
    * Create a server that has a value for every key queried and a unique
    * key/value in the specified Region that uniquely identifies each instance.
@@ -3305,7 +3307,8 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     });
   }
 
-//test for bug 35884
+  //test for bug 35884
+  @Test
   public void test021ClientGetOfInvalidServerEntry() throws CacheException {
     final String regionName1 = this.getName() + "-1";
 
@@ -3384,7 +3387,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
 
   }
 
-  
+  @Test
   public void test022ClientRegisterUnregisterRequests() throws CacheException {
     final String regionName1 = this.getName() + "-1";
 
@@ -3509,6 +3512,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    *
    * @since GemFire 5.0.2
    */
+  @Test
   public void test023ContainsKeyOnServer() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -3598,7 +3602,6 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     });
   }
 
-  
   /**
    * Tests that invoking {@link Region#create} with a
    * <code>null</code> value does the right thing with the {@link
@@ -3606,6 +3609,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    *
    * @since GemFire 3.5
    */
+  @Test
   public void test024CreateNullValue() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -3711,13 +3715,12 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     });
   }
 
-  
-  
   /**
    * Tests that a {@link Region#localDestroy} is not propagated to the
    * server and that a {@link Region#destroy} is.  Also makes sure
    * that callback arguments are passed correctly.
    */
+  @Test
   public void test025Destroy() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -3879,7 +3882,9 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    * to the server and that a {@link Region#destroyRegion} is.  Also
    * makes sure that callback arguments are passed correctly.
    */
-  public void todo_testDestroyRegion() throws CacheException {
+  @Ignore("TODO")
+  @Test
+  public void testDestroyRegion() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
@@ -3993,11 +3998,11 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
 
   }
 
-  
   /**
    * Tests interest list registration with callback arg with DataPolicy.EMPTY
    * and InterestPolicy.ALL
    */
+  @Test
   public void test026DPEmptyInterestListRegistrationWithCallbackArg() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -4167,10 +4172,12 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
         }
     });
   }
+
   /**
    * Tests interest list registration with callback arg with DataPolicy.EMPTY
    * and InterestPolicy.CACHE_CONTENT
    */
+  @Test
   public void test027DPEmptyCCInterestListRegistrationWithCallbackArg() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -4317,6 +4324,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    *
    * @throws Exception
    */
+  @Test
   public void test028DynamicRegionCreation() throws Exception {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -4332,9 +4340,9 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     final String k3 = name + "-key3";
     final String v3 = name + "-val3";
 
-    client1.invoke(() -> DistributedTestCase.disconnectFromDS());
-    srv1.invoke(() -> DistributedTestCase.disconnectFromDS());
-    srv2.invoke(() -> DistributedTestCase.disconnectFromDS());
+    client1.invoke(() -> disconnectFromDS());
+    srv1.invoke(() -> disconnectFromDS());
+    srv2.invoke(() -> disconnectFromDS());
     try {
       // setup servers
       CacheSerializableRunnable ccs = new CacheSerializableRunnable("Create Cache Server") {
@@ -4499,7 +4507,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
               assertNotNull(getCache().getRegion(name + Region.SEPARATOR + dynFromClientName));
               break;
             }
-            catch (AssertionFailedError e) {
+            catch (AssertionError e) {
               if (System.currentTimeMillis() > end) {
                 throw e;
               }
@@ -4579,7 +4587,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
               assertNotNull(getCache().getRegion(name + Region.SEPARATOR + dynFromServerName));
               break;
             }
-            catch (junit.framework.AssertionFailedError e) {
+            catch (AssertionError e) {
               if (System.currentTimeMillis() > end) {
                 throw e;
               } else {
@@ -4642,9 +4650,9 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
         }
       });
     } finally {
-      client1.invoke(() -> DistributedTestCase.disconnectFromDS()); // clean-up loner
-      srv1.invoke(() -> DistributedTestCase.disconnectFromDS());
-      srv2.invoke(() -> DistributedTestCase.disconnectFromDS());
+      client1.invoke(() -> disconnectFromDS()); // clean-up loner
+      srv1.invoke(() -> disconnectFromDS());
+      srv2.invoke(() -> disconnectFromDS());
     }
   }
   
@@ -4652,6 +4660,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
   /**
    * Test for bug 36279
    */
+  @Test
   public void test029EmptyByteArray() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -4744,10 +4753,10 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
       });
   }
 
-  
   /**
    * Tests interest list registration with callback arg
    */
+  @Test
   public void test030InterestListRegistrationWithCallbackArg() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -4899,12 +4908,12 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     });
   }
 
-  
   /**
    * Tests the keySetOnServer operation of the {@link Pool}
    *
    * @since GemFire 5.0.2
    */
+  @Test
   public void test031KeySetOnServer() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -5067,6 +5076,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    * Tests that creating, putting and getting a non-serializable key or value
    * throws the correct (NotSerializableException) exception.
    */
+  @Test
   public void test033NotSerializableException() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -5178,6 +5188,7 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
    * - non-originators of updates are sent invalidates
    * - multiple invalidates are not sent for the same update
    */
+  @Test
   public void test034NotifyAllUpdates() throws CacheException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -5498,10 +5509,10 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
 //      HashSet destroyedRoots = new HashSet();
       try {
         client1.invoke(() -> CacheTestCase.remoteTearDown());
-        client1.invoke(() -> DistributedTestCase.disconnectFromDS());
+        client1.invoke(() -> disconnectFromDS());
       } finally {
         client2.invoke(() -> CacheTestCase.remoteTearDown());
-        client2.invoke(() -> DistributedTestCase.disconnectFromDS());
+        client2.invoke(() -> disconnectFromDS());
       }
     }
   }
@@ -5581,10 +5592,10 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
 //    } finally {
 //      try {
 //        client1.invoke(() -> CacheTestCase.remoteTearDown());
-//        client1.invoke(() -> DistributedTestCase.disconnectFromDS());
+//        client1.invoke(() -> disconnectFromDS());
 //      } finally {
 //        client2.invoke(() -> CacheTestCase.remoteTearDown());
-//        client2.invoke(() -> DistributedTestCase.disconnectFromDS());
+//        client2.invoke(() -> disconnectFromDS());
 //      }
 //    }
 //  }
@@ -5633,10 +5644,12 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
       delay();
     }
   }
+
   /**
    * Make sure a tx done in a server on an empty region gets sent
    * to clients who have registered interest.
    */
+  @Test
   public void test037Bug39526part1() throws CacheException, InterruptedException {
     final String name = this.getName();
     final Host host = Host.getHost(0);
@@ -5731,10 +5744,12 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     getSystem().getLogWriter().info("before confirmCommitOnClient");
     vm1.invoke(validateClient);
   }
+
   /**
    * Now confirm that a tx done in a peer of a server (the server having
    * an empty region and wanting all events) sends the tx to its clients
    */
+  @Test
   public void test038Bug39526part2() throws CacheException, InterruptedException {
     disconnectAllFromDS();
     final String name = this.getName();
@@ -5862,5 +5877,3 @@ public class ConnectionPoolDUnitTest extends CacheTestCase {
     }
   }
 }
-
-

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java
index 8f82edd..fdefbfe 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache/client/ClientServerRegisterInterestsDUnitTest.java
@@ -16,12 +16,8 @@
  */
 package com.gemstone.gemfire.cache.client;
 
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
-import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.test.dunit.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
 
 import java.io.IOException;
 import java.net.UnknownHostException;
@@ -29,16 +25,36 @@ import java.util.Stack;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+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.DataPolicy;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.InterestResultPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.server.CacheServer;
+import com.gemstone.gemfire.cache.server.ClientSubscriptionConfig;
+import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
+import com.gemstone.gemfire.internal.AvailablePortHelper;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+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.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * The ClientServerRegisterInterestsDUnitTest class is a test suite of test cases testing the interaction between a
  * client and a server in a Register Interests scenario.
  *
- * @see com.gemstone.gemfire.test.dunit.DistributedTestCase
  * @since GemFire 8.0
  */
-public class ClientServerRegisterInterestsDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class ClientServerRegisterInterestsDUnitTest extends JUnit4DistributedTestCase {
 
   protected static final long WAIT_TIME_MILLISECONDS = TimeUnit.SECONDS.toMillis(5);
 
@@ -50,10 +66,6 @@ public class ClientServerRegisterInterestsDUnitTest extends DistributedTestCase
 
   private VM gemfireServerVm;
 
-  public ClientServerRegisterInterestsDUnitTest(final String testName) {
-    super(testName);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     disconnectAllFromDS();
@@ -197,6 +209,7 @@ public class ClientServerRegisterInterestsDUnitTest extends DistributedTestCase
     }
   }
 
+  @Test
   public void testClientRegisterInterests() {
     ClientCache clientCache = setupGemFireClientCache();
 



Mime
View raw message