You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/02/09 19:44:49 UTC

[39/51] [partial] incubator-geode git commit: GEODE-773: Extract static methods from DistributedTestCase

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
index 572ad53..8c85ebd 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllCallBkSingleVMDUnitTest.java
@@ -39,8 +39,10 @@ import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
 import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
 import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.test.dunit.Assert;
 import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.VM;
 
 public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
@@ -72,16 +74,16 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
       VM vm1 = host.getVM(1);
       vm0.invoke(PutAllCallBkSingleVMDUnitTest.class, "createCache");
       vm1.invoke(PutAllCallBkSingleVMDUnitTest.class, "createCache");
-      getLogWriter().fine("Cache created in successfully");
+      LogWriterUtils.getLogWriter().fine("Cache created in successfully");
     }
     
-    public void tearDown2(){
-        Host host = Host.getHost(0);
-        VM vm0 = host.getVM(0);
-        VM vm1 = host.getVM(1);
-        vm0.invoke(PutAllCallBkSingleVMDUnitTest.class, "closeCache");
-        vm1.invoke(PutAllCallBkSingleVMDUnitTest.class, "closeCache");
-        
+    @Override
+    protected final void preTearDown() throws Exception {
+      Host host = Host.getHost(0);
+      VM vm0 = host.getVM(0);
+      VM vm1 = host.getVM(1);
+      vm0.invoke(PutAllCallBkSingleVMDUnitTest.class, "closeCache");
+      vm1.invoke(PutAllCallBkSingleVMDUnitTest.class, "closeCache");
     }
     
     public static synchronized void createCache(){
@@ -186,7 +188,7 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
                 obj = region.put(ob, str);
             }
         }catch(Exception ex){
-            fail("Failed while region.put", ex);
+            Assert.fail("Failed while region.put", ex);
         }
         return obj;
     }//end of putMethod
