geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [12/44] incubator-geode git commit: Refactor dunit
Date Tue, 02 Feb 2016 20:21:19 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestSupport.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestSupport.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestSupport.java
new file mode 100755
index 0000000..4e8546f
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestSupport.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.dunit;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.internal.InternalDataSerializer;
+import com.gemstone.gemfire.internal.InternalInstantiator;
+import com.gemstone.gemfire.internal.cache.tier.sockets.DataSerializerPropogationDUnitTest;
+
+public class DistributedTestSupport {
+
+  protected DistributedTestSupport() {
+  }
+
+  /**
+   * Fetches the GemFireDescription for this test and adds its 
+   * DistributedSystem properties to the provided props parameter.
+   * 
+   * @param config the properties to add hydra's test properties to
+   */
+  public static void addHydraProperties(Properties config) {
+    Properties p = DUnitEnv.get().getDistributedSystemProperties();
+    for (Iterator iter = p.entrySet().iterator();
+        iter.hasNext(); ) {
+      Map.Entry entry = (Map.Entry) iter.next();
+      String key = (String) entry.getKey();
+      String value = (String) entry.getValue();
+      if (config.getProperty(key) == null) {
+        config.setProperty(key, value);
+      }
+    }
+  }
+
+  public final static Properties getAllDistributedSystemProperties(Properties props) {
+    Properties p = DUnitEnv.get().getDistributedSystemProperties();
+    
+    // our tests do not expect auto-reconnect to be on by default
+    if (!p.contains(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME)) {
+      p.put(DistributionConfig.DISABLE_AUTO_RECONNECT_NAME, "true");
+    }
+  
+    for (Iterator iter = props.entrySet().iterator();
+    iter.hasNext(); ) {
+      Map.Entry entry = (Map.Entry) iter.next();
+      String key = (String) entry.getKey();
+      Object value = entry.getValue();
+      p.put(key, value);
+    }
+    return p;
+  }
+  
+  /**
+   * Get the port that the standard dunit locator is listening on.
+   */
+  public static int getDUnitLocatorPort() {
+    return DUnitEnv.get().getLocatorPort();
+  }
+
+  public static void unregisterAllDataSerializersFromAllVms() {
+    DistributedTestSupport.unregisterDataSerializerInThisVM();
+    Invoke.invokeInEveryVM(new SerializableRunnable() {
+      public void run() {
+        DistributedTestSupport.unregisterDataSerializerInThisVM();
+      }
+    });
+    Invoke.invokeInLocator(new SerializableRunnable() {
+      public void run() {
+        DistributedTestSupport.unregisterDataSerializerInThisVM();
+      }
+    });
+  }
+
+  public static void unregisterDataSerializerInThisVM() {
+    DataSerializerPropogationDUnitTest.successfullyLoadedTestDataSerializer = false;
+    // unregister all the Dataserializers
+    InternalDataSerializer.reinitialize();
+    // ensure that all are unregistered
+    assertEquals(0, InternalDataSerializer.getSerializers().length);
+  }
+
+  public static void unregisterInstantiatorsInThisVM() {
+    // unregister all the instantiators
+    InternalInstantiator.reinitialize();
+    assertEquals(0, InternalInstantiator.getInstantiators().length);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/IgnoredException.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/IgnoredException.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/IgnoredException.java
index 92f879c..175543a 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/IgnoredException.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/IgnoredException.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package com.gemstone.gemfire.test.dunit;
 
 import java.io.Serializable;
@@ -63,7 +79,7 @@ public class IgnoredException implements Serializable {
           sys.getLogWriter().info(remove);
         }
         try {
-          DistributedTestCase.getLogWriter().info(remove);
+          LogWriterSupport.getLogWriter().info(remove);
         } catch (Exception noHydraLogger) {
         }
 
@@ -75,7 +91,7 @@ public class IgnoredException implements Serializable {
       vm.invoke(removeRunnable);
     }
     else {
-      DistributedTestCase.invokeInEveryVM(removeRunnable);
+      Invoke.invokeInEveryVM(removeRunnable);
     }
     String s = getRemoveMessage();
     LogManager.getLogger(LogService.BASE_LOGGER_NAME).info(s);
@@ -85,7 +101,7 @@ public class IgnoredException implements Serializable {
     if (sys != null) { // avoid creating a system
       sys.getLogWriter().info(s);
     }
-    DistributedTestCase.getLogWriter().info(s);
+    LogWriterSupport.getLogWriter().info(s);
   }
 
   public static void removeAllExpectedExceptions() {
@@ -108,7 +124,7 @@ public class IgnoredException implements Serializable {
    *          the VM on which to log the expected exception or null for all VMs
    * @return an ExpectedException instance for removal purposes
    */
-  public static IgnoredException addExpectedException(final String exception,
+  public static IgnoredException addIgnoredException(final String exception,
       VM v) {
     final IgnoredException ret;
     if (v != null) {
@@ -128,7 +144,7 @@ public class IgnoredException implements Serializable {
           sys.getLogWriter().info(add);
         }
         try {
-          DistributedTestCase.getLogWriter().info(add);
+          LogWriterSupport.getLogWriter().info(add);
         } catch (Exception noHydraLogger) {
         }
   
@@ -139,7 +155,7 @@ public class IgnoredException implements Serializable {
       v.invoke(addRunnable);
     }
     else {
-      DistributedTestCase.invokeInEveryVM(addRunnable);
+      Invoke.invokeInEveryVM(addRunnable);
     }
     
     LogManager.getLogger(LogService.BASE_LOGGER_NAME).info(add);
@@ -149,8 +165,8 @@ public class IgnoredException implements Serializable {
     if (sys != null) { // avoid creating a cache
       sys.getLogWriter().info(add);
     }
-    DistributedTestCase.getLogWriter().info(add);
-    IgnoredException.ignoredExceptions.add(ret);
+    LogWriterSupport.getLogWriter().info(add);
+    ignoredExceptions.add(ret);
     return ret;
   }
 
@@ -168,7 +184,7 @@ public class IgnoredException implements Serializable {
    *          the exception string to expect
    * @return an ExpectedException instance for removal
    */
-  public static IgnoredException addExpectedException(final String exception) {
-    return IgnoredException.addExpectedException(exception, null);
+  public static IgnoredException addIgnoredException(final String exception) {
+    return addIgnoredException(exception, null);
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Invoke.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Invoke.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Invoke.java
index 47109a8..cc6d91f 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Invoke.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Invoke.java
@@ -1,14 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package com.gemstone.gemfire.test.dunit;
 
+import java.util.HashMap;
+import java.util.Map;
+
 public class Invoke {
 
+  protected Invoke() {
+  }
+  
   /**
    * Invokes a <code>SerializableRunnable</code> in every VM that
    * DUnit knows about.
    *
    * @see VM#invoke(Runnable)
    */
-  public static void invokeInEveryVM(SerializableRunnable work) {
+  public static void invokeInEveryVM(final SerializableRunnableIF work) {
     for (int h = 0; h < Host.getHostCount(); h++) {
       Host host = Host.getHost(h);
   
@@ -19,4 +41,90 @@ public class Invoke {
     }
   }
 
+  /**
+   * Invokes a method in every remote VM that DUnit knows about.
+   *
+   * @see VM#invoke(Class, String)
+   */
+  public static void invokeInEveryVM(final Class c, final String method) {
+    for (int h = 0; h < Host.getHostCount(); h++) {
+      Host host = Host.getHost(h);
+  
+      for (int v = 0; v < host.getVMCount(); v++) {
+        VM vm = host.getVM(v);
+        vm.invoke(c, method);
+      }
+    }
+  }
+
+  /**
+   * Invokes a method in every remote VM that DUnit knows about.
+   *
+   * @see VM#invoke(Class, String)
+   */
+  public static void invokeInEveryVM(final Class c, final String method, final Object[] methodArgs) {
+    for (int h = 0; h < Host.getHostCount(); h++) {
+      Host host = Host.getHost(h);
+  
+      for (int v = 0; v < host.getVMCount(); v++) {
+        VM vm = host.getVM(v);
+        vm.invoke(c, method, methodArgs);
+      }
+    }
+  }
+
+  /**
+   * Invokes a <code>SerializableCallable</code> in every VM that
+   * DUnit knows about.
+   *
+   * @return a Map of results, where the key is the VM and the value is the result
+   * @see VM#invoke(SerializableCallableIF)
+   */
+  public static <T> Map<VM, T> invokeInEveryVM(final SerializableCallableIF<T> work) {
+    Map<VM, T> ret = new HashMap<VM, T>();
+    for (int h = 0; h < Host.getHostCount(); h++) {
+      Host host = Host.getHost(h);
+      for (int v = 0; v < host.getVMCount(); v++) {
+        VM vm = host.getVM(v);
+        ret.put(vm, vm.invoke(work));
+      }
+    }
+    return ret;
+  }
+
+  public static void invokeInLocator(SerializableRunnable work) {
+    Host.getLocator().invoke(work);
+  }
+
+  public static void invokeRepeatingIfNecessary(final VM vm, final RepeatableRunnable task) {
+    vm.invokeRepeatingIfNecessary(task, 0);
+  }
+
+  public static void invokeRepeatingIfNecessary(final VM vm, final RepeatableRunnable task, final long repeatTimeoutMs) {
+    vm.invokeRepeatingIfNecessary(task, repeatTimeoutMs);
+  }
+
+  public static void invokeInEveryVMRepeatingIfNecessary(final RepeatableRunnable work) {
+    Invoke.invokeInEveryVMRepeatingIfNecessary(work, 0);
+  }
+
+  /**
+   * Invokes a <code>SerializableRunnable</code> in every VM that
+   * DUnit knows about.  If work.run() throws an assertion failure, 
+   * its execution is repeated, until no assertion failure occurs or
+   * repeatTimeout milliseconds have passed.
+   * 
+   * @see VM#invoke(SerializableRunnableIF)
+   */
+  public static void invokeInEveryVMRepeatingIfNecessary(final RepeatableRunnable work, final long repeatTimeoutMs) {
+    for (int h = 0; h < Host.getHostCount(); h++) {
+      Host host = Host.getHost(h);
+  
+      for (int v = 0; v < host.getVMCount(); v++) {
+        VM vm = host.getVM(v);
+        vm.invokeRepeatingIfNecessary(work, repeatTimeoutMs);
+      }
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/LogWriterSupport.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/LogWriterSupport.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/LogWriterSupport.java
new file mode 100755
index 0000000..b804845
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/LogWriterSupport.java
@@ -0,0 +1,72 @@
+package com.gemstone.gemfire.test.dunit;
+
+import java.util.Properties;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.distributed.internal.DistributionConfigImpl;
+import com.gemstone.gemfire.internal.logging.InternalLogWriter;
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.LogWriterFactory;
+import com.gemstone.gemfire.internal.logging.ManagerLogWriter;
+import com.gemstone.gemfire.internal.logging.log4j.LogWriterLogger;
+
+public class LogWriterSupport {
+
+  private static final Logger logger = LogService.getLogger();
+  private static final LogWriterLogger oldLogger = LogWriterLogger.create(logger);
+  
+  /**
+   * Returns a <code>LogWriter</code> for logging information
+   * @deprecated Use a static logger from the log4j2 LogService.getLogger instead.
+   */
+  @Deprecated
+  public static InternalLogWriter getLogWriter() {
+    return LogWriterSupport.oldLogger;
+  }
+
+  /**
+   * Creates a new LogWriter and adds it to the config properties. The config
+   * can then be used to connect to DistributedSystem, thus providing early
+   * access to the LogWriter before connecting. This call does not connect
+   * to the DistributedSystem. It simply creates and returns the LogWriter
+   * that will eventually be used by the DistributedSystem that connects using
+   * config.
+   * 
+   * @param config the DistributedSystem config properties to add LogWriter to
+   * @return early access to the DistributedSystem LogWriter
+   */
+  public static LogWriter createLogWriter(Properties config) { // TODO:LOG:CONVERT: this is being used for ExpectedExceptions
+    Properties nonDefault = config;
+    if (nonDefault == null) {
+      nonDefault = new Properties();
+    }
+    DistributedTestSupport.addHydraProperties(nonDefault);
+    
+    DistributionConfig dc = new DistributionConfigImpl(nonDefault);
+    LogWriter logger = LogWriterFactory.createLogWriterLogger(
+        false/*isLoner*/, false/*isSecurityLog*/, dc, 
+        false);        
+    
+    // if config was non-null, then these will be added to it...
+    nonDefault.put(DistributionConfig.LOG_WRITER_NAME, logger);
+    
+    return logger;
+  }
+
+  /**
+   * This finds the log level configured for the test run.  It should be used
+   * when creating a new distributed system if you want to specify a log level.
+   * @return the dunit log-level setting
+   */
+  public static String getDUnitLogLevel() {
+    Properties p = DUnitEnv.get().getDistributedSystemProperties();
+    String result = p.getProperty(DistributionConfig.LOG_LEVEL_NAME);
+    if (result == null) {
+      result = ManagerLogWriter.levelToString(DistributionConfig.DEFAULT_LOG_LEVEL);
+    }
+    return result;
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/NetworkSupport.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/NetworkSupport.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/NetworkSupport.java
index f86bef7..cff1707 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/NetworkSupport.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/NetworkSupport.java
@@ -1,5 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package com.gemstone.gemfire.test.dunit;
 
+import java.net.UnknownHostException;
+
+import com.gemstone.gemfire.internal.SocketCreator;
+
 public class NetworkSupport {
 
+  /** get the IP literal name for the current host, use this instead of  
+   * "localhost" to avoid IPv6 name resolution bugs in the JDK/machine config.
+   * @return an ip literal, this method honors java.net.preferIPvAddresses
+   */
+  public static String getIPLiteral() {
+    try {
+      return SocketCreator.getLocalHost().getHostAddress();
+    } catch (UnknownHostException e) {
+      throw new Error("problem determining host IP address", e);
+    }
+  }
+
+  /** get the host name to use for a server cache in client/server dunit
+   * testing
+   * @param host
+   * @return the host name
+   */
+  public static String getServerHostName(Host host) {
+    return System.getProperty("gemfire.server-bind-address") != null?
+        System.getProperty("gemfire.server-bind-address")
+        : host.getHostName();
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/StoppableWaitCriterion.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/StoppableWaitCriterion.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/StoppableWaitCriterion.java
index 4587244..d90917e 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/StoppableWaitCriterion.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/StoppableWaitCriterion.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package com.gemstone.gemfire.test.dunit;
 
 public interface StoppableWaitCriterion extends WaitCriterion {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Threads.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Threads.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Threads.java
index 4bb4aa9..ff0b5ef 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Threads.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Threads.java
@@ -1,10 +1,138 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package com.gemstone.gemfire.test.dunit;
 
+import static org.junit.Assert.fail;
+
 import org.apache.logging.log4j.Logger;
 
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.internal.OSProcess;
+import com.gemstone.gemfire.internal.logging.LocalLogWriter;
 import com.gemstone.gemfire.internal.logging.LogService;
+import com.gemstone.gemfire.internal.logging.LogWriterImpl;
 
 public class Threads {
   private static final Logger logger = LogService.getLogger();
 
+  /**
+     * Wait for a thread to join
+     * @param t thread to wait on
+     * @param ms maximum time to wait
+     * @throws AssertionError if the thread does not terminate
+     */
+    static public void join(Thread t, long ms, LogWriter logger) {
+      final long tilt = System.currentTimeMillis() + ms;
+      final long incrementalWait = Jitter.jitterInterval(ms);
+      final long start = System.currentTimeMillis();
+      for (;;) {
+        // I really do *not* understand why this check is necessary
+        // but it is, at least with JDK 1.6.  According to the source code
+        // and the javadocs, one would think that join() would exit immediately
+        // if the thread is dead.  However, I can tell you from experimentation
+        // that this is not the case. :-(  djp 2008-12-08
+        if (!t.isAlive()) {
+          break;
+        }
+        try {
+          t.join(incrementalWait);
+        } catch (InterruptedException e) {
+          fail("interrupted");
+        }
+        if (System.currentTimeMillis() >= tilt) {
+          break;
+        }
+      } // for
+      if (logger == null) {
+        logger = new LocalLogWriter(LogWriterImpl.INFO_LEVEL, System.out);
+      }
+      if (t.isAlive()) {
+        logger.info("HUNG THREAD");
+        Threads.dumpStackTrace(t, t.getStackTrace(), logger);
+        Threads.dumpMyThreads(logger);
+        t.interrupt(); // We're in trouble!
+        fail("Thread did not terminate after " + ms + " ms: " + t);
+  //      getLogWriter().warning("Thread did not terminate" 
+  //          /* , new Exception()*/
+  //          );
+      }
+      long elapsedMs = (System.currentTimeMillis() - start);
+      if (elapsedMs > 0) {
+        String msg = "Thread " + t + " took " 
+          + elapsedMs
+          + " ms to exit.";
+        logger.info(msg);
+      }
+    }
+
+  public static void dumpStackTrace(Thread t, StackTraceElement[] stack, LogWriter logger) {
+    StringBuilder msg = new StringBuilder();
+    msg.append("Thread=<")
+      .append(t)
+      .append("> stackDump:\n");
+    for (int i=0; i < stack.length; i++) {
+      msg.append("\t")
+        .append(stack[i])
+        .append("\n");
+    }
+    logger.info(msg.toString());
+  }
+
+  /**
+   * Dump all thread stacks
+   */
+  public static void dumpMyThreads(LogWriter logger) {
+    OSProcess.printStacks(0, false);
+  }
+
+  /** print a stack dump for this vm
+      @author bruce
+      @since 5.0
+   */
+  public static void dumpStack() {
+    com.gemstone.gemfire.internal.OSProcess.printStacks(0, false);
+  }
+
+  /** print a stack dump for the given vm
+      @author bruce
+      @since 5.0
+   */
+  public static void dumpStack(VM vm) {
+    vm.invoke(com.gemstone.gemfire.test.dunit.DistributedTestCase.class, "dumpStack");
+  }
+
+  /** print stack dumps for all vms on the given host
+      @author bruce
+      @since 5.0
+   */
+  public static void dumpStack(Host host) {
+    for (int v=0; v < host.getVMCount(); v++) {
+      host.getVM(v).invoke(com.gemstone.gemfire.test.dunit.DistributedTestCase.class, "dumpStack");
+    }
+  }
+
+  /** print stack dumps for all vms
+      @author bruce
+      @since 5.0
+   */
+  public static void dumpAllStacks() {
+    for (int h=0; h < Host.getHostCount(); h++) {
+      dumpStack(Host.getHost(h));
+    }
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
index 0d16196..d8bbd21 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/VM.java
@@ -1342,4 +1342,14 @@ public class VM implements java.io.Serializable {
     return DUnitEnv.get().getWorkingDirectory(this.getPid());
   }
 
+  /** Return the total number of VMs on all hosts */
+  public static int getVMCount() {
+    int count = 0;
+    for (int h = 0; h < Host.getHostCount(); h++) {
+      Host host = Host.getHost(h);
+      count += host.getVMCount();
+    }
+    return count;
+  }
+
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java
index a26335e..55791e9 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java
@@ -1,10 +1,202 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package com.gemstone.gemfire.test.dunit;
 
+import static org.junit.Assert.fail;
+
 import org.apache.logging.log4j.Logger;
 
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
 import com.gemstone.gemfire.internal.logging.LogService;
 import com.jayway.awaitility.Awaitility;
 
 public class Wait {
   private static final Logger logger = LogService.getLogger();
+
+  /**
+     * Wait until given criterion is met
+     * @param ev criterion to wait on
+     * @param ms total time to wait, in milliseconds
+     * @param interval pause interval between waits
+     * @param throwOnTimeout if false, don't generate an error
+     * @deprecated Use {@link Awaitility} instead.
+     */
+    @Deprecated
+    static public void waitForCriterion(WaitCriterion ev, long ms, 
+        long interval, boolean throwOnTimeout) {
+      long waitThisTime = Jitter.jitterInterval(interval);
+      final long tilt = System.currentTimeMillis() + ms;
+      for (;;) {
+  //      getLogWriter().info("Testing to see if event has occurred: " + ev.description());
+        if (ev.done()) {
+          return; // success
+        }
+        if (ev instanceof StoppableWaitCriterion) {
+          StoppableWaitCriterion ev2 = (StoppableWaitCriterion)ev;
+          if (ev2.stopWaiting()) {
+            if (throwOnTimeout) {
+              fail("stopWaiting returned true: " + ev.description());
+            }
+            return;
+          }
+        }
+  
+        // Calculate time left
+        long timeLeft = tilt - System.currentTimeMillis();
+        if (timeLeft <= 0) {
+          if (!throwOnTimeout) {
+            return; // not an error, but we're done
+          }
+          fail("Event never occurred after " + ms + " ms: " + ev.description());
+        }
+        
+        if (waitThisTime > timeLeft) {
+          waitThisTime = timeLeft;
+        }
+        
+        // Wait a little bit
+        Thread.yield();
+        try {
+  //        getLogWriter().info("waiting " + waitThisTime + "ms for " + ev.description());
+          Thread.sleep(waitThisTime);
+        } catch (InterruptedException e) {
+          fail("interrupted");
+        }
+      }
+    }
+
+  /**
+   * Blocks until the clock used for expiration moves forward.
+   * @param baseTime the timestamp that the clock must exceed
+   * @return the last time stamp observed
+   */
+  public static final long waitForExpiryClockToChange(LocalRegion lr, final long baseTime) {
+    long nowTime;
+    do {
+      Thread.yield();
+      nowTime = lr.cacheTimeMillis();
+    } while ((nowTime - baseTime) <= 0L);
+    return nowTime;
+  }
+
+  /**
+   * Blocks until the clock used for expiration moves forward.
+   * @return the last time stamp observed
+   */
+  public static final long waitForExpiryClockToChange(LocalRegion lr) {
+    return waitForExpiryClockToChange(lr, lr.cacheTimeMillis());
+  }
+
+  /** pause for specified ms interval
+   * Make sure system clock has advanced by the specified number of millis before
+   * returning.
+   */
+  public static final void pause(int ms) {
+    LogWriter log = com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter();
+    if (ms >= 1000 || log.fineEnabled()) { // check for fine but log at info
+      com.gemstone.gemfire.test.dunit.LogWriterSupport.getLogWriter().info("Pausing for " + ms + " ms..."/*, new Exception()*/);
+    }
+    final long target = System.currentTimeMillis() + ms;
+    try {
+      for (;;) {
+        long msLeft = target - System.currentTimeMillis();
+        if (msLeft <= 0) {
+          break;
+        }
+        Thread.sleep(msLeft);
+      }
+    }
+    catch (InterruptedException e) {
+      Assert.fail("interrupted", e);
+    }
+  }
+
+  /**
+   * Wait on a mutex.  This is done in a loop in order to address the
+   * "spurious wakeup" "feature" in Java.
+   * @param ev condition to test
+   * @param mutex object to lock and wait on
+   * @param ms total amount of time to wait
+   * @param interval interval to pause for the wait
+   * @param throwOnTimeout if false, no error is thrown.
+   */
+  static public void waitMutex(WaitCriterion ev, Object mutex, long ms, 
+      long interval, boolean throwOnTimeout) {
+    final long tilt = System.currentTimeMillis() + ms;
+    long waitThisTime = Jitter.jitterInterval(interval);
+    synchronized (mutex) {
+      for (;;) {
+        if (ev.done()) {
+          break;
+        }
+        
+        long timeLeft = tilt - System.currentTimeMillis();
+        if (timeLeft <= 0) {
+          if (!throwOnTimeout) {
+            return; // not an error, but we're done
+          }
+          fail("Event never occurred after " + ms + " ms: " + ev.description());
+        }
+        
+        if (waitThisTime > timeLeft) {
+          waitThisTime = timeLeft;
+        }
+        
+        try {
+          mutex.wait(waitThisTime);
+        } catch (InterruptedException e) {
+          fail("interrupted");
+        }
+      } // for
+    } // synchronized
+  }
+
+  /** pause for a default interval */
+  public static void pause() {
+    pause(250);
+  }
+
+  /**
+     * Use of this function indicates a place in the tests tree where t
+     * he use of Thread.sleep() is
+     * highly questionable.
+     * <p>
+     * Some places in the system, especially those that test expirations and other
+     * timeouts, have a very good reason to call {@link Thread#sleep(long)}.  The
+     * <em>other</em> places are marked by the use of this method.
+     * 
+     * @param ms
+     */
+    static public final void staticPause(int ms) {
+  //    getLogWriter().info("FIXME: Pausing for " + ms + " ms..."/*, new Exception()*/);
+      final long target = System.currentTimeMillis() + ms;
+      try {
+        for (;;) {
+          long msLeft = target - System.currentTimeMillis();
+          if (msLeft <= 0) {
+            break;
+          }
+          Thread.sleep(msLeft);
+        }
+      }
+      catch (InterruptedException e) {
+        Assert.fail("interrupted", e);
+      }
+      
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/WaitCriterion.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/WaitCriterion.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/WaitCriterion.java
index 40ba133..f835268 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/WaitCriterion.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/WaitCriterion.java
@@ -1,3 +1,19 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package com.gemstone.gemfire.test.dunit;
 
 public interface WaitCriterion {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedDisconnectRule.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedDisconnectRule.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedDisconnectRule.java
new file mode 100755
index 0000000..125fc06
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedDisconnectRule.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.dunit.rules;
+
+// TODO: import static com.gemstone.gemfire.test.dunit.DistributedTestRule.*;
+
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+
+@SuppressWarnings("serial")
+public class DistributedDisconnectRule extends DistributedExternalResource {
+
+  private final boolean disconnectBefore;
+  private final boolean disconnectAfter;
+  private final boolean disconnectBeforeClass;
+  private final boolean disconnectAfterClass;
+  
+  public static Builder builder() {
+    return new Builder();
+  }
+  
+  public DistributedDisconnectRule(final Builder builder) {
+    this(new RemoteInvoker(), builder);
+  }
+   
+  public DistributedDisconnectRule(final RemoteInvoker invoker, final Builder builder) {
+    super(invoker);
+    this.disconnectBeforeClass = builder.disconnectBeforeClass;
+    this.disconnectAfterClass = builder.disconnectAfterClass;
+    this.disconnectBefore = builder.disconnectBefore;
+    this.disconnectAfter = builder.disconnectAfter;
+  }
+
+  @Override
+  protected void before() throws Throwable {
+    if (this.disconnectBefore) {
+      invoker().invokeEverywhere(serializableRunnable());
+    }
+  }
+
+  @Override
+  protected void after() throws Throwable {
+    if (this.disconnectAfter) {
+      invoker().invokeEverywhere(serializableRunnable());
+    }
+  }
+
+  @Override
+  protected void beforeClass() throws Throwable {
+    if (this.disconnectBeforeClass) {
+      invoker().invokeEverywhere(serializableRunnable());
+    }
+  }
+
+  @Override
+  protected void afterClass() throws Throwable {
+    if (this.disconnectAfterClass) {
+      invoker().invokeEverywhere(serializableRunnable());
+    }
+  }
+
+  private static SerializableRunnable serializableRunnable() {
+    return new SerializableRunnable() {
+      @Override
+      public void run() {
+        // TODO: disconnectFromDS();
+      }
+    };
+  }
+  
+  /**
+   * Builds an instance of DistributedDisconnectRule
+   * 
+   * @author Kirk Lund
+   */
+  public static class Builder {
+    private boolean disconnectBeforeClass;
+    private boolean disconnectAfterClass;
+    private boolean disconnectBefore;
+    private boolean disconnectAfter;
+    
+    public Builder() {}
+
+    public Builder disconnectBeforeClass(final boolean disconnectBeforeClass) {
+      this.disconnectBeforeClass = disconnectBeforeClass;
+      return this;
+    }
+    
+    public Builder disconnectBefore(final boolean disconnectBefore) {
+      this.disconnectBefore = disconnectBefore;
+      return this;
+    }
+    
+    public Builder disconnectAfterClass(final boolean disconnectAfterClass) {
+      this.disconnectAfterClass = disconnectAfterClass;
+      return this;
+    }
+    
+    public Builder disconnectAfter(final boolean disconnectAfter) {
+      this.disconnectAfter = disconnectAfter;
+      return this;
+    }
+    
+    public DistributedDisconnectRule build() {
+      return new DistributedDisconnectRule(this);
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedExternalResource.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedExternalResource.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedExternalResource.java
new file mode 100755
index 0000000..d3b7319
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedExternalResource.java
@@ -0,0 +1,58 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.dunit.rules;
+
+import com.gemstone.gemfire.test.junit.rules.SerializableExternalResource;
+
+@SuppressWarnings("serial")
+public class DistributedExternalResource extends SerializableExternalResource {
+
+  private final RemoteInvoker invoker;
+
+  public DistributedExternalResource() {
+    this(new RemoteInvoker());
+  }
+   
+  public DistributedExternalResource(final RemoteInvoker invoker) {
+    super();
+    this.invoker = invoker;
+  }
+
+  protected RemoteInvoker invoker() {
+    return this.invoker;
+  }
+  
+  @Override
+  protected void before() throws Throwable {
+    // do nothing
+  }
+
+  @Override
+  protected void after() throws Throwable {
+    // do nothing
+  }
+
+  @Override
+  protected void beforeClass() throws Throwable {
+    // do nothing
+  }
+
+  @Override
+  protected void afterClass() throws Throwable {
+    // do nothing
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedRestoreSystemProperties.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedRestoreSystemProperties.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedRestoreSystemProperties.java
new file mode 100755
index 0000000..1711b21
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/DistributedRestoreSystemProperties.java
@@ -0,0 +1,74 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.dunit.rules;
+
+import static java.lang.System.getProperties;
+import static java.lang.System.setProperties;
+
+import java.util.Properties;
+
+import org.junit.contrib.java.lang.system.RestoreSystemProperties;
+
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.junit.rules.SerializableTestRule;
+
+/**
+ * Distributed version of RestoreSystemProperties which affects all DUnit 
+ * JVMs including the Locator JVM.
+ * 
+ * @author Kirk Lund
+ */
+@SuppressWarnings("serial")
+public class DistributedRestoreSystemProperties extends RestoreSystemProperties implements SerializableTestRule {
+  
+  private static volatile Properties originalProperties;
+
+  private final RemoteInvoker invoker;
+  
+  public DistributedRestoreSystemProperties() {
+   this(new RemoteInvoker());
+  }
+  
+  public DistributedRestoreSystemProperties(final RemoteInvoker invoker) {
+    super();
+    this.invoker = invoker;
+  }
+  
+  @Override
+  protected void before() throws Throwable {
+    super.before();
+    this.invoker.remoteInvokeInEveryVMAndLocator(new SerializableRunnable() {
+      @Override
+      public void run() { 
+        originalProperties = getProperties();
+        setProperties(new Properties(originalProperties));
+      }
+    });
+  }
+
+  @Override
+  protected void after() {
+    super.after();
+    this.invoker.remoteInvokeInEveryVMAndLocator(new SerializableRunnable() {
+      @Override
+      public void run() { 
+        setProperties(originalProperties);
+        originalProperties = null;
+      }
+    });
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
new file mode 100755
index 0000000..e7e523f
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/rules/RemoteInvoker.java
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.dunit.rules;
+
+import static com.gemstone.gemfire.test.dunit.Invoke.invokeInEveryVM;
+import static com.gemstone.gemfire.test.dunit.Invoke.invokeInLocator;
+
+import java.io.Serializable;
+
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+
+@SuppressWarnings("serial")
+public class RemoteInvoker implements Serializable {
+
+  public void invokeEverywhere(final SerializableRunnable runnable) {
+    runnable.run();
+    invokeInEveryVM(runnable);
+    invokeInLocator(runnable);
+  }
+
+  public void remoteInvokeInEveryVMAndLocator(final SerializableRunnable runnable) {
+    invokeInEveryVM(runnable);
+    invokeInLocator(runnable);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/AssertJExampleJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/AssertJExampleJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/AssertJExampleJUnitTest.java
new file mode 100755
index 0000000..ac0a373
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/AssertJExampleJUnitTest.java
@@ -0,0 +1,135 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.examples;
+
+import static org.assertj.core.api.Assertions.*;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class AssertJExampleJUnitTest {
+
+  private Character aragorn;
+  private Character boromir;
+  private Character elrond;
+  private Character frodo;
+  private Character galadriel;
+  private Character gandalf;
+  private Character gimli;
+  private Character legolas;
+  private Character merry;
+  private Character pippin;
+  private Character sauron;
+  private Character sam;
+  
+  private Ring narya;
+  private Ring nenya;
+  private Ring oneRing;
+  private Ring vilya;
+  
+  private Set<Character> fellowshipOfTheRing;
+  private Map<Ring, Character> ringBearers;
+  
+  @Before
+  public void setUp() {
+    this.aragorn = new Character("Aragorn");
+    this.boromir = new Character("Boromir");
+    this.elrond = new Character("Elrond");
+    this.frodo = new Character("Frodo");
+    this.galadriel = new Character("Galadriel");
+    this.gandalf = new Character("Gandalf");
+    this.gimli = new Character("Gimli");
+    this.legolas = new Character("Legolas");
+    this.merry = new Character("Merry");
+    this.pippin = new Character("Pippin");
+    this.sauron = new Character("Sauron");
+    this.sam = new Character("Sam");
+    
+    this.narya = new Ring();
+    this.nenya = new Ring();
+    this.oneRing = new Ring();
+    this.vilya = new Ring();
+    
+    this.fellowshipOfTheRing = new HashSet<Character>();
+    this.fellowshipOfTheRing.add(this.aragorn);
+    this.fellowshipOfTheRing.add(this.boromir);
+    this.fellowshipOfTheRing.add(this.frodo);
+    this.fellowshipOfTheRing.add(this.gandalf);
+    this.fellowshipOfTheRing.add(this.gimli);
+    this.fellowshipOfTheRing.add(this.legolas);
+    this.fellowshipOfTheRing.add(this.merry);
+    this.fellowshipOfTheRing.add(this.pippin);
+    this.fellowshipOfTheRing.add(this.sam);
+
+    this.ringBearers = new HashMap<Ring, Character>();
+    this.ringBearers.put(this.oneRing, this.frodo);
+    this.ringBearers.put(this.nenya, this.galadriel);
+    this.ringBearers.put(this.narya, this.gandalf);
+    this.ringBearers.put(this.vilya, this.elrond);
+  }
+  
+  @Test
+  public void exampleShouldPass() {
+    // common assertions
+    assertThat(frodo.getName()).isEqualTo("Frodo");
+    assertThat(frodo).isNotEqualTo(sauron)
+                     .isIn(fellowshipOfTheRing);
+
+    // String specific assertions
+    assertThat(frodo.getName()).startsWith("Fro")
+                               .endsWith("do")
+                               .isEqualToIgnoringCase("frodo");
+
+    // collection specific assertions
+    assertThat(fellowshipOfTheRing).hasSize(9)
+                                   .contains(frodo, sam)
+                                   .doesNotContain(sauron);
+
+    // using extracting magical feature to check fellowshipOfTheRing characters name :)
+    assertThat(fellowshipOfTheRing).extracting("name").contains("Boromir", "Gandalf", "Frodo", "Legolas")
+                                                      .doesNotContain("Sauron", "Elrond");
+
+    // map specific assertions, ringBearers initialized with the elves rings and the one ring bearers.
+    assertThat(ringBearers).hasSize(4)
+                           .contains(entry(oneRing, frodo), entry(nenya, galadriel))
+                           .doesNotContainEntry(oneRing, aragorn);  
+  }
+  
+  protected static class Character {
+    private final String name;
+    public Character(final String name) {
+      this.name = name;
+    }
+    public String getName() {
+      return this.name;
+    }
+  }
+  
+  protected static class Ring {
+    public Ring() {
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/CatchExceptionExampleJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/CatchExceptionExampleJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/CatchExceptionExampleJUnitTest.java
new file mode 100755
index 0000000..264b563
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/CatchExceptionExampleJUnitTest.java
@@ -0,0 +1,115 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.examples;
+
+import static com.googlecode.catchexception.CatchException.*;
+import static com.googlecode.catchexception.apis.BDDCatchException.when;
+import static com.googlecode.catchexception.apis.CatchExceptionHamcrestMatchers.*;
+import static org.assertj.core.api.BDDAssertions.*;
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+/**
+ * Simple unit tests exercising Catch-Exception with AssertJ, Hamcrest and JUnit.
+ */
+@Category(UnitTest.class)
+public class CatchExceptionExampleJUnitTest {
+
+  @Test
+  public void catchExceptionShouldCatchException() {
+    List<?> myList = new ArrayList<Object>();
+
+    // when: we try to get the first element of the list
+    // then: catch the exception if any is thrown
+    catchException(myList).get(1);
+    
+    // then: we expect an IndexOutOfBoundsException
+    assertThat(caughtException(), is(instanceOf(IndexOutOfBoundsException.class)));
+  }
+  
+  @Test
+  public void verifyExceptionShouldCatchException() {
+    List<?> myList = new ArrayList<Object>();
+
+    // when: we try to get the first element of the list
+    // then: catch the exception if any is thrown
+    // then: we expect an IndexOutOfBoundsException
+    verifyException(myList, IndexOutOfBoundsException.class).get(1);
+  }
+  
+  @Test
+  public void whenShouldCatchExceptionAndUseAssertJAssertion() {
+    // given: an empty list
+    List<?> myList = new ArrayList<Object>();
+
+    // when: we try to get the first element of the list
+    when(myList).get(1);
+
+    // then: we expect an IndexOutOfBoundsException
+    then((Exception)caughtException())
+            .isInstanceOf(IndexOutOfBoundsException.class)
+            .hasMessage("Index: 1, Size: 0")
+            .hasNoCause();
+  }
+  
+  @Test
+  public void catchExceptionShouldCatchExceptionAndUseHamcrestAssertion() {
+    // given: an empty list
+    List<?> myList = new ArrayList<Object>();
+
+    // when: we try to get the first element of the list
+    catchException(myList).get(1);
+
+    // then: we expect an IndexOutOfBoundsException with message "Index: 1, Size: 0"
+    assertThat(caughtException(),
+      allOf(
+        instanceOf(IndexOutOfBoundsException.class),
+        hasMessage("Index: 1, Size: 0"),
+        hasNoCause()
+      )
+    );
+  }
+  
+  @Test
+  public void shouldCatchFromThrowException() throws Exception {
+    String message = "error message";
+    
+    catchException(this).throwException(message);
+    
+    assertThat(caughtException(), is(instanceOf(Exception.class)));
+  }
+  
+  @Test
+  public void shouldVerifyFromThrowException() throws Exception {
+    String message = "error message";
+
+    verifyException(this).throwException(message);
+  }
+  
+  // fails if private
+  protected void throwException(final String message) throws Exception {
+    throw new Exception(message);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/JUnitParamsExampleJUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/JUnitParamsExampleJUnitTest.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/JUnitParamsExampleJUnitTest.java
new file mode 100755
index 0000000..3e9edb0
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/examples/JUnitParamsExampleJUnitTest.java
@@ -0,0 +1,52 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.gemstone.gemfire.test.examples;
+
+import static org.hamcrest.Matchers.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import com.gemstone.gemfire.test.junit.categories.UnitTest;
+
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+
+@Category(UnitTest.class)
+@RunWith(JUnitParamsRunner.class)
+public class JUnitParamsExampleJUnitTest {
+  @Test
+  @Parameters({"17, false", 
+               "22, true" })
+  public void personIsAdult(int age, boolean valid) throws Exception {
+    assertThat(true, is(true));
+    assertThat(new Person(age).isAdult(), is(valid));
+  }
+  
+  protected static class Person {
+    private static final int MIN_AGE_OF_ADULT = 18;
+    private final int age;
+    public Person(final int age) {
+      this.age = age;
+    }
+    public Boolean isAdult() {
+      return this.age >= MIN_AGE_OF_ADULT;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataDUnitTest.java
index c26282c..fbad416 100644
--- a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataDUnitTest.java
+++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataDUnitTest.java
@@ -38,11 +38,17 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
 import com.gemstone.gemfire.cache30.CacheTestCase;
 import com.gemstone.gemfire.cache30.CertifiableTestCacheListener;
 import com.gemstone.gemfire.internal.AvailablePortHelper;
+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.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterSupport;
+import com.gemstone.gemfire.test.dunit.NetworkSupport;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.Threads;
 import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
 
 /**
  * This class tests the ContiunousQuery mechanism in GemFire.
@@ -64,7 +70,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     // avoid IllegalStateException from HandShake by connecting all vms tor
     // system before creating ConnectionPools
     getSystem();
-    invokeInEveryVM(new SerializableRunnable("getSystem") {
+    Invoke.invokeInEveryVM(new SerializableRunnable("getSystem") {
       public void run() {
         getSystem();
       }
@@ -90,7 +96,7 @@ public class CqDataDUnitTest extends CacheTestCase {
 
     final int port = server.invokeInt(CqQueryDUnitTest.class,
         "getCacheServerPort");
-    final String host0 = getServerHostName(server.getHost());
+    final String host0 = NetworkSupport.getServerHostName(server.getHost());
 
     // Create client.
     cqDUnitTest.createClient(client, port, host0);
@@ -132,11 +138,11 @@ public class CqDataDUnitTest extends CacheTestCase {
     VM client = host.getVM(3);
     
     //Killing servers can cause this message on the client side.
-    addExpectedException("Could not find any server");
+    IgnoredException.addIgnoredException("Could not find any server");
     cqDUnitTest.createServer(server1);
     
     final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    final String host0 = getServerHostName(server1.getHost());
+    final String host0 = NetworkSupport.getServerHostName(server1.getHost());
     
     final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(2);
     
@@ -156,7 +162,7 @@ public class CqDataDUnitTest extends CacheTestCase {
       cqDUnitTest.executeCQ(client, "testCQHAWithState_" + i, false, null);
     }
     
-    pause(1 * 1000);
+    Wait.pause(1 * 1000);
     
     int size = 10;
     
@@ -178,7 +184,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     // Close server1.
     // To maintain the redundancy; it will make connection to endpoint-3.
     cqDUnitTest.closeServer(server1);
-    pause(3 * 1000);
+    Wait.pause(3 * 1000);
     
     
     // UPDATE-1.
@@ -196,12 +202,12 @@ public class CqDataDUnitTest extends CacheTestCase {
     //Stop cq.
     cqDUnitTest.stopCQ(client, "testCQHAWithState_0");
     
-    pause(2 * 1000);
+    Wait.pause(2 * 1000);
     
     // UPDATE with stop.
     cqDUnitTest.createServer(server3, ports[1]);
     server3.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    pause(2 * 1000);
+    Wait.pause(2 * 1000);
     
     cqDUnitTest.clearCQListenerEvents(client, "testCQHAWithState_0");
     
@@ -217,7 +223,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     }
     
     cqDUnitTest.executeCQ(client, "testCQHAWithState_0", false, null);
-    pause(2 * 1000);
+    Wait.pause(2 * 1000);
     
     // Update - 2 
     cqDUnitTest.createValues(server3, cqDUnitTest.regions[0], 10);    
@@ -253,7 +259,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     cqDUnitTest.createServer(server, 0, true);
     final int port = server.invokeInt(CqQueryDUnitTest.class,
         "getCacheServerPort");
-    final String host0 = getServerHostName(server.getHost());
+    final String host0 = NetworkSupport.getServerHostName(server.getHost());
 
     // Create client.
     cqDUnitTest.createClient(client, port, host0);
@@ -328,7 +334,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     /* Create Server and Client */
     cqDUnitTest.createServer(server);
     final int port = server.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    final String host0 = getServerHostName(server.getHost());
+    final String host0 = NetworkSupport.getServerHostName(server.getHost());
     cqDUnitTest.createClient(client1, port, host0);
     cqDUnitTest.createClient(client2, port, host0);
     
@@ -397,7 +403,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     cqDUnitTest.createServer(server2, 0, false, MirrorType.KEYS);
         
     final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    final String host0 = getServerHostName(server1.getHost());
+    final String host0 = NetworkSupport.getServerHostName(server1.getHost());
       
     cqDUnitTest.createClient(client, port1, host0);
     
@@ -405,7 +411,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     cqDUnitTest.createCQ(client, "testCQWithLoad_0", cqDUnitTest.cqs[0]);  
     cqDUnitTest.executeCQ(client, "testCQWithLoad_0", false, null); 
     
-    pause(2 * 1000);
+    Wait.pause(2 * 1000);
     
     final int size = 10;
     
@@ -445,7 +451,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     final int evictionThreshold = 1;
     server1.invoke(new CacheSerializableRunnable("Create Cache Server") {
       public void run2() throws CacheException {
-        getLogWriter().info("### Create Cache Server. ###");
+        LogWriterSupport.getLogWriter().info("### Create Cache Server. ###");
         AttributesFactory factory = new AttributesFactory();
         factory.setScope(Scope.DISTRIBUTED_ACK);
         factory.setDataPolicy(DataPolicy.REPLICATE);
@@ -458,22 +464,22 @@ public class CqDataDUnitTest extends CacheTestCase {
         for (int i = 0; i < cqDUnitTest.regions.length; i++) { 
           Region region = createRegion(cqDUnitTest.regions[i], factory.createRegionAttributes());
           // Set CacheListener.
-          region.getAttributesMutator().setCacheListener(new CertifiableTestCacheListener(getLogWriter()));  
+          region.getAttributesMutator().setCacheListener(new CertifiableTestCacheListener(LogWriterSupport.getLogWriter()));  
         } 
-        pause(2000);
+        Wait.pause(2000);
         
         try {
           cqDUnitTest.startBridgeServer(0, true);
         } catch (Exception ex) {
-          fail("While starting CacheServer", ex);
+          Assert.fail("While starting CacheServer", ex);
         }
-        pause(2000);
+        Wait.pause(2000);
 
       }
     });
         
     final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    final String host0 = getServerHostName(server1.getHost());
+    final String host0 = NetworkSupport.getServerHostName(server1.getHost());
       
     cqDUnitTest.createClient(client, port1, host0);
     
@@ -487,7 +493,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     
     cqDUnitTest.executeCQ(client, "testCQWithEviction_0", false, "CqException"); 
     
-    pause(1 * 1000);
+    Wait.pause(1 * 1000);
 
     // Update VALUES.
     cqDUnitTest.createValues(server1, cqDUnitTest.regions[0], size);
@@ -515,7 +521,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
 
     final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    final String serverHost = getServerHostName(server1.getHost());
+    final String serverHost = NetworkSupport.getServerHostName(server1.getHost());
 
     final String[] regions = cqDUnitTest.regions;
     final int[] serverPorts = new int[] {port1};
@@ -524,7 +530,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     SerializableRunnable createClientWithPool =
       new CacheSerializableRunnable("createClientWithPool") {
       public void run2() throws CacheException {
-        getLogWriter().info("### Create Client. ###");
+        LogWriterSupport.getLogWriter().info("### Create Client. ###");
         // Initialize CQ Service.
         try {
           getCache().getQueryService();
@@ -538,7 +544,7 @@ public class CqDataDUnitTest extends CacheTestCase {
         ClientServerTestCase.configureConnectionPool(regionFactory, serverHost, serverPorts[0], -1, false, -1, -1, null);
         for (int i=0; i < regions.length; i++) {        
           createRegion(regions[i], regionFactory.create() );
-          getLogWriter().info("### Successfully Created Region on Client :" + regions[i]);
+          LogWriterSupport.getLogWriter().info("### Successfully Created Region on Client :" + regions[i]);
         }
       }
     };
@@ -573,7 +579,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
 
     final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    final String serverHost = getServerHostName(server1.getHost());
+    final String serverHost = NetworkSupport.getServerHostName(server1.getHost());
 
     final String[] regions = cqDUnitTest.regions;
     final int[] serverPorts = new int[] {port1};
@@ -582,7 +588,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     SerializableRunnable createClientWithPool =
       new CacheSerializableRunnable("createClientWithPool") {
       public void run2() throws CacheException {
-        getLogWriter().info("### Create Client. ###");
+        LogWriterSupport.getLogWriter().info("### Create Client. ###");
         //Region region1 = null;
         // Initialize CQ Service.
         try {
@@ -598,7 +604,7 @@ public class CqDataDUnitTest extends CacheTestCase {
 
         for (int i=0; i < regions.length; i++) {        
           createRegion(regions[i], regionFactory.createRegionAttributes());
-          getLogWriter().info("### Successfully Created Region on Client :" + regions[i]);
+          LogWriterSupport.getLogWriter().info("### Successfully Created Region on Client :" + regions[i]);
         }
       }
     };
@@ -628,7 +634,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
 
     final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    final String serverHost = getServerHostName(server1.getHost());
+    final String serverHost = NetworkSupport.getServerHostName(server1.getHost());
 
     final String[] regions = cqDUnitTest.regions;
     final int[] serverPorts = new int[] {port1};
@@ -637,7 +643,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     SerializableRunnable createClientWithConnectionPool =
       new CacheSerializableRunnable("createClientWithConnectionPool") {
       public void run2() throws CacheException {
-        getLogWriter().info("### Create Client. ###");
+        LogWriterSupport.getLogWriter().info("### Create Client. ###");
         //Region region1 = null;
         // Initialize CQ Service.
         try {
@@ -652,7 +658,7 @@ public class CqDataDUnitTest extends CacheTestCase {
         ClientServerTestCase.configureConnectionPool(regionFactory, serverHost, serverPorts[0], -1, true, -1, -1, null);
         for (int i=0; i < regions.length; i++) {        
           createRegion(regions[i], regionFactory.createRegionAttributes());
-          getLogWriter().info("### Successfully Created Region on Client :" + regions[i]);
+          LogWriterSupport.getLogWriter().info("### Successfully Created Region on Client :" + regions[i]);
         }
       }
     };
@@ -682,7 +688,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     cqDUnitTest.createServer(server1, 0, false, MirrorType.KEYS_VALUES);
 
     final int port1 = server1.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    final String serverHost = getServerHostName(server1.getHost());
+    final String serverHost = NetworkSupport.getServerHostName(server1.getHost());
 
     final String[] regions = cqDUnitTest.regions;
     final int[] serverPorts = new int[] {port1};
@@ -691,7 +697,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     SerializableRunnable createClientWithPool =
       new CacheSerializableRunnable("createClientWithPool") {
       public void run2() throws CacheException {
-        getLogWriter().info("### Create Client. ###");
+        LogWriterSupport.getLogWriter().info("### Create Client. ###");
         //Region region1 = null;
         // Initialize CQ Service.
         try {
@@ -708,7 +714,7 @@ public class CqDataDUnitTest extends CacheTestCase {
 
         for (int i=0; i < regions.length; i++) {        
           createRegion(regions[i], regionFactory.createRegionAttributes());
-          getLogWriter().info("### Successfully Created Region on Client :" + regions[i]);
+          LogWriterSupport.getLogWriter().info("### Successfully Created Region on Client :" + regions[i]);
         }
       }
     };
@@ -747,7 +753,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     
     cqDUnitTest.createServer(server);
     final int port = server.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    final String host0 = getServerHostName(server.getHost());
+    final String host0 = NetworkSupport.getServerHostName(server.getHost());
     
     cqDUnitTest.createClient(client, port, host0);
     
@@ -762,7 +768,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     // Test for Event on Region Clear.
     server.invoke(new CacheSerializableRunnable("testRegionEvents"){
       public void run2()throws CacheException {
-        getLogWriter().info("### Clearing the region on the server ###");
+        LogWriterSupport.getLogWriter().info("### Clearing the region on the server ###");
         Region region = getCache().getRegion("/root/" + cqDUnitTest.regions[0]);
         for (int i = 1; i <=5; i++) {
           region.put(CqQueryDUnitTest.KEY+i, new Portfolio(i));
@@ -776,7 +782,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     // Test for Event on Region invalidate.
     server.invoke(new CacheSerializableRunnable("testRegionEvents"){
       public void run2()throws CacheException {
-        getLogWriter().info("### Invalidate the region on the server ###");
+        LogWriterSupport.getLogWriter().info("### Invalidate the region on the server ###");
         Region region = getCache().getRegion("/root/" + cqDUnitTest.regions[0]);
         for (int i = 1; i <=5; i++) {
           region.put(CqQueryDUnitTest.KEY+i, new Portfolio(i));
@@ -790,7 +796,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     // Test for Event on Region destroy.
     server.invoke(new CacheSerializableRunnable("testRegionEvents"){
       public void run2()throws CacheException {
-        getLogWriter().info("### Destroying the region on the server ###");
+        LogWriterSupport.getLogWriter().info("### Destroying the region on the server ###");
         Region region = getCache().getRegion("/root/" + cqDUnitTest.regions[1]);
         for (int i = 1; i <=5; i++) {
           region.put(CqQueryDUnitTest.KEY+i, new Portfolio(i));
@@ -800,7 +806,7 @@ public class CqDataDUnitTest extends CacheTestCase {
       }
     });
 
-    pause(1000); // wait for cq to close becuse of region destroy on server.
+    Wait.pause(1000); // wait for cq to close becuse of region destroy on server.
     //cqDUnitTest.waitForClose(client,"testRegionEvents_1");
     cqDUnitTest.validateCQCount(client,1);
 
@@ -828,7 +834,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     final String cqName = "testEventsDuringQueryExecution_0";
     cqDUnitTest.createServer(server);
     final int port = server.invokeInt(CqQueryDUnitTest.class, "getCacheServerPort");
-    final String host0 = getServerHostName(server.getHost());
+    final String host0 = NetworkSupport.getServerHostName(server.getHost());
     
     // Initialize Client.
     cqDUnitTest.createClient(client, port, host0);
@@ -937,7 +943,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     });
 
     //wait for 60 seconds for test to complete
-    DistributedTestCase.join(processCqs, 60 * 1000, getLogWriter());
+    Threads.join(processCqs, 60 * 1000, LogWriterSupport.getLogWriter());
     
     // Close.
     cqDUnitTest.closeClient(client);
@@ -968,7 +974,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     cqDUnitTest.createServer(server);
     final int port = server.invokeInt(CqQueryDUnitTest.class,
         "getCacheServerPort");
-    final String host0 = getServerHostName(server.getHost());
+    final String host0 = NetworkSupport.getServerHostName(server.getHost());
 
     // Initialize Client.
     cqDUnitTest.createClient(client, port, host0);
@@ -1113,7 +1119,7 @@ public class CqDataDUnitTest extends CacheTestCase {
     });
 
     //wait for 60 seconds for test to complete
-    DistributedTestCase.join(processCqs, 60 * 1000, getLogWriter());
+    Threads.join(processCqs, 60 * 1000, LogWriterSupport.getLogWriter());
     // Close.
     cqDUnitTest.closeClient(client);
     cqDUnitTest.closeServer(server);

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/76e324b5/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataOptimizedExecuteDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataOptimizedExecuteDUnitTest.java b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataOptimizedExecuteDUnitTest.java
index 45f61f8..6b97fc9 100644
--- a/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataOptimizedExecuteDUnitTest.java
+++ b/gemfire-cq/src/test/java/com/gemstone/gemfire/cache/query/cq/dunit/CqDataOptimizedExecuteDUnitTest.java
@@ -18,6 +18,8 @@ package com.gemstone.gemfire.cache.query.cq.dunit;
 
 
 import com.gemstone.gemfire.cache.query.internal.cq.CqServiceImpl;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
 import com.gemstone.gemfire.test.dunit.SerializableRunnable;
 
 /**
@@ -34,8 +36,8 @@ public class CqDataOptimizedExecuteDUnitTest extends CqDataDUnitTest{
     super.setUp();
     //We're seeing this on the server when the client
     //disconnects.
-    addExpectedException("Connection reset");
-    invokeInEveryVM(new SerializableRunnable("getSystem") {
+    IgnoredException.addIgnoredException("Connection reset");
+    Invoke.invokeInEveryVM(new SerializableRunnable("getSystem") {
       public void run() {
         CqServiceImpl.EXECUTE_QUERY_DURING_INIT = false;
       }
@@ -44,7 +46,7 @@ public class CqDataOptimizedExecuteDUnitTest extends CqDataDUnitTest{
   
   @Override
   public void tearDown2() throws Exception {
-    invokeInEveryVM(new SerializableRunnable("getSystem") {
+    Invoke.invokeInEveryVM(new SerializableRunnable("getSystem") {
       public void run() {
         CqServiceImpl.EXECUTE_QUERY_DURING_INIT = true;
       }


Mime
View raw message