geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [37/50] [abbrv] incubator-geode git commit: Refactor dunit
Date Mon, 01 Feb 2016 20:55:54 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DebuggerSupport.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DebuggerSupport.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DebuggerSupport.java
new file mode 100755
index 0000000..47cb89f
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DebuggerSupport.java
@@ -0,0 +1,5 @@
+package com.gemstone.gemfire.test.dunit;
+
+public class DebuggerSupport {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
index 80f5a47..d753539 100755
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/DistributedTestCase.java
@@ -17,9 +17,6 @@
 package com.gemstone.gemfire.test.dunit;
 
 import java.io.File;
-import java.io.PrintWriter;
-import java.io.Serializable;
-import java.io.StringWriter;
 import java.net.UnknownHostException;
 import java.text.DecimalFormat;
 import java.util.HashMap;
@@ -28,9 +25,7 @@ import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Random;
-import java.util.concurrent.ConcurrentLinkedQueue;
 
-import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
 import org.junit.experimental.categories.Category;
 
@@ -141,8 +136,6 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
   private static Properties lastSystemProperties;
   public static volatile String testName;
   
-  private static ConcurrentLinkedQueue<ExpectedException> expectedExceptions = new
ConcurrentLinkedQueue<ExpectedException>();
-
   /** For formatting timing info */
   private static final DecimalFormat format = new DecimalFormat("###.###");
 
@@ -780,10 +773,7 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
     if (InternalDistributedSystem.systemAttemptingReconnect != null) {
       InternalDistributedSystem.systemAttemptingReconnect.stopReconnecting();
     }
-    ExpectedException ex;
-    while((ex = expectedExceptions.poll()) != null) {
-      ex.remove();
-    }
+    IgnoredException.removeAllExpectedExceptions();
   }
 
   private static void closeCache() {
@@ -957,14 +947,10 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
   /**
    * Helper method that causes this test to fail because of the given
    * exception.
+   * @deprecated Use {@link Assert#fail(String,Throwable)} instead
    */
   public static void fail(String message, Throwable ex) {
-    StringWriter sw = new StringWriter();
-    PrintWriter pw = new PrintWriter(sw, true);
-    pw.print(message);
-    pw.print(": ");
-    ex.printStackTrace(pw);
-    fail(sw.toString());
+    Assert.fail(message, ex);
   }
 
   // utility methods
@@ -998,7 +984,7 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
       }
     }
     catch (InterruptedException e) {
-      fail("interrupted", e);
+      Assert.fail("interrupted", e);
     }
     
   }
@@ -1044,7 +1030,7 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
       }
     }
     catch (InterruptedException e) {
-      fail("interrupted", e);
+      Assert.fail("interrupted", e);
     }
   }
   