@@ -265,12 +267,12 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
     static class AfterCreateCallback extends CacheListenerAdapter {
         public void afterCreate(EntryEvent event){            
             putAllcounter++;
-            getLogWriter().fine("In afterCreate"+putAllcounter);
+            LogWriterUtils.getLogWriter().fine("In afterCreate"+putAllcounter);
             if (event.getOperation().isPutAll()) {
               assertEquals("putAllCreateCallback", event.getCallbackArgument());
             }
             if(putAllcounter == 25){
-                getLogWriter().fine("performingtrue");
+                LogWriterUtils.getLogWriter().fine("performingtrue");
                 afterCreate = true;
             }            
         }
@@ -279,12 +281,12 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
     static class AfterUpdateCallback extends CacheListenerAdapter {
         public void afterUpdate(EntryEvent event){            
             afterUpdateputAllcounter++;
-            getLogWriter().fine("In afterUpdate"+afterUpdateputAllcounter);
+            LogWriterUtils.getLogWriter().fine("In afterUpdate"+afterUpdateputAllcounter);
             if (event.getOperation().isPutAll()) {
               assertEquals("putAllAfterUpdateCallback", event.getCallbackArgument());
             }
             if(afterUpdateputAllcounter == 5){
-                getLogWriter().fine("performingtrue afterUpdate");
+                LogWriterUtils.getLogWriter().fine("performingtrue afterUpdate");
                 afterUpdate = true;
             }            
         }
@@ -292,12 +294,12 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
     static class BeforeCreateCallback extends CacheWriterAdapter {
           public void beforeCreate(EntryEvent event){            
             beforeCreateputAllcounter++;
-            getLogWriter().fine("In beforeCreate"+beforeCreateputAllcounter);
+            LogWriterUtils.getLogWriter().fine("In beforeCreate"+beforeCreateputAllcounter);
             if (event.getOperation().isPutAll()) {
               assertEquals("putAllCreateCallback", event.getCallbackArgument());
             }
             if(beforeCreateputAllcounter == 25){
-                getLogWriter().fine("performingtrue beforeCreateputAll");
+                LogWriterUtils.getLogWriter().fine("performingtrue beforeCreateputAll");
                 beforeCreate = true;
             }            
         }
@@ -305,12 +307,12 @@ public class PutAllCallBkSingleVMDUnitTest extends DistributedTestCase{
       static class BeforeUpdateCallback extends CacheWriterAdapter {
         public void beforeUpdate(EntryEvent event){            
             beforeUpdateputAllcounter++;
-            getLogWriter().fine("In beforeUpdate"+beforeUpdateputAllcounter);
+            LogWriterUtils.getLogWriter().fine("In beforeUpdate"+beforeUpdateputAllcounter);
             if (event.getOperation().isPutAll()) {
               assertEquals("putAllAfterUpdateCallback", event.getCallbackArgument());
             }
             if(beforeUpdateputAllcounter == 5){
-                getLogWriter().fine("performingtrue beforeUpdate");
+                LogWriterUtils.getLogWriter().fine("performingtrue beforeUpdate");
                 beforeUpdate = true;
             }            
         }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
index 2113118..5a37ebf 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/PutAllMultiVmDUnitTest.java
@@ -40,6 +40,7 @@ import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 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.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
 
@@ -72,14 +73,15 @@ public class PutAllMultiVmDUnitTest extends DistributedTestCase{
       vm1.invoke(PutAllMultiVmDUnitTest.class, "createCache");
     }
     
-    public void tearDown2(){
-        Host host = Host.getHost(0);
-        VM vm0 = host.getVM(0);
-        VM vm1 = host.getVM(1);
-        vm0.invoke(PutAllMultiVmDUnitTest.class, "closeCache");
-        vm1.invoke(PutAllMultiVmDUnitTest.class, "closeCache");
-        cache = null;
-        invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
+    @Override
+    protected final void preTearDown() throws Exception {
+      Host host = Host.getHost(0);
+      VM vm0 = host.getVM(0);
+      VM vm1 = host.getVM(1);
+      vm0.invoke(PutAllMultiVmDUnitTest.class, "closeCache");
+      vm1.invoke(PutAllMultiVmDUnitTest.class, "closeCache");
+      cache = null;
+      Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
     }
     
     public static void createCache(){

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/QueueMsgDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/QueueMsgDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/QueueMsgDUnitTest.java
index 5a00ec0..82d5205 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/QueueMsgDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/QueueMsgDUnitTest.java
@@ -35,10 +35,11 @@ import com.gemstone.gemfire.cache.SubscriptionAttributes;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.internal.cache.CachePerfStats;
 import com.gemstone.gemfire.internal.cache.DistributedRegion;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
 
 /**
  * Test to make sure message queuing works.
@@ -128,7 +129,7 @@ public class QueueMsgDUnitTest extends ReliabilityTestCase {
         return "waiting for reliableQueuedOps to become 0";
       }
     };
-    DistributedTestCase.waitForCriterion(ev, 5 * 1000, 200, true);
+    Wait.waitForCriterion(ev, 5 * 1000, 200, true);
     
     // now check that the queued op was delivered
     vm.invoke(new CacheSerializableRunnable("check") {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
index e707ea8..916634b 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RRSynchronizationDUnitTest.java
@@ -44,9 +44,14 @@ import com.gemstone.gemfire.internal.cache.VMCachedDeserializable;
 import com.gemstone.gemfire.internal.cache.versions.VMVersionTag;
 import com.gemstone.gemfire.internal.cache.versions.VersionSource;
 import com.gemstone.gemfire.internal.cache.versions.VersionTag;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
 import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.SerializableCallable;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
 
 /**
  * concurrency-control tests for client/server
@@ -85,7 +90,7 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
    * distributed in the 7.0 release.
    */
   public void doRegionsSyncOnPeerLoss(TestType typeOfTest) {
-    addExpectedException("killing member's ds");
+    IgnoredException.addIgnoredException("killing member's ds");
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
@@ -111,7 +116,7 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
       // Now we crash the member who "modified" vm1's cache.
       // The other replicates should perform a delta-GII for the lost member and
       // get back in sync
-      crashDistributedSystem(vm0);
+      DistributedTestUtils.crashDistributedSystem(vm0);
   
       verifySynchronized(vm2, crashedID);
     } finally {
@@ -158,7 +163,7 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
         tag.setEntryVersion(1);
         tag.setIsRemoteForTesting();
         EntryEventImpl event = EntryEventImpl.create(dr, Operation.CREATE, "Object3", true, forMember, true, false);
-        getLogWriter().info("applying this event to the cache: " + event);
+        LogWriterUtils.getLogWriter().info("applying this event to the cache: " + event);
         event.setNewValue(new VMCachedDeserializable("value3", 12));
         event.setVersionTag(tag);
         dr.getRegionMap().basicPut(event, System.currentTimeMillis(), true, false, null, false, false);
@@ -173,12 +178,12 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
         event = EntryEventImpl.create(dr, Operation.CREATE, "Object5", true, forMember, true, false);
         event.setNewValue(Token.TOMBSTONE);
         event.setVersionTag(tag);
-        getLogWriter().info("applying this event to the cache: " + event);
+        LogWriterUtils.getLogWriter().info("applying this event to the cache: " + event);
         dr.getRegionMap().basicPut(event, System.currentTimeMillis(), true, false, null, false, false);
         event.release();
 
         dr.dumpBackingMap();
-        getLogWriter().info("version vector is now " + dr.getVersionVector().fullToString());
+        LogWriterUtils.getLogWriter().info("version vector is now " + dr.getVersionVector().fullToString());
         assertTrue("should hold entry Object3 now", dr.containsKey("Object3"));
         return true;
       }
@@ -189,17 +194,17 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
     vm.invoke(new SerializableCallable("check that synchronization happened") {
       public Object call() throws Exception {
         final DistributedRegion dr = (DistributedRegion)TestRegion;
-        waitForCriterion(new WaitCriterion() {
+        Wait.waitForCriterion(new WaitCriterion() {
           String waitingFor = "crashed member is still in membership view: " + crashedMember;
           boolean dumped = false;
           public boolean done() {
             if (TestRegion.getCache().getDistributionManager().isCurrentMember(crashedMember)) {
-              getLogWriter().info(waitingFor);
+              LogWriterUtils.getLogWriter().info(waitingFor);
               return false;
             }
             if (!TestRegion.containsKey("Object3")) {
               waitingFor = "entry for Object3 not found";
-              getLogWriter().info(waitingFor);
+              LogWriterUtils.getLogWriter().info(waitingFor);
               return false;
             }
             RegionEntry re = dr.getRegionMap().getEntry("Object5");
@@ -209,7 +214,7 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
                 dr.dumpBackingMap();
               }
               waitingFor = "entry for Object5 not found";
-              getLogWriter().info(waitingFor);
+              LogWriterUtils.getLogWriter().info(waitingFor);
               return false;
             }
             if (!re.isTombstone()) {
@@ -218,7 +223,7 @@ public class RRSynchronizationDUnitTest extends CacheTestCase {
                 dr.dumpBackingMap();
               }
               waitingFor = "Object5 is not a tombstone but should be: " + re;
-              getLogWriter().info(waitingFor);
+              LogWriterUtils.getLogWriter().info(waitingFor);
               return false;
             }
             return true;

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
index 0700074..0d80574 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectDUnitTest.java
@@ -54,12 +54,20 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.mgr.GMSMembershi
 import com.gemstone.gemfire.internal.AvailablePort;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
 import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlGenerator;
+import com.gemstone.gemfire.test.dunit.Assert;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.dunit.DistributedTestCase;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
 import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.SerializableCallable;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
 
 @SuppressWarnings("serial")
 public class ReconnectDUnitTest extends CacheTestCase
@@ -92,10 +100,10 @@ public class ReconnectDUnitTest extends CacheTestCase
           locatorPort = locPort;
           Properties props = getDistributedSystemProperties();
           locator = Locator.startLocatorAndDS(locatorPort, new File(""), props);
-          addExpectedException("com.gemstone.gemfire.ForcedDisconnectException||Possible loss of quorum");
+          IgnoredException.addIgnoredException("com.gemstone.gemfire.ForcedDisconnectException||Possible loss of quorum");
 //          MembershipManagerHelper.getMembershipManager(InternalDistributedSystem.getConnectedInstance()).setDebugJGroups(true);
         } catch (IOException e) {
-          fail("unable to start locator", e);
+          Assert.fail("unable to start locator", e);
         }
       }
     });
@@ -106,7 +114,7 @@ public class ReconnectDUnitTest extends CacheTestCase
     //Cache cache = getCache();
     closeCache();
     getSystem().disconnect();
-    getLogWriter().fine("Cache Closed ");
+    LogWriterUtils.getLogWriter().fine("Cache Closed ");
   }
 
   @Override
@@ -119,25 +127,24 @@ public class ReconnectDUnitTest extends CacheTestCase
       dsProperties.put(DistributionConfig.LOCATORS_NAME, "localHost["+this.locatorPort+"]");
       dsProperties.put(DistributionConfig.MCAST_PORT_NAME, "0");
       dsProperties.put(DistributionConfig.MEMBER_TIMEOUT_NAME, "1000");
-      dsProperties.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+      dsProperties.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
     }
     return dsProperties;
   }
   
-  public void tearDown2() throws Exception
-  {
+  @Override
+  protected final void postTearDownCacheTestCase() throws Exception {
     try {
-      super.tearDown2();
       Host.getHost(0).getVM(locatorVMNumber).invoke(new SerializableRunnable("stop locator") {
         public void run() {
           if (locator != null) {
-            getLogWriter().info("stopping locator " + locator);
+            LogWriterUtils.getLogWriter().info("stopping locator " + locator);
             locator.stop();
           }
         }
       });
     } finally {
-      invokeInEveryVM(new SerializableRunnable() {
+      Invoke.invokeInEveryVM(new SerializableRunnable() {
         public void run() {
           ReconnectDUnitTest.savedSystem = null;
         }
@@ -167,7 +174,7 @@ public class ReconnectDUnitTest extends CacheTestCase
 
   // quorum check fails, then succeeds
   public void testReconnectWithQuorum() throws Exception {
-    addExpectedException("killing member's ds");
+    IgnoredException.addIgnoredException("killing member's ds");
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
@@ -197,7 +204,7 @@ public class ReconnectDUnitTest extends CacheTestCase
         props.put("max-num-reconnect-tries", "2");
         props.put("log-file", "autoReconnectVM"+VM.getCurrentVMNum()+"_"+getPID()+".log");
         Cache cache = new CacheFactory(props).create();
-        addExpectedException("com.gemstone.gemfire.ForcedDisconnectException||Possible loss of quorum");
+        IgnoredException.addIgnoredException("com.gemstone.gemfire.ForcedDisconnectException||Possible loss of quorum");
         Region myRegion = cache.getRegion("root/myRegion");
         ReconnectDUnitTest.savedSystem = cache.getDistributedSystem();
         myRegion.put("MyKey1", "MyValue1");
@@ -219,7 +226,7 @@ public class ReconnectDUnitTest extends CacheTestCase
      */
     System.out.println("disconnecting vm0");
     forceDisconnect(vm0);
-    pause(10000);
+    Wait.pause(10000);
     System.out.println("disconnecting vm1");
     forceDisconnect(vm1);
 
@@ -231,7 +238,7 @@ public class ReconnectDUnitTest extends CacheTestCase
       waitForReconnect(vm1);
       System.out.println("done reconnecting vm0 and vm1");
     } catch (Exception e) {
-      dumpAllStacks();
+      ThreadUtils.dumpAllStacks();
       throw e;
     }
   }
@@ -249,7 +256,7 @@ public class ReconnectDUnitTest extends CacheTestCase
   
   public void doTestReconnectOnForcedDisconnect(final boolean createInAppToo) throws Exception {
 
-    addExpectedException("killing member's ds");
+    IgnoredException.addIgnoredException("killing member's ds");
 //    getSystem().disconnect();
 //    getLogWriter().fine("Cache Closed ");
 
@@ -260,7 +267,7 @@ public class ReconnectDUnitTest extends CacheTestCase
     final int locPort = locatorPort;
     final int secondLocPort = AvailablePortHelper.getRandomAvailableTCPPort();
 
-    deleteLocatorStateFile(locPort, secondLocPort);
+    DistributedTestUtils.deleteLocatorStateFile(locPort, secondLocPort);
 
 
     final String xmlFileLoc = (new File(".")).getAbsolutePath();
@@ -311,11 +318,11 @@ public class ReconnectDUnitTest extends CacheTestCase
           Thread recreateCacheThread = new Thread("ReconnectDUnitTest.createInAppThread") {
             public void run() {
               while (!cache.isClosed()) {
-                pause(100);
+                Wait.pause(100);
               }
               try {
                 new CacheFactory(props).create();
-                getLogWriter().error("testReconnectCollidesWithApplication failed - application thread was able to create a cache");
+                LogWriterUtils.getLogWriter().error("testReconnectCollidesWithApplication failed - application thread was able to create a cache");
               } catch (IllegalStateException cacheExists) {
                 // expected
               }
@@ -335,7 +342,7 @@ public class ReconnectDUnitTest extends CacheTestCase
       public Object call() {
         final DistributedSystem ds = ReconnectDUnitTest.savedSystem;
         ReconnectDUnitTest.savedSystem = null;
-        waitForCriterion(new WaitCriterion() {
+        Wait.waitForCriterion(new WaitCriterion() {
           public boolean done() {
             return ds.isReconnecting();
           }
@@ -343,8 +350,8 @@ public class ReconnectDUnitTest extends CacheTestCase
             return "waiting for ds to begin reconnecting";
           }
         }, 30000, 1000, true);
-        getLogWriter().info("entering reconnect wait for " + ds);
-        getLogWriter().info("ds.isReconnecting() = " + ds.isReconnecting());
+        LogWriterUtils.getLogWriter().info("entering reconnect wait for " + ds);
+        LogWriterUtils.getLogWriter().info("ds.isReconnecting() = " + ds.isReconnecting());
         boolean failure = true;
         try {
           ds.waitUntilReconnected(60, TimeUnit.SECONDS);
@@ -357,7 +364,7 @@ public class ReconnectDUnitTest extends CacheTestCase
           failure = false;
           return ds.getReconnectedSystem().getDistributedMember();
         } catch (InterruptedException e) {
-          getLogWriter().warning("interrupted while waiting for reconnect");
+          LogWriterUtils.getLogWriter().warning("interrupted while waiting for reconnect");
           return null;
         } finally {
           if (failure) {
@@ -373,7 +380,7 @@ public class ReconnectDUnitTest extends CacheTestCase
       public Object call() {
         final DistributedSystem ds = ReconnectDUnitTest.savedSystem;
         ReconnectDUnitTest.savedSystem = null;
-        waitForCriterion(new WaitCriterion() {
+        Wait.waitForCriterion(new WaitCriterion() {
           public boolean done() {
             return ds.isReconnecting() || ds.getReconnectedSystem() != null;
           }
@@ -386,7 +393,7 @@ public class ReconnectDUnitTest extends CacheTestCase
         assertFalse(ds.isReconnecting());
         DistributedSystem newDs = InternalDistributedSystem.getAnyInstance();
         if (newDs != null) {
-          getLogWriter().warning("expected distributed system to be disconnected: " + newDs);
+          LogWriterUtils.getLogWriter().warning("expected distributed system to be disconnected: " + newDs);
           return false;
         }
         return true;
@@ -399,8 +406,8 @@ public class ReconnectDUnitTest extends CacheTestCase
     forceDisconnect(vm1);
     newdm = waitForReconnect(vm1);
     assertNotSame("expected a reconnect to occur in member", dm, newdm);
-    deleteLocatorStateFile(locPort);
-    deleteLocatorStateFile(secondLocPort);
+    DistributedTestUtils.deleteLocatorStateFile(locPort);
+    DistributedTestUtils.deleteLocatorStateFile(secondLocPort);
   }
   
   private DistributedMember getDMID(VM vm) {
@@ -418,7 +425,7 @@ public class ReconnectDUnitTest extends CacheTestCase
     	System.out.println("waitForReconnect invoked");
         final DistributedSystem ds = ReconnectDUnitTest.savedSystem;
         ReconnectDUnitTest.savedSystem = null;
-        waitForCriterion(new WaitCriterion() {
+        Wait.waitForCriterion(new WaitCriterion() {
           public boolean done() {
             return ds.isReconnecting();
           }
@@ -427,7 +434,7 @@ public class ReconnectDUnitTest extends CacheTestCase
           }
         }, 30000, 1000, true);
         long waitTime = 120;
-        getLogWriter().info("VM"+VM.getCurrentVMNum() + " waiting up to "+waitTime+" seconds for reconnect to complete");
+        LogWriterUtils.getLogWriter().info("VM"+VM.getCurrentVMNum() + " waiting up to "+waitTime+" seconds for reconnect to complete");
         try {
           ds.waitUntilReconnected(waitTime, TimeUnit.SECONDS);
         } catch (InterruptedException e) {
@@ -455,7 +462,7 @@ public class ReconnectDUnitTest extends CacheTestCase
     final int locPort = locatorPort;
     final int secondLocPort = AvailablePortHelper.getRandomAvailableTCPPort();
 
-    deleteLocatorStateFile(locPort, secondLocPort);
+    DistributedTestUtils.deleteLocatorStateFile(locPort, secondLocPort);
 
     final String xmlFileLoc = (new File(".")).getAbsolutePath();
 
@@ -476,7 +483,7 @@ public class ReconnectDUnitTest extends CacheTestCase
         try {
           Locator.startLocatorAndDS(secondLocPort, null, props);
         } catch (IOException e) {
-          fail("exception starting locator", e);
+          Assert.fail("exception starting locator", e);
         }
       }
     });
@@ -525,13 +532,13 @@ public class ReconnectDUnitTest extends CacheTestCase
               return "waiting for locator to restart";
             }
           };
-          waitForCriterion(wc, 30000, 1000, false);
+          Wait.waitForCriterion(wc, 30000, 1000, false);
           if (Locator.getLocator() == null) {
-            getLogWriter().error("expected to find a running locator but getLocator() returns null");
+            LogWriterUtils.getLogWriter().error("expected to find a running locator but getLocator() returns null");
             return false;
           }
           if (((InternalLocator)Locator.getLocator()).isStopped()) {
-            getLogWriter().error("found a stopped locator");
+            LogWriterUtils.getLogWriter().error("found a stopped locator");
             return false;
           }
           return true;
@@ -563,8 +570,8 @@ public class ReconnectDUnitTest extends CacheTestCase
           gfshThread = null;
         }
       });
-      deleteLocatorStateFile(locPort);
-      deleteLocatorStateFile(secondLocPort);
+      DistributedTestUtils.deleteLocatorStateFile(locPort);
+      DistributedTestUtils.deleteLocatorStateFile(secondLocPort);
     }
   }
   
@@ -620,7 +627,7 @@ public class ReconnectDUnitTest extends CacheTestCase
     locatorPort = locPort;
     Properties config = getDistributedSystemProperties();
     config.put(DistributionConfig.ROLES_NAME, "");
-    config.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+    config.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
 //    config.put("log-file", "roleLossController.log");
     //creating the DS
     getSystem(config);
@@ -644,12 +651,12 @@ public class ReconnectDUnitTest extends CacheTestCase
       pw.close();
     }
     catch (IOException ex) {
-      fail("IOException during cache.xml generation to " + file, ex);
+      Assert.fail("IOException during cache.xml generation to " + file, ex);
     }
     closeCache();
     getSystem().disconnect();
 
-    getLogWriter().info("disconnected from the system...");
+    LogWriterUtils.getLogWriter().info("disconnected from the system...");
     Host host = Host.getHost(0);
 
     VM vm0 = host.getVM(0);
@@ -660,14 +667,14 @@ public class ReconnectDUnitTest extends CacheTestCase
         "ROLERECONNECTTESTS") {
       public void run2() throws CacheException, RuntimeException
       {
-        getLogWriter().info("####### STARTING THE REAL TEST ##########");
+        LogWriterUtils.getLogWriter().info("####### STARTING THE REAL TEST ##########");
         locatorPort = locPort;
         Properties props = getDistributedSystemProperties();
         props.put("cache-xml-file", xmlFileLoc+File.separator+"RoleReconnect-cache.xml");
         props.put("max-wait-time-reconnect", "200");
         final int timeReconnect = 3;
         props.put("max-num-reconnect-tries", "3");
-        props.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+        props.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
         props.put("log-file", "roleLossVM0.log");
 
         getSystem(props);
@@ -681,13 +688,13 @@ public class ReconnectDUnitTest extends CacheTestCase
           throw new RuntimeException("The test should throw a CancelException ");
         }
         catch (CancelException ignor){ // can be caused by role loss during intialization.
-          getLogWriter().info("Got Expected CancelException ");
+          LogWriterUtils.getLogWriter().info("Got Expected CancelException ");
         }
         finally {
           system.getLogWriter().info("<ExpectedException action=remove>" 
               + "CacheClosedException" + "</ExpectedException");
         }
-        getLogWriter().fine("roleLoss Sleeping SO call dumprun.sh");
+        LogWriterUtils.getLogWriter().fine("roleLoss Sleeping SO call dumprun.sh");
         WaitCriterion ev = new WaitCriterion() {
           public boolean done() {
             return reconnectTries >= timeReconnect;
@@ -696,8 +703,8 @@ public class ReconnectDUnitTest extends CacheTestCase
             return "Waiting for reconnect count " + timeReconnect + " currently " + reconnectTries;
           }
         };
-        DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
-        getLogWriter().fine("roleLoss done Sleeping");
+        Wait.waitForCriterion(ev, 60 * 1000, 200, true);
+        LogWriterUtils.getLogWriter().fine("roleLoss done Sleeping");
         assertEquals(timeReconnect,
             reconnectTries);
       }
@@ -753,7 +760,7 @@ public class ReconnectDUnitTest extends CacheTestCase
     locatorPort = locPort;
     Properties config = getDistributedSystemProperties();
     config.put(DistributionConfig.ROLES_NAME, "");
-    config.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+    config.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
     //creating the DS
     getSystem(config);
 
@@ -777,7 +784,7 @@ public class ReconnectDUnitTest extends CacheTestCase
       pw.close();
     }
     catch (IOException ex) {
-      fail("IOException during cache.xml generation to " + file, ex);
+      Assert.fail("IOException during cache.xml generation to " + file, ex);
     }
     closeCache();
     //disconnectFromDS();
@@ -807,7 +814,7 @@ public class ReconnectDUnitTest extends CacheTestCase
             + " trying to reconnect");
     final AsyncInvocation roleLossAsync = vm0.invokeAsync(roleLoss);
     
-    getLogWriter().info("waiting for role loss vm to start reconnect attempts");
+    LogWriterUtils.getLogWriter().info("waiting for role loss vm to start reconnect attempts");
 
     WaitCriterion ev = new WaitCriterion() {
       public boolean done() {
@@ -824,7 +831,7 @@ public class ReconnectDUnitTest extends CacheTestCase
         return "waiting for event";
       }
     };
-    DistributedTestCase.waitForCriterion(ev, 120 * 1000, 200, true);
+    Wait.waitForCriterion(ev, 120 * 1000, 200, true);
 
     VM vm2 = host.getVM(2);
     if (roleLossAsync.isAlive()) {
@@ -848,17 +855,17 @@ public class ReconnectDUnitTest extends CacheTestCase
           getLogWriter().severe("Exception : "+ee);
         }
       }*/
-      getLogWriter().info("waiting for vm0 to finish reconnecting");
-      DistributedTestCase.join(roleLossAsync, 120 * 1000, getLogWriter());
+      LogWriterUtils.getLogWriter().info("waiting for vm0 to finish reconnecting");
+      ThreadUtils.join(roleLossAsync, 120 * 1000);
     }
 
     if (roleLossAsync.getException() != null){
-      fail("Exception in Vm0", roleLossAsync.getException());
+      Assert.fail("Exception in Vm0", roleLossAsync.getException());
     }
 
-    DistributedTestCase.join(avkVm1, 30 * 1000, getLogWriter());
+    ThreadUtils.join(avkVm1, 30 * 1000);
     if (avkVm1.getException() != null){
-      fail("Exception in Vm1", avkVm1.getException());
+      Assert.fail("Exception in Vm1", avkVm1.getException());
     }
 
   }
@@ -874,7 +881,7 @@ public class ReconnectDUnitTest extends CacheTestCase
         try {
           //  closeCache();
           //  getSystem().disconnect();
-          getLogWriter().info(startupMessage);
+          LogWriterUtils.getLogWriter().info(startupMessage);
           WaitCriterion ev = new WaitCriterion() {
             public boolean done() {
               return ((Boolean)otherVM.invoke(ReconnectDUnitTest.class, "isInitialRolePlayerStarted")).booleanValue();
@@ -883,15 +890,15 @@ public class ReconnectDUnitTest extends CacheTestCase
               return null;
             }
           };
-          DistributedTestCase.waitForCriterion(ev, 10 * 1000, 200, true);
+          Wait.waitForCriterion(ev, 10 * 1000, 200, true);
 
-          getLogWriter().info("Starting the test and creating the cache and regions etc ...");
+          LogWriterUtils.getLogWriter().info("Starting the test and creating the cache and regions etc ...");
           locatorPort = locPort;
           Properties props = getDistributedSystemProperties();
           props.put("cache-xml-file", "RoleRegained.xml");
           props.put("max-wait-time-reconnect", "3000");
           props.put("max-num-reconnect-tries", "8");
-          props.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+          props.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
 
           getSystem(props);
           system.getLogWriter().info("<ExpectedException action=add>" 
@@ -901,7 +908,7 @@ public class ReconnectDUnitTest extends CacheTestCase
             getCache();
           } catch (CancelException e) {
             // can happen if RoleA goes away during initialization
-            getLogWriter().info("cache threw CancelException while creating the cache");      
+            LogWriterUtils.getLogWriter().info("cache threw CancelException while creating the cache");      
           }
           
           initialized = true;
@@ -910,14 +917,14 @@ public class ReconnectDUnitTest extends CacheTestCase
 
           ev = new WaitCriterion() {
             public boolean done() {
-              getLogWriter().info("ReconnectTries=" + reconnectTries);
+              LogWriterUtils.getLogWriter().info("ReconnectTries=" + reconnectTries);
               return reconnectTries != 0;
             }
             public String description() {
               return null;
             }
           };
-          DistributedTestCase.waitForCriterion(ev, 30 * 1000, 200, true);
+          Wait.waitForCriterion(ev, 30 * 1000, 200, true);
 
           //        long startTime = System.currentTimeMillis();
 
@@ -967,8 +974,8 @@ public class ReconnectDUnitTest extends CacheTestCase
                   excuse = "value is wrong";
                   return false;
                 }
-                getLogWriter().info("All assertions passed");
-                getLogWriter().info("MyKey : "+key+" and myvalue : "+value);
+                LogWriterUtils.getLogWriter().info("All assertions passed");
+                LogWriterUtils.getLogWriter().info("MyKey : "+key+" and myvalue : "+value);
                 return true;
               }
               catch (CancelException ecc){ 
@@ -979,7 +986,7 @@ public class ReconnectDUnitTest extends CacheTestCase
 
               }
               finally {
-                getLogWriter().info("waiting for reconnect.  Current status is '"+excuse+"'");
+                LogWriterUtils.getLogWriter().info("waiting for reconnect.  Current status is '"+excuse+"'");
               }
               return false;
             }
@@ -988,7 +995,7 @@ public class ReconnectDUnitTest extends CacheTestCase
             }
           };
 
-          DistributedTestCase.waitForCriterion(ev,  60 * 1000, 200, true); // was 5 * 60 * 1000
+          Wait.waitForCriterion(ev,  60 * 1000, 200, true); // was 5 * 60 * 1000
 
           Cache cache = CacheFactory.getAnyInstance();
           if (cache != null) {
@@ -1000,11 +1007,11 @@ public class ReconnectDUnitTest extends CacheTestCase
           throw e;
         }
         catch (Error th) {
-          getLogWriter().severe("DEBUG", th);
+          LogWriterUtils.getLogWriter().severe("DEBUG", th);
           throw th;
         } finally {
           if (t != null) {
-            DistributedTestCase.join(t, 2 * 60 * 1000, getLogWriter());
+            ThreadUtils.join(t, 2 * 60 * 1000);
           }
           // greplogs won't care if you remove an exception that was never added,
           // and this ensures that it gets removed.
@@ -1024,12 +1031,12 @@ public class ReconnectDUnitTest extends CacheTestCase
         "second RoleA player") {
       public void run2() throws CacheException
       {
-        getLogWriter().info(startupMessage);
+        LogWriterUtils.getLogWriter().info(startupMessage);
         //closeCache();
         // getSystem().disconnect();
         locatorPort = locPort;
         Properties props = getDistributedSystemProperties();
-        props.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+        props.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
         props.put(DistributionConfig.ROLES_NAME, "RoleA");
 
         getSystem(props);
@@ -1040,7 +1047,7 @@ public class ReconnectDUnitTest extends CacheTestCase
 
         RegionAttributes attr = fac.create();
         Region region = createRootRegion(regionName, attr);
-        getLogWriter().info("STARTED THE REQUIREDROLES CACHE");
+        LogWriterUtils.getLogWriter().info("STARTED THE REQUIREDROLES CACHE");
         try{
           Thread.sleep(120);
         }
@@ -1057,7 +1064,7 @@ public class ReconnectDUnitTest extends CacheTestCase
         catch(InterruptedException ee){
           fail("interrupted");
         }
-        getLogWriter().info("RolePlayer is done...");
+        LogWriterUtils.getLogWriter().info("RolePlayer is done...");
 
 
       }
@@ -1076,10 +1083,10 @@ public class ReconnectDUnitTest extends CacheTestCase
       {
         //  closeCache();
         // getSystem().disconnect();
-        getLogWriter().info(startupMessage);
+        LogWriterUtils.getLogWriter().info(startupMessage);
         locatorPort = locPort;
         Properties props = getDistributedSystemProperties();
-        props.put(DistributionConfig.LOG_LEVEL_NAME, getDUnitLogLevel());
+        props.put(DistributionConfig.LOG_LEVEL_NAME, LogWriterUtils.getDUnitLogLevel());
         props.put(DistributionConfig.ROLES_NAME, "RoleA");
 
         getSystem(props);
@@ -1090,7 +1097,7 @@ public class ReconnectDUnitTest extends CacheTestCase
 
         RegionAttributes attr = fac.create();
         createRootRegion(regionName, attr);
-        getLogWriter().info("STARTED THE REQUIREDROLES CACHE");
+        LogWriterUtils.getLogWriter().info("STARTED THE REQUIREDROLES CACHE");
         initialRolePlayerStarted = true;
 
         while(!((Boolean)otherVM.invoke(ReconnectDUnitTest.class, "isInitialized")).booleanValue()){
@@ -1100,7 +1107,7 @@ public class ReconnectDUnitTest extends CacheTestCase
             fail("interrupted");
           }
         }
-        getLogWriter().info("RoleAPlayerInitializer is done...");
+        LogWriterUtils.getLogWriter().info("RoleAPlayerInitializer is done...");
         closeCache();
 
       }
@@ -1110,10 +1117,10 @@ public class ReconnectDUnitTest extends CacheTestCase
   
   void addReconnectListener() {
     reconnectTries = 0; // reset the count for this listener
-    getLogWriter().info("adding reconnect listener");
+    LogWriterUtils.getLogWriter().info("adding reconnect listener");
     ReconnectListener reconlis = new ReconnectListener() {
       public void reconnecting(InternalDistributedSystem oldSys) {
-        getLogWriter().info("reconnect listener invoked");
+        LogWriterUtils.getLogWriter().info("reconnect listener invoked");
         reconnectTries++;
       }
       public void onReconnect(InternalDistributedSystem system1, InternalDistributedSystem system2) {}
@@ -1145,7 +1152,7 @@ public class ReconnectDUnitTest extends CacheTestCase
               return "waiting for locator to start reconnecting: " + oldLocator;
             }
           };
-          waitForCriterion(wc, 10000, 50, true);
+          Wait.waitForCriterion(wc, 10000, 50, true);
         }
         return true;
       }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectedCacheServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectedCacheServerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectedCacheServerDUnitTest.java
index e408a6d..2b97a9a 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectedCacheServerDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/ReconnectedCacheServerDUnitTest.java
@@ -41,7 +41,7 @@ public class ReconnectedCacheServerDUnitTest extends CacheTestCase {
   }
   
   @Override
-  public void tearDown2() {
+  protected final void preTearDownCacheTestCase() throws Exception {
     if (addedCacheServer && cache != null && !cache.isClosed()) {
       // since I polluted the cache I should shut it down in order
       // to avoid affecting other tests

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionExpirationDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionExpirationDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionExpirationDUnitTest.java
index af10e85..4187aaf 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionExpirationDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionExpirationDUnitTest.java
@@ -23,9 +23,11 @@ import com.gemstone.gemfire.cache.ExpirationAttributes;
 import com.gemstone.gemfire.cache.Region;
 import com.gemstone.gemfire.cache.RegionAttributes;
 import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
 
 /**
  * Test Region expiration - both time-to-live and idle timeout.
@@ -124,7 +126,7 @@ public class RegionExpirationDUnitTest extends CacheTestCase {
         return "region never destroyed";
       }
     };
-    DistributedTestCase.waitForCriterion(wc, 30 * 1000, 1000, true);
+    Wait.waitForCriterion(wc, 30 * 1000, 1000, true);
   }
 
   public void testWhenBothTtlAndIdleAreSet() 
@@ -162,9 +164,9 @@ public class RegionExpirationDUnitTest extends CacheTestCase {
     Host host = Host.getHost(0);
     VM vm0 = host.getVM(0);
     VM vm1 = host.getVM(1);
-    getLogWriter().info("vm0 is " + vm0.getPid() + ", vm1 is " + vm1);
+    LogWriterUtils.getLogWriter().info("vm0 is " + vm0.getPid() + ", vm1 is " + vm1);
 
-    getLogWriter().info("2: " + regionName + " action is " + action);
+    LogWriterUtils.getLogWriter().info("2: " + regionName + " action is " + action);
 
     final long tilt = System.currentTimeMillis() + timeoutSecs * 1000;
 
@@ -216,7 +218,7 @@ public class RegionExpirationDUnitTest extends CacheTestCase {
     vm0.invoke(new CacheSerializableRunnable("Get") {
         public void run2() throws CacheException {
           Region region = getRootRegion().getSubregion(regionName);
-          getLogWriter().info("3: " + regionName + ", " + region + ", action is " + action);
+          LogWriterUtils.getLogWriter().info("3: " + regionName + ", " + region + ", action is " + action);
           if (action.isInvalidate() || action.isLocalInvalidate()) {
             assertTrue(!region.containsValueForKey(key));
           } else {
@@ -253,7 +255,7 @@ public class RegionExpirationDUnitTest extends CacheTestCase {
     factory.setScope(Scope.DISTRIBUTED_ACK);
     factory.setEarlyAck(false);
     RegionAttributes attrs = factory.create();
-    getLogWriter().info("4: " + regionName + " ttl action is " + ttl);
+    LogWriterUtils.getLogWriter().info("4: " + regionName + " ttl action is " + ttl);
     getOrCreateRootRegion().createSubregion(regionName, attrs);
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
index 8ecb00a..d539b82 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionMembershipListenerDUnitTest.java
@@ -37,9 +37,11 @@ import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManage
 import com.gemstone.gemfire.internal.cache.CacheDistributionAdvisor.CacheProfile;
 import com.gemstone.gemfire.internal.cache.DistributedRegion;
 import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
 
 /**
  * Test {@link RegionMembershipListener}
@@ -66,8 +68,7 @@ public class RegionMembershipListenerDUnitTest extends CacheTestCase {
   }
   
   @Override
-  public void tearDown2() throws Exception {
-    super.tearDown2();
+  protected final void postTearDownCacheTestCase() throws Exception {
     DistributedRegion.TEST_HOOK_ADD_PROFILE = false;
   }
 
@@ -366,9 +367,9 @@ public class RegionMembershipListenerDUnitTest extends CacheTestCase {
           return MyRML.this.toString() + " waiting for Op " + op + " when lastOp was " + getOpName(MyRML.this.lastOp);
         }
       };
-      getLogWriter().info(this.toString() + " waiting for Op " + getOpName(op)
+      LogWriterUtils.getLogWriter().info(this.toString() + " waiting for Op " + getOpName(op)
           + " when lastOp was " + getOpName(this.lastOp));
-      DistributedTestCase.waitForCriterion(ev, this.timeOut, 200, true);
+      Wait.waitForCriterion(ev, this.timeOut, 200, true);
       assertEquals(op, this.lastOp);
       return true;
     }
@@ -387,7 +388,7 @@ public class RegionMembershipListenerDUnitTest extends CacheTestCase {
       this.lastOp = Op.Initial;
       this.lastEvent = null;
       this.initialMembers = initialMembers;
-      getLogWriter().info(this.toString() + " received initialMembers notification for region " + r
+      LogWriterUtils.getLogWriter().info(this.toString() + " received initialMembers notification for region " + r
           + " with members " + Arrays.deepToString(initialMembers));
     }
     public void afterRemoteRegionCreate(RegionEvent event) {
@@ -397,23 +398,23 @@ public class RegionMembershipListenerDUnitTest extends CacheTestCase {
       if (cacheProfile != null) {
         this.memberInitialized = cacheProfile.regionInitialized;
         if (!this.memberInitialized) {
-          getLogWriter().warning("afterRemoteRegionCreate invoked when member is not done initializing!", new Exception("stack trace"));
+          LogWriterUtils.getLogWriter().warning("afterRemoteRegionCreate invoked when member is not done initializing!", new Exception("stack trace"));
         }
-        getLogWriter().info(this.toString() + " received afterRemoteRegionCreate notification for event " + event);
+        LogWriterUtils.getLogWriter().info(this.toString() + " received afterRemoteRegionCreate notification for event " + event);
       } else {
-        getLogWriter().warning("afterRemoteRegionCreate was expecting a profile in the event callback but there was none. " +
+        LogWriterUtils.getLogWriter().warning("afterRemoteRegionCreate was expecting a profile in the event callback but there was none. " +
         		" This indicates a problem with the test hook DistributedRegion.TEST_HOOK_ADD_PROFILE");
       }
     }
     public void afterRemoteRegionDeparture(RegionEvent event) {
       this.lastOp = Op.Departure;
       this.lastEvent = event;
-      getLogWriter().info(this.toString() + " received afterRemoteRegionDeparture notification for event " + event);
+      LogWriterUtils.getLogWriter().info(this.toString() + " received afterRemoteRegionDeparture notification for event " + event);
     }
     public void afterRemoteRegionCrash(RegionEvent event) {
       this.lastOp = Op.Crash;
       this.lastEvent = event;
-      getLogWriter().info(this.toString() + " received afterRemoteRegionCrash notification for event " + event);
+      LogWriterUtils.getLogWriter().info(this.toString() + " received afterRemoteRegionCrash notification for event " + event);
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
index 26108cd..2ae8293 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionReliabilityTestCase.java
@@ -65,9 +65,11 @@ import com.gemstone.gemfire.internal.cache.TXManagerImpl;
 import com.gemstone.gemfire.internal.cache.TXState;
 import com.gemstone.gemfire.internal.cache.TXStateInterface;
 import com.gemstone.gemfire.internal.cache.TXStateProxyImpl;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
 
 /**
  * Tests region reliability defined by MembershipAttributes.
@@ -82,9 +84,8 @@ public abstract class RegionReliabilityTestCase extends ReliabilityTestCase {
   }
 
   @Override
-  public void tearDown2() throws java.lang.Exception {
+  protected final void preTearDownCacheTestCase() throws Exception {
     DistributedCacheOperation.setBeforePutOutgoing(null);
-    super.tearDown2();
   }
 
   // -------------------------------------------------------------------------
@@ -825,7 +826,7 @@ public abstract class RegionReliabilityTestCase extends ReliabilityTestCase {
         return "expected zero entries but have " + ((LocalRegion) region).basicEntries(false).size();
       }
     };
-    DistributedTestCase.waitForCriterion(wc1, 30*1000, 10, true);
+    Wait.waitForCriterion(wc1, 30*1000, 10, true);
 
     // create region again
     Host.getHost(0).getVM(1).invoke(new CacheSerializableRunnable("Create Region") {
@@ -1007,7 +1008,7 @@ public abstract class RegionReliabilityTestCase extends ReliabilityTestCase {
         return "expected region " + region + " to be destroyed";
       }
     };
-    DistributedTestCase.waitForCriterion(wc, 30*1000, 10, true);
+    Wait.waitForCriterion(wc, 30*1000, 10, true);
   }
   
   public static void waitForEntryDestroy(final Region region, final Object key) {
@@ -1019,7 +1020,7 @@ public abstract class RegionReliabilityTestCase extends ReliabilityTestCase {
         return "expected entry " + key + " to not exist but it has the value " + region.get(key);
       }
     };
-    DistributedTestCase.waitForCriterion(wc, 30*1000, 10, true);
+    Wait.waitForCriterion(wc, 30*1000, 10, true);
   }
   
   /**
@@ -1412,7 +1413,7 @@ public abstract class RegionReliabilityTestCase extends ReliabilityTestCase {
       }
     });
     
-    DistributedTestCase.join(thread, 30 * 1000, getLogWriter());
+    ThreadUtils.join(thread, 30 * 1000);
     assertTrue(region.isDestroyed());
     try {
       region.put("fee", "fi");

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
index 9c3add6..ed89a13 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RegionTestCase.java
@@ -58,10 +58,11 @@ import com.gemstone.gemfire.internal.cache.EntryExpiryTask;
 import com.gemstone.gemfire.internal.cache.EntrySnapshot;
 import com.gemstone.gemfire.internal.cache.ExpiryTask;
 import com.gemstone.gemfire.internal.cache.LocalRegion;
-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.VM;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
 
 //import com.gemstone.gemfire.internal.util.DebuggerSupport;
 
@@ -109,23 +110,14 @@ public abstract class RegionTestCase extends CacheTestCase {
     super(name);
   }
   
-  public void tearDown2() throws Exception {
-    super.tearDown2();
+  @Override
+  protected final void postTearDownCacheTestCase() throws Exception {
     cleanup();
-    invokeInEveryVM(getClass(), "cleanup");
-    /*for (int h = 0; h < Host.getHostCount(); h++) {
-      Host host = Host.getHost(h);
-      for (int v = 0; v < host.getVMCount(); v++) {
-        host.getVM(v).invoke(new SerializableRunnable("Clean up") {
-            public void run() {
-              cleanup();
-            }
-          });
-// already called in every VM in super.tearDown
-// host.getVM(v).invoke(this.getClass(), "remoteTearDown");
-      }
-    }*/
-    super.tearDown2();
+    Invoke.invokeInEveryVM(getClass(), "cleanup");
+    postTearDownRegionTestCase();
+  }
+  
+  protected void postTearDownRegionTestCase() throws Exception {
   }
   
   ////////  Helper methods
@@ -268,7 +260,7 @@ public abstract class RegionTestCase extends CacheTestCase {
       assertEquals(value, values.iterator().next());
     }
     catch (UnsupportedOperationException uoe) {
-      getLogWriter().info("Region.values() reported UnsupportedOperation");
+      com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Region.values() reported UnsupportedOperation");
     }
   }
   
@@ -472,7 +464,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     region.destroy(key);
     
     Region.Entry entry2 = region.getEntry(key);
-    getLogWriter().info("Found entry for destroyed key: " + entry2);
+    com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().info("Found entry for destroyed key: " + entry2);
     assertNull(entry2);
     if (entry.isLocal()) {
       assertTrue(entry.isDestroyed());
@@ -1979,11 +1971,11 @@ public abstract class RegionTestCase extends CacheTestCase {
         break;
       }
       if (!wasInvalidated) {
-        pause(pauseMs);
+        Wait.pause(pauseMs);
         continue;
       }
       if (now >= tilt - SLOP) {
-        getLogWriter().warning("Entry invalidated sloppily "
+        com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().warning("Entry invalidated sloppily "
             + "now=" + now + " tilt=" + tilt + " delta = " + (tilt - now));
         break;
       }
@@ -2003,7 +1995,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         if (fetchEntryValue(entry) == null) break;
         fail("Entry failed to invalidate");
       }
-      pause(pauseMs);
+      Wait.pause(pauseMs);
     }
   }
 
@@ -2050,11 +2042,11 @@ public abstract class RegionTestCase extends CacheTestCase {
       if (now >= tilt)
         break;
       if (!isEntryDestroyed(entry)) {
-        pause(pauseMs);
+        Wait.pause(pauseMs);
         continue;
       }
       if (now >= tilt - SLOP) {
-        getLogWriter().warning("Entry destroyed sloppily "
+        com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().warning("Entry destroyed sloppily "
             + "now=" + now + " tilt=" + tilt + " delta = " + (tilt - now));
         break;
       }
@@ -2072,7 +2064,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         break;
       Assert.assertTrue(System.currentTimeMillis() <= tilt,
           "Entry failed to destroy");
-      pause(pauseMs);
+      Wait.pause(pauseMs);
     }
   }
   
@@ -2094,11 +2086,11 @@ public abstract class RegionTestCase extends CacheTestCase {
       if (now >= tilt)
         break;
       if (!region.isDestroyed()) {
-        pause(10);
+        Wait.pause(10);
         continue;
       }
       if (now >= tilt - SLOP) {
-        getLogWriter().warning("Region destroyed sloppily "
+        com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter().warning("Region destroyed sloppily "
             + "now=" + now + " tilt=" + tilt + " delta = " + (tilt - now));
         break;
       }
@@ -2116,7 +2108,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         break;
       Assert.assertTrue(System.currentTimeMillis() <= tilt,
           "Region failed to destroy");
-      pause(10);
+      Wait.pause(10);
     }
   }  
 
@@ -2201,7 +2193,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     
     // Random values should not expire
     region.put(key1, value);
-    pause(timeout * 2);
+    Wait.pause(timeout * 2);
     assert(region.get(key1).equals(value));
     
     // key2 *should* expire
@@ -2260,7 +2252,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     region.create(key1, value);
     
     // This value should NOT expire.
-    pause(timeout * 2);
+    Wait.pause(timeout * 2);
     assertTrue(region.get(key1).equals(value));
     
     // This value SHOULD expire
@@ -2363,7 +2355,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         ExpiryTask.permitExpiration();
       }
       waitForInvalidate(entry, tilt1, timeout1/2);
-      DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
+      Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
       eventCount = 0;
 
       // Do it again with a put (I guess)
@@ -2379,7 +2371,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         ExpiryTask.permitExpiration();
       }
       waitForInvalidate(entry, tilt1, timeout1/2);
-      DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
+      Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
       eventCount = 0;
 
       // Change custom expiry for this region now...
@@ -2405,7 +2397,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         ExpiryTask.permitExpiration();
       }
       waitForInvalidate(entry, tilt2, timeout2/2);
