geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hiteshkhame...@apache.org
Subject [17/94] [abbrv] [partial] incubator-geode git commit: GEODE-837: update tests from JUnit3 to JUnit4
Date Wed, 15 Jun 2016 00:07:33 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
index 71c15d9..0f5045c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36829DUnitTest.java
@@ -16,6 +16,14 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
+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.CacheException;
 import com.gemstone.gemfire.cache.InterestResultPolicy;
 import com.gemstone.gemfire.cache.Region;
@@ -25,13 +33,15 @@ import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.ServerOperationException;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
-import com.gemstone.gemfire.test.dunit.*;
+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 java.util.Properties;
+@Category(DistributedTest.class)
+public class Bug36829DUnitTest extends JUnit4DistributedTestCase {
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class Bug36829DUnitTest extends DistributedTestCase {
   private VM serverVM;
 
   private VM ClientVM;
@@ -40,10 +50,6 @@ public class Bug36829DUnitTest extends DistributedTestCase {
 
   private int PORT;
 
-  public Bug36829DUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     Host host = Host.getHost(0);
@@ -53,8 +59,8 @@ public class Bug36829DUnitTest extends DistributedTestCase {
     CacheServerTestUtil.disableShufflingOfEndpoints();
   }
 
+  @Test
   public void testBug36829() {
-
     // Step 1: Starting the servers
     final String durableClientId = getName() + "_client";
 
@@ -80,64 +86,36 @@ public class Bug36829DUnitTest extends DistributedTestCase {
     // If exception is not thrown then the test fails.
     this.ClientVM.invoke(() -> Bug36829DUnitTest.registerKey( "Key1" ));
 
-
-    // creating REgion on the Server
+    // creating Region on the Server
 /*    this.serverVM.invoke(() -> CacheServerTestUtil.createRegion( regionName ));
      // should be successful.
     this.ClientVM.invoke(() -> Bug36829DUnitTest.registerKeyAfterRegionCreation( "Key1" ));*/
 
-
     // Stop the durable client
     this.ClientVM.invoke(() -> CacheServerTestUtil.closeCache());
 
     // Stop server 1
     this.serverVM.invoke(() -> CacheServerTestUtil.closeCache());
-
   }
 
-  
   private static void registerKey(String key) throws Exception {
+    // Get the region
+    Region region = CacheServerTestUtil.getCache().getRegion(Bug36829DUnitTest.class.getName() + "_region");
+    assertNotNull(region);
     try {
-      // Get the region
-      Region region = CacheServerTestUtil.getCache().getRegion(
-          Bug36829DUnitTest.class.getName() + "_region");
-      // Region region =
-      // CacheServerTestUtil.getCache().getRegion(regionName);
-      assertNotNull(region);
-      try {
-        region.registerInterest(key, InterestResultPolicy.NONE);
-        fail("expected ServerOperationException");
-      }
-      catch (ServerOperationException expected) {
-      }
+      region.registerInterest(key, InterestResultPolicy.NONE);
+      fail("expected ServerOperationException");
     }
-    catch (Exception ex) {
-      Assert.fail("failed while registering interest in registerKey function", ex);
+    catch (ServerOperationException expected) {
     }
   }
 
-  private static void registerKeyAfterRegionCreation(String key)
-      throws Exception {
-    try {
-      // Get the region
-      Region region = CacheServerTestUtil.getCache().getRegion(
-          Bug36829DUnitTest.class.getName() + "_region");
-      // Region region =
-      // CacheServerTestUtil.getCache().getRegion(regionName);
-      assertNotNull(region);
-      try {
-        region.registerInterest(key, InterestResultPolicy.NONE);
-      }
-      catch (Exception e) {
-        fail("unexpected Exception while registerInterest inspite of region present on the server."
-            + " Details of Exception:" + "\ne.getCause:" + e.getCause()
-            + "\ne.getMessage:" + e.getMessage());
-      }
-    }
+  private static void registerKeyAfterRegionCreation(String key) throws Exception {
+    // Get the region
+    Region region = CacheServerTestUtil.getCache().getRegion(Bug36829DUnitTest.class.getName() + "_region");
+    assertNotNull(region);
 
-    catch (Exception ex) {
-      Assert.fail("failed while registering interest in registerKey function", ex);
-    }
+    region.registerInterest(key, InterestResultPolicy.NONE);
   }
 
   private Pool getClientPool(String host, int server1Port,

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java
index ba57fb9..4a05668 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug36995DUnitTest.java
@@ -16,6 +16,15 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.AttributesFactory;
 import com.gemstone.gemfire.cache.Cache;
 import com.gemstone.gemfire.cache.CacheFactory;
@@ -26,16 +35,18 @@ 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.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class Bug36995DUnitTest extends JUnit4DistributedTestCase {
 
-import java.util.Iterator;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-
-public class Bug36995DUnitTest extends DistributedTestCase
-{
   private static Cache cache = null;
 
   private static VM server1 = null;
@@ -46,12 +57,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
 
   protected static PoolImpl pool = null;
 
-  private static final String regionName = "Bug36995DUnitTest_Region";
-
-  /** constructor */
-  public Bug36995DUnitTest(String name) {
-    super(name);
-  }
+  private static final String regionName = Bug36995DUnitTest.class.getSimpleName() + "_Region";
 
   @Override
   public final void postSetUp() throws Exception {
@@ -77,7 +83,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
       Properties props = new Properties();
       props.setProperty(MCAST_PORT, "0");
       props.setProperty(LOCATORS, "");
-      new Bug36995DUnitTest("temp").createCache(props);
+      new Bug36995DUnitTest().createCache(props);
       PoolImpl p = (PoolImpl)PoolManager.createFactory()
         .addServer(host, port1)
         .addServer(host, port2)
@@ -95,7 +101,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
       pool = p;
     }
     catch (Exception e) {
-      fail("Test failed due to " + e);
+      fail("Test failed due to ", e);
     }
   }
 
@@ -106,7 +112,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
       Properties props = new Properties();
       props.setProperty(MCAST_PORT, "0");
       props.setProperty(LOCATORS, "");
-      new Bug36995DUnitTest("temp").createCache(props);
+      new Bug36995DUnitTest().createCache(props);
       PoolImpl p = (PoolImpl)PoolManager.createFactory()
         .addServer(host, port1)
         .addServer(host, port2)
@@ -119,13 +125,13 @@ public class Bug36995DUnitTest extends DistributedTestCase
       pool = p;
     }
     catch (Exception e) {
-      fail("Test failed due to " + e);
+      fail("Test failed due to ", e);
     }
   }
 
   public static Integer createServerCache() throws Exception
   {
-    new Bug36995DUnitTest("temp").createCache(new Properties());
+    new Bug36995DUnitTest().createCache(new Properties());
     // no region is created on server 
     int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
     CacheServer server1 = cache.addCacheServer();
@@ -153,6 +159,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
   /**
    * Tests messageTrackingTimeout is set correctly to default or not if not specified
    */
+  @Test
   public void testBug36995_Default()
   {
     Integer port1 = ((Integer)server1.invoke(() -> Bug36995DUnitTest.createServerCache()));
@@ -168,6 +175,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
   /**
    * Tests messageTrackingTimeout is set correctly as pwr user specified
    */
+  @Test
   public void testBug36995_UserSpecified()
   {
     //work around GEODE-507
@@ -183,6 +191,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
   /**
    * BugTest for 36526 : 
    */
+  @Test
   public void testBug36526()
   {
     Integer port1 = ((Integer)server1.invoke(() -> Bug36995DUnitTest.createServerCache()));
@@ -205,7 +214,7 @@ public class Bug36995DUnitTest extends DistributedTestCase
       }
     }
     catch (Exception e) {
-      fail("failed while stopServer()" + e);
+      fail("failed while stopServer()", e);
     }
   }
 
@@ -222,30 +231,5 @@ public class Bug36995DUnitTest extends DistributedTestCase
       }
     };
     Wait.waitForCriterion(wc, 3 * 60 * 1000, 1000, true);
-    
-    // we no longer verify dead servers; just live
-//     while (proxy.getDeadServers().size() != expectedDeadServers) { // wait
-//       // until
-//       // condition
-//       // is
-//       // met
-//       assertTrue(
-//           "Waited over "
-//               + maxWaitTime
-//               + "for dead servers to become : "
-//               + expectedDeadServers
-//               + " This issue can occur on Solaris as DSM thread get stuck in connectForServer() call, and hence not recovering any newly started server This may be beacuase of tcp_ip_abort_cinterval kernal level property on solaris which has 3 minutes as a default value",
-//           (System.currentTimeMillis() - start) < maxWaitTime);
-//       try {
-//         Thread.yield();
-//         synchronized (delayLock) {
-//           delayLock.wait(2000);
-//         }
-//       }
-//       catch (InterruptedException ie) {
-//         fail("Interrupted while waiting ", ie);
-//       }
-//     }
-//     start = System.currentTimeMillis();
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java
index 2fe3d67..a132881 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37210DUnitTest.java
@@ -16,7 +16,23 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.Pool;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.server.CacheServer;
@@ -24,24 +40,22 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.cache.CacheServerImpl;
 import com.gemstone.gemfire.internal.cache.ha.HARegionQueue;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.Iterator;
-import java.util.Map;
-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.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+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;
 
 /**
  * This tests the fix for bug 73210. Reason for the bug was that HARegionQueue's
  * destroy was not being called on CacheClientProxy's closure. As a result,
  * stats were left open.
- * 
- * 
  */
-public class Bug37210DUnitTest extends DistributedTestCase
-{
+@Category(DistributedTest.class)
+public class Bug37210DUnitTest extends JUnit4DistributedTestCase {
+
   /** the cache server */
   VM server = null;
 
@@ -58,16 +72,6 @@ public class Bug37210DUnitTest extends DistributedTestCase
   private static final String REGION_NAME = "Bug37210DUnitTest_Region";
 
   /**
-   * Constructor
-   * 
-   * @param name -
-   *                name for this test instance
-   */
-  public Bug37210DUnitTest(String name) {
-    super(name);
-  }
-
-  /**
    * Creates the cache server and sets the port
    * 
    * @throws Exception -
@@ -133,6 +137,7 @@ public class Bug37210DUnitTest extends DistributedTestCase
    * @throws Exception -
    *                 thrown if any problem occurs in test execution
    */
+  @Test
   public void testHAStatsCleanup() throws Exception
   {
     Host host = Host.getHost(0);
@@ -159,7 +164,7 @@ public class Bug37210DUnitTest extends DistributedTestCase
    */
   public static Integer createServerCache() throws Exception
   {
-    Bug37210DUnitTest test = new Bug37210DUnitTest("temp");
+    Bug37210DUnitTest test = new Bug37210DUnitTest();
     Properties props = new Properties();
     cache = test.createCache(props);
     AttributesFactory factory = new AttributesFactory();
@@ -191,7 +196,7 @@ public class Bug37210DUnitTest extends DistributedTestCase
    */
   public static void createClientCache(String host, Integer port) throws Exception
   {
-    Bug37210DUnitTest test = new Bug37210DUnitTest("temp");
+    Bug37210DUnitTest test = new Bug37210DUnitTest();
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
index d6905d9..e35a172 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/Bug37805DUnitTest.java
@@ -16,6 +16,16 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.cache.CacheException;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.client.Pool;
@@ -24,26 +34,18 @@ import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 import com.gemstone.gemfire.internal.cache.HARegion;
 import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
 import com.gemstone.gemfire.test.dunit.VM;
-
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
- * 
- *
  * The test is written to verify that the rootRegion() in GemfireCache.java
  * doesn't return any metaRegions or HA Regions.
- * 
  */
-
-public class Bug37805DUnitTest extends DistributedTestCase{
+@Category(DistributedTest.class)
+public class Bug37805DUnitTest extends JUnit4DistributedTestCase {
 
   private VM server1VM;
 
@@ -53,10 +55,6 @@ public class Bug37805DUnitTest extends DistributedTestCase{
 
   private int PORT1;
 
-  public Bug37805DUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     Host host = Host.getHost(0);
@@ -73,6 +71,7 @@ public class Bug37805DUnitTest extends DistributedTestCase{
     CacheServerTestUtil.resetDisableShufflingOfEndpointsFlag();
   }
   
+  @Test
   public void testFunctionality() {
  // Step 1: Starting the servers
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java
index 893354c..bce5711 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerMaxConnectionsJUnitTest.java
@@ -16,9 +16,23 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
 import com.gemstone.gemfire.Statistics;
 import com.gemstone.gemfire.StatisticsType;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.NoAvailableServersException;
 import com.gemstone.gemfire.cache.client.PoolFactory;
 import com.gemstone.gemfire.cache.client.PoolManager;
@@ -30,48 +44,34 @@ import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.test.dunit.Wait;
 import com.gemstone.gemfire.test.dunit.WaitCriterion;
 import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.fail;
 
 /**
  * Make sure max-connections on cache server is enforced
- *
- *
  */
 @Category(IntegrationTest.class)
-public class CacheServerMaxConnectionsJUnitTest
+public class CacheServerMaxConnectionsJUnitTest {
+
+  private static final int MAX_CNXS = 100;
 
-{
+  private static int PORT;
+
+  /** name of the region created */
+  private final String regionName = "region1";
 
   /** connection proxy object for the client */
-  PoolImpl proxy = null;
+  private PoolImpl proxy = null;
 
   /** the distributed system instance for the test */
-  DistributedSystem system;
+  private DistributedSystem system;
 
   /** the cache instance for the test */
-  Cache cache;
-
-  /** name of the region created */
-  final String regionName = "region1";
-
-  private static int PORT;
+  private Cache cache;
 
   /**
    * Close the cache and disconnects from the distributed system
    */
   @After
-  public void tearDown() throws Exception
-
-  {
+  public void tearDown() throws Exception {
     this.cache.close();
     this.system.disconnect();
   }
@@ -85,59 +85,41 @@ public class CacheServerMaxConnectionsJUnitTest
 
   /**
    * Initializes proxy object and creates region for client
-   *
    */
-  private void createProxyAndRegionForClient()
-  {
-    try {
-      //props.setProperty("retryAttempts", "0");
-      PoolFactory pf = PoolManager.createFactory();
-      pf.addServer("localhost", PORT);
-      pf.setMinConnections(0);
-      pf.setPingInterval(10000);
-      pf.setThreadLocalConnections(true);
-      pf.setReadTimeout(2000);
-      pf.setSocketBufferSize(32768);
-      proxy = (PoolImpl)pf.create("junitPool");
-      AttributesFactory factory = new AttributesFactory();
-      factory.setScope(Scope.DISTRIBUTED_ACK);
-      factory.setPoolName("junitPool");
-      RegionAttributes attrs = factory.createRegionAttributes();
-      cache.createVMRegion(regionName, attrs);
-    }
-    catch (Exception ex) {
-      ex.printStackTrace();
-      fail("Failed to initialize client");
-    }
+  private void createProxyAndRegionForClient() {
+    //props.setProperty("retryAttempts", "0");
+    PoolFactory pf = PoolManager.createFactory();
+    pf.addServer("localhost", PORT);
+    pf.setMinConnections(0);
+    pf.setPingInterval(10000);
+    pf.setThreadLocalConnections(true);
+    pf.setReadTimeout(2000);
+    pf.setSocketBufferSize(32768);
+    proxy = (PoolImpl)pf.create("junitPool");
+    AttributesFactory factory = new AttributesFactory();
+    factory.setScope(Scope.DISTRIBUTED_ACK);
+    factory.setPoolName("junitPool");
+    RegionAttributes attrs = factory.createRegionAttributes();
+    cache.createVMRegion(regionName, attrs);
   }
 
-  private final static int MAX_CNXS = 100;
-
   /**
    * Creates and starts the server instance
-   *
    */
-  private int createServer()
-  {
+  private int createServer() throws IOException {
     CacheServer server = null;
-    try {
-      Properties p = new Properties();
-      // make it a loner
-      p.put(MCAST_PORT, "0");
-      p.put(LOCATORS, "");
-      this.system = DistributedSystem.connect(p);
-      this.cache = CacheFactory.create(system);
-      server = this.cache.addCacheServer();
-      int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
-      server.setMaxConnections(MAX_CNXS);
-      server.setMaxThreads(getMaxThreads());
-      server.setPort(port);
-      server.start();
-    }
-    catch (Exception e) {
-      e.printStackTrace();
-      fail("Failed to create server");
-    }
+    Properties p = new Properties();
+    // make it a loner
+    p.put(MCAST_PORT, "0");
+    p.put(LOCATORS, "");
+    this.system = DistributedSystem.connect(p);
+    this.cache = CacheFactory.create(system);
+    server = this.cache.addCacheServer();
+    int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
+    server.setMaxConnections(MAX_CNXS);
+    server.setMaxThreads(getMaxThreads());
+    server.setPort(port);
+    server.start();
     return server.getPort();
   }
 
@@ -153,8 +135,7 @@ public class CacheServerMaxConnectionsJUnitTest
    * the put that the Connection object used was new one.
    */
   @Test
-  public void testMaxCnxLimit() throws Exception
-  {
+  public void testMaxCnxLimit() throws Exception {
     PORT = createServer();
     createProxyAndRegionForClient();
     StatisticsType st = this.system.findType("CacheServerStats");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
index bae4e50..c131442 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTestUtil.java
@@ -17,9 +17,30 @@
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
 import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
 
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.client.*;
+import java.io.File;
+import java.net.InetSocketAddress;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Properties;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Declarable;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.client.ClientCache;
+import com.gemstone.gemfire.cache.client.ClientCacheFactory;
+import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
+import com.gemstone.gemfire.cache.client.Pool;
+import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.internal.PoolImpl;
 import com.gemstone.gemfire.cache.query.CqEvent;
 import com.gemstone.gemfire.cache.server.CacheServer;
@@ -31,25 +52,14 @@ import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
 import com.gemstone.gemfire.internal.cache.PoolFactoryImpl;
 import com.gemstone.gemfire.internal.cache.PoolFactoryImpl.PoolAttributes;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
 
-import java.io.File;
-import java.net.InetSocketAddress;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Properties;
+public class CacheServerTestUtil extends JUnit4DistributedTestCase {
 
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-/**
- *
- *
- */
-public class CacheServerTestUtil extends DistributedTestCase
-{
   private static Cache cache = null;
   private static IgnoredException expected;
 
@@ -60,17 +70,11 @@ public class CacheServerTestUtil extends DistributedTestCase
   protected final static int TYPE_INVALIDATE = 2;
   protected final static int TYPE_DESTROY = 3;
 
-  public CacheServerTestUtil(String name) {
-    super(name);
-  }
-
-  public static void createCacheClient(Pool poolAttr, String regionName)
-      throws Exception {
+  public static void createCacheClient(Pool poolAttr, String regionName) throws Exception {
     createCacheClient(poolAttr, regionName, getClientProperties(), Boolean.FALSE);
   }
 
-  public static void createCacheClient(Pool poolAttr, String regionName,
-      Properties dsProperties) throws Exception {
+  public static void createCacheClient(Pool poolAttr, String regionName, Properties dsProperties) throws Exception {
     createCacheClient(poolAttr, regionName, dsProperties, Boolean.FALSE);
   }
 
@@ -78,8 +82,7 @@ public class CacheServerTestUtil extends DistributedTestCase
     createClientCache(poolAttr, regionName, getClientProperties());
   }
 
-  public static void createClientCache(Pool poolAttr, String regionName,
-    Properties dsProperties) throws Exception {
+  public static void createClientCache(Pool poolAttr, String regionName, Properties dsProperties) throws Exception {
     ClientCacheFactory ccf = new ClientCacheFactory(dsProperties);
     if (poolAttr != null) {
       ccf
@@ -108,70 +111,60 @@ public class CacheServerTestUtil extends DistributedTestCase
         ccf.addPoolServer(server.getHostName(), server.getPort());
       }
     }
-    new CacheServerTestUtil("temp").createClientCache(dsProperties, ccf);
+    new CacheServerTestUtil().createClientCache(dsProperties, ccf);
     ClientCache cc = (ClientCache)cache;
     cc.createClientRegionFactory(ClientRegionShortcut.CACHING_PROXY).create(regionName);
     pool = (PoolImpl)((GemFireCacheImpl)cc).getDefaultPool();
   }
 
-  
-  
   public static void createPool(PoolAttributes poolAttr) throws Exception {
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
     
-    DistributedSystem ds = new CacheServerTestUtil("tmp").getSystem(props);;
-    
-      PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
-      pf.init(poolAttr);
-      PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
-      AttributesFactory factory = new AttributesFactory();
-      factory.setScope(Scope.LOCAL);
-      factory.setPoolName(p.getName());
+    DistributedSystem ds = new CacheServerTestUtil().getSystem(props);;
     
-      RegionAttributes attrs = factory.create();
-      pool = p;
-    }
-  
-  
-  
-  
-  
-  
-  
-  public static void createCacheClient(Pool poolAttr, String regionName,
-    Properties dsProperties, Boolean addControlListener) throws Exception {
+    PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
+    pf.init(poolAttr);
+    PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
+    AttributesFactory factory = new AttributesFactory();
+    factory.setScope(Scope.LOCAL);
+    factory.setPoolName(p.getName());
+
+    RegionAttributes attrs = factory.create();
+    pool = p;
+  }
+
+  public static void createCacheClient(Pool poolAttr, String regionName, Properties dsProperties, Boolean addControlListener) throws Exception {
   	createCacheClient(poolAttr, regionName, dsProperties, addControlListener, null);
   }
   
-  public static void createCacheClient(Pool poolAttr, String regionName,
-      Properties dsProperties, Boolean addControlListener, Properties javaSystemProperties) throws Exception {  		
-      new CacheServerTestUtil("temp").createCache(dsProperties);
-      IgnoredException.addIgnoredException("java.net.ConnectException||java.net.SocketException");
-      
-      if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
-      	Enumeration e = javaSystemProperties.propertyNames();
+  public static void createCacheClient(Pool poolAttr, String regionName, Properties dsProperties, Boolean addControlListener, Properties javaSystemProperties) throws Exception {
+    new CacheServerTestUtil().createCache(dsProperties);
+    IgnoredException.addIgnoredException("java.net.ConnectException||java.net.SocketException");
 
-        while (e.hasMoreElements()) {
-          String key = (String) e.nextElement();
-          System.setProperty(key, javaSystemProperties.getProperty(key));
-        }
-  	  }
-      
-      PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
-      pf.init(poolAttr);
-      PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
-      AttributesFactory factory = new AttributesFactory();
-      factory.setScope(Scope.LOCAL);
-      factory.setPoolName(p.getName());
-      if (addControlListener.booleanValue()) {
-        factory.addCacheListener(new ControlListener());
+    if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
+      Enumeration e = javaSystemProperties.propertyNames();
+
+      while (e.hasMoreElements()) {
+        String key = (String) e.nextElement();
+        System.setProperty(key, javaSystemProperties.getProperty(key));
       }
-      RegionAttributes attrs = factory.create();
-      cache.createRegion(regionName, attrs);
-      pool = p;
     }
+
+    PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
+    pf.init(poolAttr);
+    PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
+    AttributesFactory factory = new AttributesFactory();
+    factory.setScope(Scope.LOCAL);
+    factory.setPoolName(p.getName());
+    if (addControlListener.booleanValue()) {
+      factory.addCacheListener(new ControlListener());
+    }
+    RegionAttributes attrs = factory.create();
+    cache.createRegion(regionName, attrs);
+    pool = p;
+  }
   
   public static void unsetJavaSystemProperties(Properties javaSystemProperties) {
   	if (javaSystemProperties != null && javaSystemProperties.size() > 0) {
@@ -184,10 +177,8 @@ public class CacheServerTestUtil extends DistributedTestCase
 	  }
   }
   
-  public static void createCacheClient(Pool poolAttr, String regionName1,
-      String regionName2) throws Exception
-  {
-    new CacheServerTestUtil("temp").createCache(getClientProperties());
+  public static void createCacheClient(Pool poolAttr, String regionName1, String regionName2) throws Exception {
+    new CacheServerTestUtil().createCache(getClientProperties());
     PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
     pf.init(poolAttr);
     PoolImpl p = (PoolImpl)pf.create("CacheServerTestUtil");
@@ -275,10 +266,8 @@ public class CacheServerTestUtil extends DistributedTestCase
   /**
    * Create client regions
    */
-  public static void createCacheClients(Pool poolAttr, String regionName1,
-      String regionName2, Properties dsProperties) throws Exception
-  {
-    new CacheServerTestUtil("temp").createCache(dsProperties);
+  public static void createCacheClients(Pool poolAttr, String regionName1, String regionName2, Properties dsProperties) throws Exception {
+    new CacheServerTestUtil().createCache(dsProperties);
 
     // Initialize region1
     PoolFactoryImpl pf = (PoolFactoryImpl)PoolManager.createFactory();
@@ -297,29 +286,25 @@ public class CacheServerTestUtil extends DistributedTestCase
     cache.createRegion(regionName2, factory2.create());
   }
 
-  private static Properties getClientProperties()
-  {
+  private static Properties getClientProperties() {
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
     return props;
   }
   
-  private static Properties getClientProperties(boolean durable)
-  {
+  private static Properties getClientProperties(boolean durable) {
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
     return props;
   }
 
-  public static Integer createCacheServer(String regionName,
-      Boolean notifyBySubscription) throws Exception
-  {
+  public static Integer createCacheServer(String regionName, Boolean notifyBySubscription) throws Exception {
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
-    new CacheServerTestUtil("temp").createCache(props);
+    new CacheServerTestUtil().createCache(props);
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEnableBridgeConflation(true);
@@ -334,14 +319,11 @@ public class CacheServerTestUtil extends DistributedTestCase
     return new Integer(server1.getPort());
   }
 
-  public static Integer[] createCacheServerReturnPorts(String regionName,
-      Boolean notifyBySubscription) throws Exception
-  {
+  public static Integer[] createCacheServerReturnPorts(String regionName, Boolean notifyBySubscription) throws Exception {
     Properties props = new Properties();
-//    int mcastPort = AvailablePort.getRandomAvailablePort(AvailablePort.JGROUPS);
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
-    new CacheServerTestUtil("temp").createCache(props);
+    new CacheServerTestUtil().createCache(props);
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEnableBridgeConflation(true);
@@ -356,13 +338,11 @@ public class CacheServerTestUtil extends DistributedTestCase
     return new Integer[] {port, 0};
   }
 
-  public static void createCacheServer(String regionName,
-      Boolean notifyBySubscription, Integer serverPort)
-      throws Exception {
+  public static void createCacheServer(String regionName, Boolean notifyBySubscription, Integer serverPort) throws Exception {
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
-    new CacheServerTestUtil("temp").createCache(props);
+    new CacheServerTestUtil().createCache(props);
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEnableBridgeConflation(true);
@@ -375,10 +355,8 @@ public class CacheServerTestUtil extends DistributedTestCase
     server.start();
   }
 
-  public static Integer createCacheServer(String regionName1,
-      String regionName2, Boolean notifyBySubscription) throws Exception
-  {
-    new CacheServerTestUtil("temp").createCache(new Properties());
+  public static Integer createCacheServer(String regionName1, String regionName2, Boolean notifyBySubscription) throws Exception {
+    new CacheServerTestUtil().createCache(new Properties());
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEnableBridgeConflation(true);
@@ -398,8 +376,7 @@ public class CacheServerTestUtil extends DistributedTestCase
     return new Integer(server1.getPort());
   }
 
-  private void createCache(Properties props) throws Exception
-  {
+  private void createCache(Properties props) throws Exception {
     DistributedSystem ds = getSystem(props);
     assertNotNull(ds);
     ds.disconnect();
@@ -408,8 +385,7 @@ public class CacheServerTestUtil extends DistributedTestCase
     assertNotNull(cache);
   }
 
-  private void createClientCache(Properties props, ClientCacheFactory ccf) throws Exception
-  {
+  private void createClientCache(Properties props, ClientCacheFactory ccf) throws Exception {
     DistributedSystem ds = getSystem(props);
     assertNotNull(ds);
     ds.disconnect();
@@ -420,8 +396,7 @@ public class CacheServerTestUtil extends DistributedTestCase
     expected = IgnoredException.addIgnoredException("java.net.ConnectionException||java.net.SocketException");
   }
 
-  public static void closeCache()
-  {
+  public static void closeCache() {
     if (expected != null) {
       expected.remove();
       expected = null;
@@ -432,8 +407,7 @@ public class CacheServerTestUtil extends DistributedTestCase
     }
   }
 
-  public static void closeCache(boolean keepalive)
-  {
+  public static void closeCache(boolean keepalive) {
     if (expected != null) {
       expected.remove();
       expected = null;
@@ -448,18 +422,15 @@ public class CacheServerTestUtil extends DistributedTestCase
     cache = null;
   }
   
-  public static void setClientCrash(boolean crashOnClose)
-  {
+  public static void setClientCrash(boolean crashOnClose) {
     com.gemstone.gemfire.cache.client.internal.ConnectionImpl.setTEST_DURABLE_CLIENT_CRASH(crashOnClose);
   }
   
-  public static void disconnectClient()
-  {
+  public static void disconnectClient() {
     pool.endpointsNetDownForDUnitTest();
   }
   
-  public static void reconnectClient()
-  {
+  public static void reconnectClient() {
     if(pool != null) {
       pool.endpointsNetUpForDUnitTest();
     }
@@ -487,32 +458,28 @@ public class CacheServerTestUtil extends DistributedTestCase
     }
   }
 
-  public static Cache getCache()
-  {
+  public static Cache getCache() {
     return cache;
   }
 
-  public static PoolImpl getPool()
-  {
+  public static PoolImpl getPool() {
     return pool;
   }
 
   /**
    * Disables the shuffling of endpoints for a client
-   *
    */
-  public static void disableShufflingOfEndpoints()
-  {
+  public static void disableShufflingOfEndpoints() {
     // TODO DISABLE_RANDOM doesn't seem to be used anywhere
     System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.DISABLE_RANDOM", "true");
     System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "bridge.disableShufflingOfEndpoints", "true");
   }
+
   /**
    * Enables the shuffling of endpoints for a client
    * @since GemFire 5.7
    */
-  public static void enableShufflingOfEndpoints()
-  {
+  public static void enableShufflingOfEndpoints() {
     // TODO DISABLE_RANDOM doesn't seem to be used anywhere
     System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.DISABLE_RANDOM", "false");
     System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "bridge.disableShufflingOfEndpoints", "false");
@@ -520,13 +487,11 @@ public class CacheServerTestUtil extends DistributedTestCase
 
   /**
    * Resets the 'disableShufflingOfEndpoints' flag
-   * 
    */
-  public static void resetDisableShufflingOfEndpointsFlag()
-  {
+  public static void resetDisableShufflingOfEndpointsFlag() {
     System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "bridge.disableShufflingOfEndpoints", "false");
   }
-  
+
   public static class EventWrapper {
     public final EntryEvent event;
     public final Object key;
@@ -540,6 +505,7 @@ public class CacheServerTestUtil extends DistributedTestCase
       this.arg = ee.getCallbackArgument();
       this.type = type;
     }
+    @Override
     public String toString() {
       return "EventWrapper: event=" + event + ", type=" + type;
     }
@@ -572,6 +538,7 @@ public class CacheServerTestUtil extends DistributedTestCase
       } // synchronized
     }
 
+    @Override
     public void afterCreate(EntryEvent e) {
       synchronized(this.CONTROL_LOCK) {
         this.events.add(new EventWrapper(e, TYPE_CREATE));
@@ -579,6 +546,7 @@ public class CacheServerTestUtil extends DistributedTestCase
       }
     }
 
+    @Override
     public void afterUpdate(EntryEvent e) {
       synchronized(this.CONTROL_LOCK) {
         this.events.add(new EventWrapper(e, TYPE_UPDATE));
@@ -586,6 +554,7 @@ public class CacheServerTestUtil extends DistributedTestCase
       }
     }
 
+    @Override
     public void afterInvalidate(EntryEvent e) {
       synchronized(this.CONTROL_LOCK) {
         this.events.add(new EventWrapper(e, TYPE_INVALIDATE));
@@ -593,6 +562,7 @@ public class CacheServerTestUtil extends DistributedTestCase
       }
     }
 
+    @Override
     public void afterDestroy(EntryEvent e) {
       synchronized(this.CONTROL_LOCK) {
         this.events.add(new EventWrapper(e, TYPE_DESTROY));

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsDUnitTest.java
index e416b3c..8315019 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsDUnitTest.java
@@ -16,7 +16,25 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+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.CacheFactory;
+import com.gemstone.gemfire.cache.CommitConflictException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.internal.PoolImpl;
 import com.gemstone.gemfire.cache.server.CacheServer;
@@ -24,24 +42,23 @@ import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.ArrayList;
-import java.util.List;
-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.Assert;
+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.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * Tests behaviour of transactions in client server model
  */
-public class CacheServerTransactionsDUnitTest extends DistributedTestCase
-{
-  /** constructor */
-  public CacheServerTransactionsDUnitTest(String name) {
-    super(name);
-  }
+@Category(DistributedTest.class)
+public class CacheServerTransactionsDUnitTest extends JUnit4DistributedTestCase {
+
+  private static final int PAUSE = 5 * 1000;
 
   private static Cache cache = null;
 
@@ -77,8 +94,6 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
 
   private static VM client2 = null;
 
-//  private static RegionAttributes attrs = null;
-
   protected static boolean destroyed = false;
   
   protected static boolean invalidated = false;
@@ -92,13 +107,11 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
     client2 = host.getVM(3);
   }
 
-  private static final int PAUSE = 5 * 1000;
-
   /**
    * Test for update propagation to the clients when there is one server and two
    * clients connected to the server.
-   * 
    */
+  @Test
   public void testOneServerToClientTransactionsPropagation()
   {
     Integer port1 = initServerCache(server1);
@@ -124,13 +137,11 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
     client2.invoke(() -> CacheServerTransactionsDUnitTest.verifyUpdates());
   }
 
-  
-
   /**
    * Test for update propagation to the clients when there are  2 servers and two
    * clients connected to both the servers.
-   * 
    */
+  @Test
   public void testServerToClientTransactionsPropagation()
   {
     Integer port1 = initServerCache(server1);
@@ -163,8 +174,8 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
   /**
    * Test for update propagation to the clients when there are  2 servers and two
    * clients connected to separate server.
-   * 
    */
+  @Test
   public void testServerToClientTransactionsPropagationWithOneClientConnectedToOneServer()
   {
     Integer port1 = initServerCache(server1);
@@ -198,6 +209,7 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
    * Test for invalidate propagation to the clients when there is one server and two
    * clients connected to the server.
    */
+  @Test
   public void testInvalidatesOneServerToClientTransactionsPropagation()
   {
     Integer port1 = initServerCache(server1);
@@ -222,6 +234,7 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
    * Test for invalidate propagation to the clients when there are  2 servers and two
    * clients connected to both servers.
    */
+  @Test
   public void testInvalidatesServerToClientTransactionsPropagation()
   {
     Integer port1 = initServerCache(server1);
@@ -248,8 +261,8 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
   /**
    * Test for invalidate propagation to the clients when there are  2 servers and two
    * clients connected to separate servers.
-   * 
    */
+  @Test
   public void testInvalidatesServerToClientTransactionsPropagationWithOneConnection()
   {
     Integer port1 = initServerCache(server1);
@@ -277,8 +290,8 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
   /**
    * Test for destroy propagation to the clients when there is one server and two
    * clients connected to the server.
-   * 
    */
+  @Test
   public void testDestroysOneServerToClientTransactionsPropagation()
   {
     Integer port1 = initServerCache(server1);
@@ -303,6 +316,7 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
    * Test for destroy propagation to the clients when there are  2 servers and two
    * clients connected to both servers.
    */
+  @Test
   public void testDestroysServerToClientTransactionsPropagation()
   {
     Integer port1 = initServerCache(server1);
@@ -331,6 +345,7 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
    * Test for destroy propagation to the clients when there are  2 servers and two
    * clients connected to sepatate servers.
    */
+  @Test
   public void testDestroysServerToClientTransactionsPropagationWithOneConnection()
   {
     Integer port1 = initServerCache(server1);
@@ -635,7 +650,7 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
-    new CacheServerTransactionsDUnitTest("temp").createCache(props);
+    new CacheServerTransactionsDUnitTest().createCache(props);
     PoolImpl p = (PoolImpl)PoolManager.createFactory()
       .addServer(host, port.intValue())
       .setSubscriptionEnabled(true)
@@ -670,7 +685,7 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
-    new CacheServerTransactionsDUnitTest("temp").createCache(props);
+    new CacheServerTransactionsDUnitTest().createCache(props);
     PoolImpl p = (PoolImpl)PoolManager.createFactory()
       .addServer(host, port1.intValue())
       .addServer(host, port2.intValue())
@@ -714,7 +729,7 @@ public class CacheServerTransactionsDUnitTest extends DistributedTestCase
 
   public static Integer createServerCache(Integer maxThreads) throws Exception
   {
-    new CacheServerTransactionsDUnitTest("temp").createCache(new Properties());
+    new CacheServerTransactionsDUnitTest().createCache(new Properties());
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setDataPolicy(DataPolicy.REPLICATE);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsSelectorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsSelectorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsSelectorDUnitTest.java
index 24945ea..9632bb6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsSelectorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/CacheServerTransactionsSelectorDUnitTest.java
@@ -16,16 +16,26 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
+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;
+
 /**
  * Just like CacheServerTransactionsDUnitTest but configures bridge server
  * with thread pool (i.e. selector).
  */
+@Category(DistributedTest.class)
 public class CacheServerTransactionsSelectorDUnitTest
   extends CacheServerTransactionsDUnitTest
 {
   /** constructor */
-  public CacheServerTransactionsSelectorDUnitTest(String name) {
-    super(name);
+  public CacheServerTransactionsSelectorDUnitTest() {
+    super();
   }
 
   protected int getMaxThreads() {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClearPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClearPropagationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClearPropagationDUnitTest.java
index 8e25607..29fb164 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClearPropagationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClearPropagationDUnitTest.java
@@ -16,7 +16,25 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+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.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionEvent;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.Pool;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.internal.Connection;
@@ -31,24 +49,20 @@ import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.cache.CacheObserverAdapter;
 import com.gemstone.gemfire.internal.cache.CacheObserverHolder;
 import com.gemstone.gemfire.internal.cache.EventID;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.ArrayList;
-import java.util.List;
-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.Assert;
+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.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * This is the DUnit Test to verify clear and DestroyRegion operation in
  * Client-Server Configuration.
- *
- *
  */
-
-public class ClearPropagationDUnitTest extends DistributedTestCase
-{
+@Category(DistributedTest.class)
+public class ClearPropagationDUnitTest extends JUnit4DistributedTestCase {
 
   VM server1 = null;
 
@@ -71,8 +85,8 @@ public class ClearPropagationDUnitTest extends DistributedTestCase
   protected static boolean gotDestroyed = false;
 
   /** constructor */
-  public ClearPropagationDUnitTest(String name) {
-    super(name);
+  public ClearPropagationDUnitTest() {
+    super();
   }
 
   @Override
@@ -121,6 +135,7 @@ public class ClearPropagationDUnitTest extends DistributedTestCase
    * the update
    *
    */
+  @Test
   public void testVerifyClearNotReceivedBySenderReceivedByOthers()
   {
 	  CacheSerializableRunnable resetFlags = new CacheSerializableRunnable(
@@ -172,6 +187,7 @@ public class ClearPropagationDUnitTest extends DistributedTestCase
    * the update
    *
    */
+  @Test
   public void testEventIdGeneratedInDestroyRegionOperation() throws Exception
   {
 	CacheSerializableRunnable resetFlags = new CacheSerializableRunnable(
@@ -346,7 +362,7 @@ public class ClearPropagationDUnitTest extends DistributedTestCase
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
-    new ClearPropagationDUnitTest("temp").createCache(props);
+    new ClearPropagationDUnitTest().createCache(props);
     CacheServerTestUtil.disableShufflingOfEndpoints();
     Pool p;
     try {
@@ -390,7 +406,7 @@ public class ClearPropagationDUnitTest extends DistributedTestCase
 
   public static Integer createServerCache() throws Exception
   {
-    new ClearPropagationDUnitTest("temp").createCache(new Properties());
+    new ClearPropagationDUnitTest().createCache(new Properties());
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setDataPolicy(DataPolicy.REPLICATE);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientConflationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientConflationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientConflationDUnitTest.java
index e05f9ff..47524bd 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientConflationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientConflationDUnitTest.java
@@ -16,7 +16,23 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.CacheWriterException;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.client.Pool;
 import com.gemstone.gemfire.cache.client.PoolFactory;
 import com.gemstone.gemfire.cache.client.PoolManager;
@@ -29,12 +45,15 @@ import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.cache.CacheServerImpl;
 import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
 import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.Iterator;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+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.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * This test verifies the per-client queue conflation override functionality
@@ -42,8 +61,9 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
  *
  * @since GemFire 5.7
  */
-public class ClientConflationDUnitTest extends DistributedTestCase
-{
+@Category(DistributedTest.class)
+public class ClientConflationDUnitTest extends JUnit4DistributedTestCase {
+
   VM vm0 = null; // server
   VM vm1 = null; // client
   private static Cache cacheClient = null;
@@ -54,11 +74,6 @@ public class ClientConflationDUnitTest extends DistributedTestCase
   private static final String REGION_NAME1 = "ClientConflationDUnitTest_region1" ;
   private static final String REGION_NAME2 = "ClientConflationDUnitTest_region2" ;
 
-  /** constructor */
-  public ClientConflationDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     disconnectAllFromDS();
@@ -91,6 +106,7 @@ public class ClientConflationDUnitTest extends DistributedTestCase
     System.setProperty("slowStartTimeForTesting","15000");
   }
 
+  @Test
   public void testConflationDefault() {
     try {
       performSteps(DistributionConfig.CLIENT_CONFLATION_PROP_VALUE_DEFAULT);
@@ -100,6 +116,7 @@ public class ClientConflationDUnitTest extends DistributedTestCase
     }
   }
   
+  @Test
   public void testConflationOn() {
     try {
       performSteps(DistributionConfig.CLIENT_CONFLATION_PROP_VALUE_ON);
@@ -109,6 +126,7 @@ public class ClientConflationDUnitTest extends DistributedTestCase
     }
   }
   
+  @Test
   public void testConflationOff() {
     try {
       performSteps(DistributionConfig.CLIENT_CONFLATION_PROP_VALUE_OFF);
@@ -170,7 +188,7 @@ public class ClientConflationDUnitTest extends DistributedTestCase
    */
   public static void createClientCache(String host, Integer port, String conflation) throws Exception
   {
-    ClientConflationDUnitTest test = new ClientConflationDUnitTest("temp");
+    ClientConflationDUnitTest test = new ClientConflationDUnitTest();
     cacheClient = test.createCache(createProperties1(conflation));
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.LOCAL);
@@ -215,7 +233,7 @@ public class ClientConflationDUnitTest extends DistributedTestCase
 
   public static void createClientCacheFeeder(String host, Integer port) throws Exception
   {
-    ClientConflationDUnitTest test = new ClientConflationDUnitTest("temp");
+    ClientConflationDUnitTest test = new ClientConflationDUnitTest();
     cacheFeeder = test.createCache(createProperties1(DistributionConfig.CLIENT_CONFLATION_PROP_VALUE_DEFAULT));
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.LOCAL);
@@ -391,7 +409,7 @@ public class ClientConflationDUnitTest extends DistributedTestCase
   {
     Properties props = new Properties();
     props.setProperty(DELTA_PROPAGATION, "false");
-    ClientConflationDUnitTest test = new ClientConflationDUnitTest("temp");
+    ClientConflationDUnitTest test = new ClientConflationDUnitTest();
     cacheServer = test.createCache(props);
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.DISTRIBUTED_ACK);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java
index 7e51fe4..4261568 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientInterestNotifyDUnitTest.java
@@ -16,6 +16,26 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import com.jayway.awaitility.Awaitility;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.CacheWriterException;
+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.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.*;
 import com.gemstone.gemfire.cache.client.Pool;
 import com.gemstone.gemfire.cache.client.PoolFactory;
@@ -26,6 +46,15 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.cache.CacheServerImpl;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
+import com.gemstone.gemfire.test.dunit.Assert;
+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.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 import com.gemstone.gemfire.test.dunit.*;
 import com.jayway.awaitility.Awaitility;
 
@@ -42,8 +71,9 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
  *
  * @since GemFire 6.0.3
  */
-public class ClientInterestNotifyDUnitTest extends DistributedTestCase
-{
+@Category(DistributedTest.class)
+public class ClientInterestNotifyDUnitTest extends JUnit4DistributedTestCase {
+
   class EventListener extends CacheListenerAdapter
   {
     public EventListener(String name)
@@ -130,11 +160,6 @@ public class ClientInterestNotifyDUnitTest extends DistributedTestCase
   // Region 3 does NOT register any interest
   private static final String REGION_NAME3 = "ClientInterestNotifyDUnitTest_region3" ;
 
-  /** constructor */
-  public ClientInterestNotifyDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
   public final void postSetUp() throws Exception {
     disconnectAllFromDS();
@@ -156,13 +181,9 @@ public class ClientInterestNotifyDUnitTest extends DistributedTestCase
     return cache;
   }
 
-  public void testInterestNotify() {
-    try {
-      performSteps();
-    }
-    catch( Exception e ) {
-      Assert.fail("testInterestNotify failed due to exception", e);
-    }
+  @Test
+  public void testInterestNotify() throws Exception {
+    performSteps();
   }
   
   private void performSteps() throws Exception {
@@ -302,7 +323,7 @@ public class ClientInterestNotifyDUnitTest extends DistributedTestCase
   public static void createClientCache(String host, Integer port, /*String nbs,*/
       String name) throws Exception
   {
-    ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest("temp");
+    ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest();
     Cache cacheClient = test.createCache(createProperties1(/*nbs*/));
     AttributesFactory factory = new AttributesFactory();
     factory.setScope(Scope.LOCAL);
@@ -331,7 +352,7 @@ public class ClientInterestNotifyDUnitTest extends DistributedTestCase
   
   public static void createClientCacheFeeder(String host, Integer port) throws Exception
   {
-    ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest("temp");
+    ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest();
     Cache cacheFeeder = test.createCache(createProperties1(
         /*DistributionConfig.NOTIFY_BY_SUBSCRIPTION_OVERRIDE_PROP_VALUE_DEFAULT*/));
     AttributesFactory factory = new AttributesFactory();
@@ -412,7 +433,7 @@ public class ClientInterestNotifyDUnitTest extends DistributedTestCase
    */
   public static Integer createServerCache() throws Exception
   {
-    ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest("temp");
+    ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest();
     Properties props = new Properties();
     props.setProperty(DELTA_PROPAGATION, "false");
     cacheServer = test.createCache(props);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerForceInvalidateDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerForceInvalidateDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerForceInvalidateDUnitTest.java
index 04a8568..2f10dc1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerForceInvalidateDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ClientServerForceInvalidateDUnitTest.java
@@ -16,14 +16,34 @@
  */
 package com.gemstone.gemfire.internal.cache.tier.sockets;
 
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.jayway.awaitility.Awaitility.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.apache.logging.log4j.Logger;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.InterestPolicy;
+import com.gemstone.gemfire.cache.InterestResultPolicy;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.SubscriptionAttributes;
 import com.gemstone.gemfire.cache.client.NoAvailableServersException;
 import com.gemstone.gemfire.cache.client.PoolManager;
 import com.gemstone.gemfire.cache.client.internal.Connection;
 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.CacheTestCase;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.cache.AbstractRegionMap;
@@ -34,22 +54,14 @@ import com.gemstone.gemfire.internal.logging.LogService;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.NetworkUtils;
 import com.gemstone.gemfire.test.dunit.VM;
-import org.apache.logging.log4j.Logger;
-
-import java.util.Properties;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static com.jayway.awaitility.Awaitility.with;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
 
 /**
  * Tests client server FORCE_INVALIDATE
  */
-public class ClientServerForceInvalidateDUnitTest extends CacheTestCase
-{
-  private static final long serialVersionUID = 1L;
+@Category(DistributedTest.class)
+public class ClientServerForceInvalidateDUnitTest extends JUnit4CacheTestCase {
 
   private static final Logger logger = LogService.getLogger();
 
@@ -62,14 +74,8 @@ public class ClientServerForceInvalidateDUnitTest extends CacheTestCase
   private static VM server1;
   private static VM server2;
 
-  /** constructor */
-  public ClientServerForceInvalidateDUnitTest(String name) {
-    super(name);
-  }
-
   @Override
-  public final void postSetUp() throws Exception
-  {
+  public final void postSetUp() throws Exception {
     host = Host.getHost(0);
     server1 = host.getVM(0);
     server2 = host.getVM(1);
@@ -79,27 +85,35 @@ public class ClientServerForceInvalidateDUnitTest extends CacheTestCase
     return vm.invoke(() -> createServerCache(concurrencyChecksEnabled, partitioned, 0));
   }
 
+  @Test
   public void testForceInvalidateOnCachingProxyWithConcurrencyChecks() throws Exception {
     dotestForceInvalidate(true, true, false, true);
   }
+  @Test
   public void testForceInvalidateOnCachingProxyWithConcurrencyChecksOnlyOnServer() throws Exception {
     dotestForceInvalidate(true, false, false, true);
   }
+  @Test
   public void testForceInvalidateOnCachingProxyWithConcurrencyChecksOnlyOnClient() throws Exception {
     dotestForceInvalidate(false, true, false, true);
   }
+  @Test
   public void testForceInvalidateOnProxyWithConcurrencyChecks() throws Exception {
     dotestForceInvalidate(true, true, true, true);
   }
+  @Test
   public void testForceInvalidateOnProxyWithConcurrencyChecksOnlyOnServer() throws Exception {
     dotestForceInvalidate(true, false, true, true);
   }
+  @Test
   public void testForceInvalidateOnProxyWithConcurrencyChecksOnlyOnClient() throws Exception {
     dotestForceInvalidate(false, true, true, true);
   }
+  @Test
   public void testForceInvalidateOnCachingProxyWithConcurrencyChecksServerReplicated() throws Exception {
     dotestForceInvalidate(true, true, false, false);
   }
+  @Test
   public void testForceInvalidateOnProxyWithConcurrencyChecksServerReplicated() throws Exception {
     dotestForceInvalidate(true, true, true, false);
   }
@@ -116,6 +130,7 @@ public class ClientServerForceInvalidateDUnitTest extends CacheTestCase
    *    It will arrive late and not be done because of concurrency checks.
    * 7. verify that afterInvalidate was invoked on the client.
    */
+  @Test
   public void testInvalidateLosingOnConcurrencyChecks() throws Exception {
     try {
       setupServerAndClientVMs(true, true, false, false);
@@ -230,7 +245,6 @@ public class ClientServerForceInvalidateDUnitTest extends CacheTestCase
       }
     }
     return false;
-    
   }
 
   private boolean hasClientListenerAfterInvalidateBeenInvoked() {
@@ -246,11 +260,11 @@ public class ClientServerForceInvalidateDUnitTest extends CacheTestCase
     }
     return false;
   }
-  private static Integer createServerCache(Boolean concurrencyChecksEnabled, Boolean partitioned, Integer maxThreads)
-  throws Exception {
+
+  private static Integer createServerCache(Boolean concurrencyChecksEnabled, Boolean partitioned, Integer maxThreads) throws Exception {
     AbstractRegionMap.FORCE_INVALIDATE_EVENT = true;
     Properties props = new Properties();
-    Cache cache = new ClientServerForceInvalidateDUnitTest("temp").createCacheV(props);
+    Cache cache = new ClientServerForceInvalidateDUnitTest().createCacheV(props);
     RegionFactory<String, String> factory = cache.createRegionFactory();
     if (partitioned) {
       factory.setDataPolicy(DataPolicy.PARTITION);
@@ -277,13 +291,12 @@ public class ClientServerForceInvalidateDUnitTest extends CacheTestCase
 
   }
   
-  public static void createClientCache(String h, int port1, int port2, boolean empty, boolean concurrenctChecksEnabled)
-  throws Exception  {
+  public static void createClientCache(String h, int port1, int port2, boolean empty, boolean concurrenctChecksEnabled) throws Exception  {
     AbstractRegionMap.FORCE_INVALIDATE_EVENT = true;
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
     props.setProperty(LOCATORS, "");
-    Cache cache = new ClientServerForceInvalidateDUnitTest("temp").createCacheV(props);
+    Cache cache = new ClientServerForceInvalidateDUnitTest().createCacheV(props);
     PoolImpl p = (PoolImpl)PoolManager.createFactory()
       .addServer(h, port1)
       .addServer(h, port2)
@@ -342,27 +355,27 @@ public class ClientServerForceInvalidateDUnitTest extends CacheTestCase
   static class ClientListener extends CacheListenerAdapter<String, String> {
     public boolean afterInvalidateInvoked;
     @Override
-      public void afterCreate(EntryEvent<String, String> event) {
-        super.afterCreate(event);
-        logger.info("afterCreate: {" + event.getOldValue() + " -> " + event.getNewValue() + "} at=" + System.currentTimeMillis());
-      }
-      @Override
-      public void afterUpdate(EntryEvent<String, String> event) {
-        super.afterUpdate(event);
-        logger.info("afterUpdate: {" + event.getOldValue() + " -> " + event.getNewValue() + "} at=" + System.currentTimeMillis());
-      }
-      @Override
-      public void afterInvalidate(final EntryEvent<String, String> event) {
-        super.afterInvalidate(event);
-        afterInvalidateInvoked = true;
-        String prefix = "";
-        if (!event.isOriginRemote()) {
-          prefix = "    ";
-        }
-        logger.info(prefix + "afterInvalidate: {" + event.getOldValue() + " -> " + event.getNewValue() + "} at=" + System.currentTimeMillis());
-
+    public void afterCreate(EntryEvent<String, String> event) {
+      super.afterCreate(event);
+      logger.info("afterCreate: {" + event.getOldValue() + " -> " + event.getNewValue() + "} at=" + System.currentTimeMillis());
+    }
+    @Override
+    public void afterUpdate(EntryEvent<String, String> event) {
+      super.afterUpdate(event);
+      logger.info("afterUpdate: {" + event.getOldValue() + " -> " + event.getNewValue() + "} at=" + System.currentTimeMillis());
+    }
+    @Override
+    public void afterInvalidate(final EntryEvent<String, String> event) {
+      super.afterInvalidate(event);
+      afterInvalidateInvoked = true;
+      String prefix = "";
+      if (!event.isOriginRemote()) {
+        prefix = "    ";
       }
+      logger.info(prefix + "afterInvalidate: {" + event.getOldValue() + " -> " + event.getNewValue() + "} at=" + System.currentTimeMillis());
+    }
   }
+
   static class ServerListener extends CacheListenerAdapter<String, String> {
     boolean afterInvalidateInvoked;
     @Override
@@ -396,7 +409,7 @@ public class ClientServerForceInvalidateDUnitTest extends CacheTestCase
   private static void closeForceInvalidateCache()
   {
     AbstractRegionMap.FORCE_INVALIDATE_EVENT = false;
-    Cache cache = new ClientServerForceInvalidateDUnitTest("temp").getCache();
+    Cache cache = new ClientServerForceInvalidateDUnitTest().getCache();
     if (cache != null && !cache.isClosed()) {
       cache.close();
       cache.getDistributedSystem().disconnect();


Mime
View raw message