@@ -1062,37 +1048,6 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
   }
 
   /**
-   * If true, we randomize the amount of time we wait before polling a
-   * {@link WaitCriterion}.
-   */
-  static private final boolean USE_JITTER = true;
-  static private final Random jitter = new Random();
-  
-  /**
-   * Return a jittered interval up to a maximum of <code>ms</code>
-   * milliseconds, inclusive.
-   * 
-   * The result is bounded by 50 ms as a minimum and 5000 ms as a maximum.
-   * 
-   * @param ms total amount of time to wait
-   * @return randomized interval we should wait
-   */
-  private static int jitterInterval(long ms) {
-    final int minLegal = 50;
-    final int maxLegal = 5000;
-    if (ms <= minLegal) {
-      return (int)ms; // Don't ever jitter anything below this.
-    }
-
-    int maxReturn = maxLegal;
-    if (ms < maxLegal) {
-      maxReturn = (int)ms;
-    }
-
-    return minLegal + jitter.nextInt(maxReturn - minLegal + 1);
-  }
-  
-  /**
    * Wait until given criterion is met
    * @param ev criterion to wait on
    * @param ms total time to wait, in milliseconds
@@ -1103,13 +1058,7 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
   @Deprecated
   static public void waitForCriterion(WaitCriterion ev, long ms, 
       long interval, boolean throwOnTimeout) {
-    long waitThisTime;
-    if (USE_JITTER) {
-      waitThisTime = jitterInterval(interval);
-    }
-    else {
-      waitThisTime = interval;
-    }
+    long waitThisTime = Jitter.jitterInterval(interval);
     final long tilt = System.currentTimeMillis() + ms;
     for (;;) {
 //      getLogWriter().info("Testing to see if event has occurred: " + ev.description());
@@ -1162,13 +1111,7 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
   static public void waitMutex(WaitCriterion ev, Object mutex, long ms, 
       long interval, boolean throwOnTimeout) {
     final long tilt = System.currentTimeMillis() + ms;
-    long waitThisTime;
-    if (USE_JITTER) {
-      waitThisTime = jitterInterval(interval);
-    }
-    else {
-      waitThisTime = interval;
-    }
+    long waitThisTime = Jitter.jitterInterval(interval);
     synchronized (mutex) {
       for (;;) {
         if (ev.done()) {
@@ -1204,13 +1147,7 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
    */
   static public void join(Thread t, long ms, LogWriter logger) {
     final long tilt = System.currentTimeMillis() + ms;
-    final long incrementalWait;
-    if (USE_JITTER) {
-      incrementalWait = jitterInterval(ms);
-    }
-    else {
-      incrementalWait = ms; // wait entire time, no looping.
-    }
+    final long incrementalWait = Jitter.jitterInterval(ms);
     final long start = System.currentTimeMillis();
     for (;;) {
       // I really do *not* understand why this check is necessary
@@ -1272,74 +1209,40 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
   }
   
   /**
-   * A class that represents an currently logged expected exception, which
-   * should be removed
-   * 
-   * @author Mitch Thomas
-   * @since 5.7bugfix
+   * @deprecated Use {@link IgnoredException} instead.
    */
-  public static class ExpectedException implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    final String ex;
-
-    final transient VM v;
+  @Deprecated
+  public static class ExpectedException extends IgnoredException {
 
-    public ExpectedException(String exception) {
-      this.ex = exception;
-      this.v = null;
+    private final IgnoredException wrappedInstance;
+    
+    public ExpectedException(final IgnoredException wrappedInstance) {
+      super(wrappedInstance.errorString(), wrappedInstance.vm());
+      this.wrappedInstance = wrappedInstance;
     }
-
-    ExpectedException(String exception, VM vm) {
-      this.ex = exception;
-      this.v = vm;
+    
+    public ExpectedException(final String exception) {
+      this(exception, null);
     }
-
-    public String getRemoveString() {
-      return "<ExpectedException action=remove>" + ex + "</ExpectedException>";
+    
+    private ExpectedException(final String exception, final VM vm) {
+      super(exception, vm);
+      this.wrappedInstance = new IgnoredException(exception);
     }
-
-    public String getAddString() {
-      return "<ExpectedException action=add>" + ex + "</ExpectedException>";
+    
+    public String getAddMessage() {
+      return this.wrappedInstance.getAddMessage();
     }
-
+    
+    public String getRemoveMessage() {
+      return this.wrappedInstance.getRemoveMessage();
+    }
+    
     public void remove() {
-      SerializableRunnable removeRunnable = new SerializableRunnable(
-          "removeExpectedExceptions") {
-        public void run() {
-          final String remove = getRemoveString();
-          final InternalDistributedSystem sys = InternalDistributedSystem
-              .getConnectedInstance();
-          if (sys != null) {
-            sys.getLogWriter().info(remove);
-          }
-          try {
-            getLogWriter().info(remove);
-          } catch (Exception noHydraLogger) {
-          }
-
-          logger.info(remove);
-        }
-      };
-
-      if (this.v != null) {
-        v.invoke(removeRunnable);
-      }
-      else {
-        invokeInEveryVM(removeRunnable);
-      }
-      String s = getRemoveString();
-      LogManager.getLogger(LogService.BASE_LOGGER_NAME).info(s);
-      // log it locally
-      final InternalDistributedSystem sys = InternalDistributedSystem
-          .getConnectedInstance();
-      if (sys != null) { // avoid creating a system
-        sys.getLogWriter().info(s);
-      }
-      getLogWriter().info(s);
+      this.wrappedInstance.remove();
     }
   }
-
+  
   /**
    * Log in all VMs, in both the test logger and the GemFire logger the
    * expected exception string to prevent grep logs from complaining. The
@@ -1353,9 +1256,10 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
    * @param exception
    *          the exception string to expect
    * @return an ExpectedException instance for removal
+   * @deprecated Use {@link IgnoredException#addExpectedException(String)} instead
    */
   public static ExpectedException addExpectedException(final String exception) {
-    return addExpectedException(exception, null);
+    return new ExpectedException(IgnoredException.addExpectedException(exception));
   }
 
   /**
@@ -1370,51 +1274,10 @@ public abstract class DistributedTestCase extends TestCase implements
java.io.Se
    * @param v
    *          the VM on which to log the expected exception or null for all VMs
    * @return an ExpectedException instance for removal purposes
+   * @deprecated Use {@link IgnoredException#addExpectedException(String,VM)} instead
    */
-  public static ExpectedException addExpectedException(final String exception,
-      VM v) {
-    final ExpectedException ret;
-    if (v != null) {
-      ret = new ExpectedException(exception, v);
-    }
-    else {
-      ret = new ExpectedException(exception);
-    }
-    // define the add and remove expected exceptions
-    final String add = ret.getAddString();
-    SerializableRunnable addRunnable = new SerializableRunnable(
-        "addExpectedExceptions") {
-      public void run() {
-        final InternalDistributedSystem sys = InternalDistributedSystem
-            .getConnectedInstance();
-        if (sys != null) {
-          sys.getLogWriter().info(add);
-        }
-        try {
-          getLogWriter().info(add);
-        } catch (Exception noHydraLogger) {
-        }
- 
-        logger.info(add);
-      }
-    };
-    if (v != null) {
-      v.invoke(addRunnable);
-    }
-    else {
-      invokeInEveryVM(addRunnable);
-    }
-    
-    LogManager.getLogger(LogService.BASE_LOGGER_NAME).info(add);
-    // Log it locally too
-    final InternalDistributedSystem sys = InternalDistributedSystem
-        .getConnectedInstance();
-    if (sys != null) { // avoid creating a cache
-      sys.getLogWriter().info(add);
-    }
-    getLogWriter().info(add);
-    expectedExceptions.add(ret);
-    return ret;
+  public static IgnoredException addExpectedException(final String exception, final VM v)
{
+    return new ExpectedException(IgnoredException.addExpectedException(exception, v));
   }
 
   /** 

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/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
new file mode 100755
index 0000000..92f879c
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/IgnoredException.java
@@ -0,0 +1,174 @@
+package com.gemstone.gemfire.test.dunit;
+
+import java.io.Serializable;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.internal.logging.LogService;
+
+/**
+ * A class that represents an currently logged expected exception, which
+ * should be removed
+ * 
+ * @author Mitch Thomas
+ * @since 5.7bugfix
+ */
+public class IgnoredException implements Serializable {
+  private static final Logger logger = LogService.getLogger();
+  private static final long serialVersionUID = 1L;
+
+  private final String errorString;
+
+  private final transient VM vm;
+  
+  private static ConcurrentLinkedQueue<IgnoredException> ignoredExceptions = new ConcurrentLinkedQueue<IgnoredException>();
+
+  public IgnoredException(final String errorString) {
+    this.errorString = errorString;
+    this.vm = null;
+  }
+
+  IgnoredException(final String errorString, final VM vm) {
+    this.errorString = errorString;
+    this.vm = vm;
+  }
+
+  String errorString() {
+    return this.errorString;
+  }
+  
+  VM vm() {
+    return this.vm;
+  }
+  
+  public String getRemoveMessage() {
+    return "<ExpectedException action=remove>" + errorString + "</ExpectedException>";
+  }
+
+  public String getAddMessage() {
+    return "<ExpectedException action=add>" + errorString + "</ExpectedException>";
+  }
+
+  public void remove() {
+    SerializableRunnable removeRunnable = new SerializableRunnable(
+        "removeExpectedExceptions") {
+      public void run() {
+        final String remove = getRemoveMessage();
+        final InternalDistributedSystem sys = InternalDistributedSystem
+            .getConnectedInstance();
+        if (sys != null) {
+          sys.getLogWriter().info(remove);
+        }
+        try {
+          DistributedTestCase.getLogWriter().info(remove);
+        } catch (Exception noHydraLogger) {
+        }
+
+        logger.info(remove);
+      }
+    };
+
+    if (this.vm != null) {
+      vm.invoke(removeRunnable);
+    }
+    else {
+      DistributedTestCase.invokeInEveryVM(removeRunnable);
+    }
+    String s = getRemoveMessage();
+    LogManager.getLogger(LogService.BASE_LOGGER_NAME).info(s);
+    // log it locally
+    final InternalDistributedSystem sys = InternalDistributedSystem
+        .getConnectedInstance();
+    if (sys != null) { // avoid creating a system
+      sys.getLogWriter().info(s);
+    }
+    DistributedTestCase.getLogWriter().info(s);
+  }
+
+  public static void removeAllExpectedExceptions() {
+    IgnoredException ex;
+    while((ex = ignoredExceptions.poll()) != null) {
+      ex.remove();
+    }
+  }
+
+  /**
+   * Log in all VMs, in both the test logger and the GemFire logger the
+   * expected exception string to prevent grep logs from complaining. The
+   * expected string is used by the GrepLogs utility and so can contain
+   * regular expression characters.
+   * 
+   * @since 5.7bugfix
+   * @param exception
+   *          the exception string to expect
+   * @param v
+   *          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,
+      VM v) {
+    final IgnoredException ret;
+    if (v != null) {
+      ret = new IgnoredException(exception, v);
+    }
+    else {
+      ret = new IgnoredException(exception);
+    }
+    // define the add and remove expected exceptions
+    final String add = ret.getAddMessage();
+    SerializableRunnable addRunnable = new SerializableRunnable(
+        "addExpectedExceptions") {
+      public void run() {
+        final InternalDistributedSystem sys = InternalDistributedSystem
+            .getConnectedInstance();
+        if (sys != null) {
+          sys.getLogWriter().info(add);
+        }
+        try {
+          DistributedTestCase.getLogWriter().info(add);
+        } catch (Exception noHydraLogger) {
+        }
+  
+        logger.info(add);
+      }
+    };
+    if (v != null) {
+      v.invoke(addRunnable);
+    }
+    else {
+      DistributedTestCase.invokeInEveryVM(addRunnable);
+    }
+    
+    LogManager.getLogger(LogService.BASE_LOGGER_NAME).info(add);
+    // Log it locally too
+    final InternalDistributedSystem sys = InternalDistributedSystem
+        .getConnectedInstance();
+    if (sys != null) { // avoid creating a cache
+      sys.getLogWriter().info(add);
+    }
+    DistributedTestCase.getLogWriter().info(add);
+    IgnoredException.ignoredExceptions.add(ret);
+    return ret;
+  }
+
+  /**
+   * Log in all VMs, in both the test logger and the GemFire logger the
+   * expected exception string to prevent grep logs from complaining. The
+   * expected string is used by the GrepLogs utility and so can contain
+   * regular expression characters.
+   * 
+   * If you do not remove the expected exception, it will be removed at the
+   * end of your test case automatically.
+   * 
+   * @since 5.7bugfix
+   * @param exception
+   *          the exception string to expect
+   * @return an ExpectedException instance for removal
+   */
+  public static IgnoredException addExpectedException(final String exception) {
+    return IgnoredException.addExpectedException(exception, null);
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/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
new file mode 100755
index 0000000..47109a8
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Invoke.java
@@ -0,0 +1,22 @@
+package com.gemstone.gemfire.test.dunit;
+
+public class Invoke {
+
+  /**
+   * Invokes a <code>SerializableRunnable</code> in every VM that
+   * DUnit knows about.
+   *
+   * @see VM#invoke(Runnable)
+   */
+  public static void invokeInEveryVM(SerializableRunnable work) {
+    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(work);
+      }
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Jitter.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Jitter.java b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Jitter.java
new file mode 100755
index 0000000..08fe71a
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Jitter.java
@@ -0,0 +1,87 @@
+/*
+ * 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.Random;
+
+/**
+ * Extracted from DistributedTestCase
+ */
+class Jitter {
+
+  /**
+   * If true, we randomize the amount of time we wait before polling a
+   * {@link WaitCriterion}.
+   */
+  private static final boolean USE_JITTER = true;
+  
+  private static final Random jitter = new Random();
+
+  protected Jitter() {
+  }
+
+  /**
+   * Returns an adjusted interval from <code>minimum()</code to 
+   * <code>intervalMillis</code> milliseconds. If jittering is disabled then

+   * the value returned will be equal to intervalMillis.
+   * 
+   * @param intervalMillis
+   * @return adjust milliseconds to use as interval for WaitCriteria polling
+   */
+  static long jitterInterval(long intervalMillis) {
+    if (USE_JITTER) {
+      return adjustIntervalIfJitterIsEnabled(intervalMillis);
+    } else {
+      return intervalMillis;
+    }
+  }
+  
+  static int minimum() {
+    return 10;
+  }
+  
+  static int maximum() {
+    return 5000;
+  }
+  
+  /**
+   * If jittering is enabled then returns a jittered interval up to a maximum
+   * of <code>intervalMillis</code> milliseconds, inclusive.
+   * 
+   * If jittering is disabled then returns <code>intervalMillis</code>.
+   * 
+   * The result is bounded by 50 ms as a minimum and 5000 ms as a maximum.
+   * 
+   * @param ms total amount of time to wait
+   * @return randomized interval we should wait
+   */
+  private static int adjustIntervalIfJitterIsEnabled(final long intervalMillis) {
+    final int minLegal = minimum();
+    final int maxLegal = maximum();
+    
+    if (intervalMillis <= minLegal) {
+      return (int)intervalMillis; // Don't ever jitter anything below this.
+    }
+
+    int maxValue = maxLegal;
+    if (intervalMillis < maxLegal) {
+      maxValue = (int)intervalMillis;
+    }
+
+    return minLegal + jitter.nextInt(maxValue - minLegal + 1);
+  }
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/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
new file mode 100755
index 0000000..f86bef7
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/NetworkSupport.java
@@ -0,0 +1,5 @@
+package com.gemstone.gemfire.test.dunit;
+
+public class NetworkSupport {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/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
new file mode 100755
index 0000000..4587244
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/StoppableWaitCriterion.java
@@ -0,0 +1,9 @@
+package com.gemstone.gemfire.test.dunit;
+
+public interface StoppableWaitCriterion extends WaitCriterion {
+  /**
+   * If this method returns true then quit waiting even if we are not done.
+   * This allows a wait to fail early.
+   */
+  public boolean stopWaiting();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/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
new file mode 100755
index 0000000..4bb4aa9
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Threads.java
@@ -0,0 +1,10 @@
+package com.gemstone.gemfire.test.dunit;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.internal.logging.LogService;
+
+public class Threads {
+  private static final Logger logger = LogService.getLogger();
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/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
new file mode 100755
index 0000000..a26335e
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/Wait.java
@@ -0,0 +1,10 @@
+package com.gemstone.gemfire.test.dunit;
+
+import org.apache.logging.log4j.Logger;
+
+import com.gemstone.gemfire.internal.logging.LogService;
+import com.jayway.awaitility.Awaitility;
+
+public class Wait {
+  private static final Logger logger = LogService.getLogger();
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/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
new file mode 100755
index 0000000..40ba133
--- /dev/null
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/WaitCriterion.java
@@ -0,0 +1,6 @@
+package com.gemstone.gemfire.test.dunit;
+
+public interface WaitCriterion {
+  public boolean done();
+  public String description();
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/0d759cb3/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/BasicDUnitTest.java
----------------------------------------------------------------------
diff --git a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/BasicDUnitTest.java
b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/BasicDUnitTest.java
index 18e5f72..f9d033c 100644
--- a/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/BasicDUnitTest.java
+++ b/gemfire-core/src/test/java/com/gemstone/gemfire/test/dunit/tests/BasicDUnitTest.java
@@ -18,6 +18,7 @@ package com.gemstone.gemfire.test.dunit.tests;
 
 import java.util.Properties;
 
+import com.gemstone.gemfire.test.dunit.Assert;
 import com.gemstone.gemfire.test.dunit.AsyncInvocation;
 import com.gemstone.gemfire.test.dunit.DUnitEnv;
 import com.gemstone.gemfire.test.dunit.DistributedTestCase;
@@ -117,14 +118,14 @@ public class BasicDUnitTest extends DistributedTestCase {
     ai.join();
     // TODO shouldn't we call fail() here?
     if (ai.exceptionOccurred()) {
-      fail("remoteBind failed", ai.getException());
+      Assert.fail("remoteBind failed", ai.getException());
     }
 
     ai = vm.invokeAsync(this.getClass(), "remoteValidateBind",
                         new Object[] {name, value });
     ai.join();
     if (ai.exceptionOccurred()) {
-      fail("remoteValidateBind failed", ai.getException());
+      Assert.fail("remoteValidateBind failed", ai.getException());
     }
   }
 


Mime
View raw message