-      DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
+      Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 100, true);
       eventCount = 0;
       // key1 should not be invalidated since we mutated to custom expiry to only expire key2
       entry = region.getEntry(key1);
@@ -2480,7 +2472,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     assertEquals(0, eventCount);
     
     // now set it to a really short time and make sure it expires immediately
-    waitForExpiryClockToChange(region);
+    Wait.waitForExpiryClockToChange(region);
     final Region.Entry entry = region.getEntry(key1);
     mutt = region.getAttributesMutator();
     ExpirationAttributes expire4 = new ExpirationAttributes(1, ExpirationAction.INVALIDATE);
@@ -2493,7 +2485,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         return "entry never became invalid";
       }
     };
-    DistributedTestCase.waitForCriterion(wc, 10 * 1000, 10, true);
+    Wait.waitForCriterion(wc, 10 * 1000, 10, true);
 
     WaitCriterion waitForEventCountToBeOne = new WaitCriterion() {
       public boolean done() {
@@ -2503,7 +2495,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         return "eventCount never became 1";
       }
     };
-    DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
+    Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
     eventCount = 0;
   }
 
@@ -2933,7 +2925,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     region.create(key1, value);
     
     // This value should NOT expire.
-    pause(timeout * 2);
+    Wait.pause(timeout * 2);
     assertTrue(region.get(key1).equals(value));
     
     // This value SHOULD expire
@@ -3013,7 +3005,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     region.create(key2, value);
     
     // This value should NOT expire.
-    pause(timeout * 2);
+    Wait.pause(timeout * 2);
     assertTrue(region.get(key2).equals(value));
     
     // This value SHOULD expire
@@ -3114,7 +3106,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     assertEquals(0, eventCount);
     
     // now set it to a really short time and make sure it expires immediately
-    waitForExpiryClockToChange(region);
+    Wait.waitForExpiryClockToChange(region);
     final Region.Entry entry = region.getEntry(key1);
     mutt = region.getAttributesMutator();
     ExpirationAttributes expire4 = new ExpirationAttributes(1, ExpirationAction.INVALIDATE);
@@ -3127,7 +3119,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         return "entry never became invalid";
       }
     };
-    DistributedTestCase.waitForCriterion(wc, 10 * 1000, 10, true);
+    Wait.waitForCriterion(wc, 10 * 1000, 10, true);
 
     WaitCriterion waitForEventCountToBeOne = new WaitCriterion() {
       public boolean done() {
@@ -3137,7 +3129,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         return "eventCount never became 1";
       }
     };
-    DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
+    Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
     eventCount = 0;
   }
 
@@ -3201,7 +3193,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     assertEquals(0, eventCount);
     
     // now set it to a really short time and make sure it expires immediately
-    waitForExpiryClockToChange(region);
+    Wait.waitForExpiryClockToChange(region);
     final Region.Entry entry = region.getEntry(key1);
     mutt = region.getAttributesMutator();
     ExpirationAttributes expire4 = new ExpirationAttributes(1, ExpirationAction.INVALIDATE);
@@ -3214,7 +3206,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         return "entry never became invalid";
       }
     };
-    DistributedTestCase.waitForCriterion(wc, 10 * 1000, 10, true);
+    Wait.waitForCriterion(wc, 10 * 1000, 10, true);
 
     WaitCriterion waitForEventCountToBeOne = new WaitCriterion() {
       public boolean done() {
@@ -3224,7 +3216,7 @@ public abstract class RegionTestCase extends CacheTestCase {
         return "eventCount never became 1";
       }
     };
-    DistributedTestCase.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
+    Wait.waitForCriterion(waitForEventCountToBeOne, 10 * 1000, 10, true);
     eventCount = 0;
   }
 
@@ -3413,7 +3405,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     
     // Random values should not expire
     region.put(key1, value);
-    pause(timeout * 2);
+    Wait.pause(timeout * 2);
     assert(region.get(key1).equals(value));
     
     // key2 *should* expire
@@ -3487,14 +3479,14 @@ public abstract class RegionTestCase extends CacheTestCase {
       assertNotNull(entry.getValue());
       EntryExpiryTask eet = region.getEntryExpiryTask(key1);
       final long createExpiryTime = eet.getExpirationTime();
-      waitForExpiryClockToChange(region);
+      Wait.waitForExpiryClockToChange(region);
       region.get(key1);
       assertSame(eet, region.getEntryExpiryTask(key1));
       final long getExpiryTime = eet.getExpirationTime();
       if (getExpiryTime - createExpiryTime <= 0L) {
         fail("get did not reset the expiration time. createExpiryTime=" + createExpiryTime + " getExpiryTime=" + getExpiryTime);
       }
-      waitForExpiryClockToChange(region);
+      Wait.waitForExpiryClockToChange(region);
       region.put(key1, value);
       assertSame(eet, region.getEntryExpiryTask(key1));
       final long putExpiryTime = eet.getExpirationTime();
@@ -3597,7 +3589,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     EntryExpiryTask eet = region.getEntryExpiryTask(key);
     long createExpiryTime = eet.getExpirationTime();
 
-    waitForExpiryClockToChange(region);
+    Wait.waitForExpiryClockToChange(region);
     region.get(key); // touch
     assertSame(eet, region.getEntryExpiryTask(key));
     long getExpiryTime = eet.getExpirationTime();
@@ -3605,7 +3597,7 @@ public abstract class RegionTestCase extends CacheTestCase {
       fail("get did not reset the expiration time. createExpiryTime=" + createExpiryTime + " getExpiryTime=" + getExpiryTime);
     }
     
-    waitForExpiryClockToChange(region);
+    Wait.waitForExpiryClockToChange(region);
     region.put(key, value); // touch
     assertSame(eet, region.getEntryExpiryTask(key));
     long putExpiryTime = eet.getExpirationTime();
@@ -3617,7 +3609,7 @@ public abstract class RegionTestCase extends CacheTestCase {
 
     // Now verify operations that do not modify the expiry time
     
-    waitForExpiryClockToChange(region);
+    Wait.waitForExpiryClockToChange(region);
     region.invalidate(key); // touch
     assertSame(eet, region.getEntryExpiryTask(key));
     long invalidateExpiryTime = eet.getExpirationTime();
@@ -3679,7 +3671,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     region.put(key, value);
     tilt = System.currentTimeMillis() + timeout;
     entry = region.getEntry(key);
-    pause(timeout * 2);
+    Wait.pause(timeout * 2);
     assertEquals(value, entry.getValue());
     region.getAttributesMutator().setEntryIdleTimeout(expire);
     waitForInvalidate(entry, tilt);
@@ -3715,7 +3707,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     if ((firstIdleExpiryTime - firstTTLExpiryTime) >= 0) {
       fail("idle should be less than ttl: idle=" + firstIdleExpiryTime + " ttl=" + firstTTLExpiryTime);
     }
-    waitForExpiryClockToChange(region);
+    Wait.waitForExpiryClockToChange(region);
     region.get(key);
     eet = region.getEntryExpiryTask(key);
     final long secondIdleExpiryTime = eet.getIdleExpirationTime();
@@ -3865,23 +3857,23 @@ public abstract class RegionTestCase extends CacheTestCase {
           ExpiryTask expiryTask = lr.getRegionIdleExpiryTask();
           region.put(key, value);
           long createExpiry = expiryTask.getExpirationTime();
-          long changeTime = waitForExpiryClockToChange(lr, createExpiry-EXPIRATION_MS);
+          long changeTime = Wait.waitForExpiryClockToChange(lr, createExpiry-EXPIRATION_MS);
           region.put(key, "VALUE2");
           long putExpiry = expiryTask.getExpirationTime();
           assertTrue("CLOCK went back in time! Expected putBaseExpiry=" + (putExpiry-EXPIRATION_MS) + " to be >= than changeTime=" + changeTime, (putExpiry-EXPIRATION_MS - changeTime) >= 0);
           assertTrue("expected putExpiry=" + putExpiry + " to be > than createExpiry=" + createExpiry, (putExpiry - createExpiry) > 0);
-          changeTime = waitForExpiryClockToChange(lr, putExpiry-EXPIRATION_MS);
+          changeTime = Wait.waitForExpiryClockToChange(lr, putExpiry-EXPIRATION_MS);
           region.get(key);
           long getExpiry = expiryTask.getExpirationTime();
           assertTrue("CLOCK went back in time! Expected getBaseExpiry=" + (getExpiry-EXPIRATION_MS) + " to be >= than changeTime=" + changeTime, (getExpiry-EXPIRATION_MS - changeTime) >= 0);
           assertTrue("expected getExpiry=" + getExpiry + " to be > than putExpiry=" + putExpiry, (getExpiry - putExpiry) > 0);
         
-          changeTime = waitForExpiryClockToChange(lr, getExpiry-EXPIRATION_MS);
+          changeTime = Wait.waitForExpiryClockToChange(lr, getExpiry-EXPIRATION_MS);
           sub.put(key, value);
           long subPutExpiry = expiryTask.getExpirationTime();
           assertTrue("CLOCK went back in time! Expected subPutBaseExpiry=" + (subPutExpiry-EXPIRATION_MS) + " to be >= than changeTime=" + changeTime, (subPutExpiry-EXPIRATION_MS - changeTime) >= 0);
           assertTrue("expected subPutExpiry=" + subPutExpiry + " to be > than getExpiry=" + getExpiry, (subPutExpiry - getExpiry) > 0);
-          changeTime = waitForExpiryClockToChange(lr, subPutExpiry-EXPIRATION_MS);
+          changeTime = Wait.waitForExpiryClockToChange(lr, subPutExpiry-EXPIRATION_MS);
           sub.get(key);
           long subGetExpiry = expiryTask.getExpirationTime();
           assertTrue("CLOCK went back in time! Expected subGetBaseExpiry=" + (subGetExpiry-EXPIRATION_MS) + " to be >= than changeTime=" + changeTime, (subGetExpiry-EXPIRATION_MS - changeTime) >= 0);
@@ -3950,7 +3942,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     // create region in other VMs if distributed
     boolean isDistributed = getRegionAttributes().getScope().isDistributed();
     if (isDistributed) {
-      invokeInEveryVM(new CacheSerializableRunnable("create presnapshot region") {
+      Invoke.invokeInEveryVM(new CacheSerializableRunnable("create presnapshot region") {
         public void run2() throws CacheException {
           preSnapshotRegion = createRegion(name);
         }
@@ -3993,7 +3985,7 @@ public abstract class RegionTestCase extends CacheTestCase {
       
       // test postSnapshot behavior in other VMs if distributed
       if (isDistributed) {
-        invokeInEveryVM(new CacheSerializableRunnable("postSnapshot") {
+        Invoke.invokeInEveryVM(new CacheSerializableRunnable("postSnapshot") {
           public void run2() throws CacheException {
             RegionTestCase.this.remoteTestPostSnapshot(name, false, false);
           }
@@ -4014,7 +4006,7 @@ public abstract class RegionTestCase extends CacheTestCase {
     // create region in other VMs if distributed
     boolean isDistributed = getRegionAttributes().getScope().isDistributed();
     if (isDistributed) {
-      invokeInEveryVM(new CacheSerializableRunnable("create presnapshot region") {
+      Invoke.invokeInEveryVM(new CacheSerializableRunnable("create presnapshot region") {
         public void run2() throws CacheException {
           preSnapshotRegion = createRootRegion(name, getRegionAttributes());
         }
@@ -4063,7 +4055,7 @@ public abstract class RegionTestCase extends CacheTestCase {
       // test postSnapshot behavior in other VMs if distributed
       if (isDistributed) {
         log.info("before distributed remoteTestPostSnapshot");
-        invokeInEveryVM(new CacheSerializableRunnable("postSnapshot") {
+        Invoke.invokeInEveryVM(new CacheSerializableRunnable("postSnapshot") {
           public void run2() throws CacheException {
             RegionTestCase.this.remoteTestPostSnapshot(name, false, true);
           }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RemoveAllMultiVmDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RemoveAllMultiVmDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RemoveAllMultiVmDUnitTest.java
index 1d878aa..f45c403 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RemoveAllMultiVmDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RemoveAllMultiVmDUnitTest.java
@@ -38,6 +38,7 @@ import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.distributed.DistributedSystem;
 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.SerializableRunnable;
 import com.gemstone.gemfire.test.dunit.VM;
 
@@ -70,14 +71,15 @@ public class RemoveAllMultiVmDUnitTest extends DistributedTestCase {
       vm1.invoke(RemoveAllMultiVmDUnitTest.class, "createCache");
     }
     
-    public void tearDown2(){
-        Host host = Host.getHost(0);
-        VM vm0 = host.getVM(0);
-        VM vm1 = host.getVM(1);
-        vm0.invoke(RemoveAllMultiVmDUnitTest.class, "closeCache");
-        vm1.invoke(RemoveAllMultiVmDUnitTest.class, "closeCache");
-        cache = null;
-        invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
+    @Override
+    protected final void preTearDown() throws Exception {
+      Host host = Host.getHost(0);
+      VM vm0 = host.getVM(0);
+      VM vm1 = host.getVM(1);
+      vm0.invoke(RemoveAllMultiVmDUnitTest.class, "closeCache");
+      vm1.invoke(RemoveAllMultiVmDUnitTest.class, "closeCache");
+      cache = null;
+      Invoke.invokeInEveryVM(new SerializableRunnable() { public void run() { cache = null; } });
     }
     
     public static void createCache(){

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RequiredRolesDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RequiredRolesDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RequiredRolesDUnitTest.java
index a4120b0..1e69266 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RequiredRolesDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RequiredRolesDUnitTest.java
@@ -34,9 +34,12 @@ import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.distributed.Role;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.distributed.internal.membership.InternalRole;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
 import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
 
 /**
  * Tests the functionality of the {@link RequiredRoles} class.
@@ -192,7 +195,7 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
         return "waiting for test start";
       }
     };
-    DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+    Wait.waitForCriterion(ev, 60 * 1000, 200, true);
     assertTrue(this.startTestWaitForRequiredRoles);
     assertFalse(this.finishTestWaitForRequiredRoles);
     
@@ -220,7 +223,7 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
         
     // create region in vm3... gain for 2 roles
     Host.getHost(0).getVM(vm3).invoke(create);
-    DistributedTestCase.join(threadA, 30 * 1000, getLogWriter());
+    ThreadUtils.join(threadA, 30 * 1000);
     assertTrue(this.finishTestWaitForRequiredRoles);
     assertTrue(this.rolesTestWaitForRequiredRoles.isEmpty());
     
@@ -240,7 +243,7 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
     this.finishTestWaitForRequiredRoles = false;
     threadA = new Thread(group, runWaitForRequiredRoles);
     threadA.start();
-    DistributedTestCase.join(threadA, 30 * 1000, getLogWriter());
+    ThreadUtils.join(threadA, 30 * 1000);
     assertTrue(this.startTestWaitForRequiredRoles);
     assertTrue(this.finishTestWaitForRequiredRoles);
     assertTrue(this.rolesTestWaitForRequiredRoles.isEmpty());
@@ -253,7 +256,7 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
     this.finishTestWaitForRequiredRoles = false;
     threadA = new Thread(group, runWaitForRequiredRoles);
     threadA.start();
-    DistributedTestCase.join(threadA, 30 * 1000, getLogWriter());
+    ThreadUtils.join(threadA, 30 * 1000);
     assertTrue(this.startTestWaitForRequiredRoles);
     assertTrue(this.finishTestWaitForRequiredRoles);
     assertTrue(this.rolesTestWaitForRequiredRoles.isEmpty());
@@ -276,14 +279,14 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
         return "waiting for test start";
       }
     };
-    DistributedTestCase.waitForCriterion(ev, 60 * 1000, 200, true);
+    Wait.waitForCriterion(ev, 60 * 1000, 200, true);
     assertTrue(this.startTestWaitForRequiredRoles);
     assertFalse(this.finishTestWaitForRequiredRoles);
     assertMissingRoles(name, vmRoles[vm2]);
     
     // end the wait and make sure no roles are missing
     Host.getHost(0).getVM(vm2).invoke(create);
-    DistributedTestCase.join(threadA, 30 * 1000, getLogWriter());
+    ThreadUtils.join(threadA, 30 * 1000);
     assertTrue(this.startTestWaitForRequiredRoles);
     assertTrue(this.finishTestWaitForRequiredRoles);
     assertTrue(this.rolesTestWaitForRequiredRoles.isEmpty());
@@ -429,7 +432,7 @@ public class RequiredRolesDUnitTest extends ReliabilityTestCase {
             SystemFailure.setFailure((VirtualMachineError)e); // don't throw
           }
           String s = "Uncaught exception in thread " + t;
-          getLogWriter().error(s, e);
+          LogWriterUtils.getLogWriter().error(s, e);
           fail(s);
         }
       };

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/820cfd63/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RolePerformanceDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RolePerformanceDUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RolePerformanceDUnitTest.java
index 81cd191..e7c0ba7 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RolePerformanceDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/cache30/RolePerformanceDUnitTest.java
@@ -26,6 +26,7 @@ import com.gemstone.gemfire.cache.RegionAttributes;
 import com.gemstone.gemfire.cache.Scope;
 import com.gemstone.gemfire.distributed.internal.DistributionConfig;
 import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 
 /**
@@ -63,7 +64,7 @@ public class RolePerformanceDUnitTest extends CacheTestCase {
           throw e;
         }
         else {
-          getLogWriter().info("testRolePerformance attempt #" + i + 
+          LogWriterUtils.getLogWriter().info("testRolePerformance attempt #" + i + 
             " failed -- reattempting up to 10x", e);
         }
       }
@@ -101,7 +102,7 @@ public class RolePerformanceDUnitTest extends CacheTestCase {
     String data = name + " results: millisNoRoles=" + millisNoRoles +
       ", millisWithRoles=" + millisWithRoles + ", deviation=" + deviation + 
       ", ceiling=" + ceiling;
-    getLogWriter().info(data);
+    LogWriterUtils.getLogWriter().info(data);
     
     assertTrue("millisWithRoles is greater than allowable deviation: " + data,
                millisWithRoles <= ceiling);