You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2014/05/23 17:07:02 UTC

[01/29] git commit: Upgrade to latest versions of dependencies/plugins (include ZK 3.4.6), fix longstanding problems where JUnit Asserts were accidentally used, removed some bogus deps, fixed up the poms, etc.

Repository: curator
Updated Branches:
  refs/heads/CURATOR-105 a0fe6ae2f -> 07db9f6c1


Upgrade to latest versions of dependencies/plugins (include ZK 3.4.6), fix longstanding problems where JUnit Asserts were accidentally used, removed some bogus deps, fixed up the poms, etc.


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/426db3d3
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/426db3d3
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/426db3d3

Branch: refs/heads/CURATOR-105
Commit: 426db3d355ef69d89a8c2b3d9f918c9f4be5989c
Parents: bfdef2d
Author: randgalt <ra...@apache.org>
Authored: Sun Mar 30 12:54:08 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun Mar 30 12:54:08 2014 -0500

----------------------------------------------------------------------
 curator-client/pom.xml                          |   1 -
 .../curator/TestSessionFailRetryLoop.java       |   2 +-
 curator-examples/pom.xml                        |   6 -
 curator-framework/pom.xml                       |   1 -
 curator-recipes/pom.xml                         |   1 -
 .../framework/client/TestBackgroundStates.java  |   7 +-
 ...estResetConnectionWithBackgroundFailure.java |  14 +-
 .../locks/TestInterProcessSemaphoreCluster.java |   4 +-
 .../locks/TestLockCleanlinessWithFaults.java    |   4 +-
 .../framework/recipes/locks/TestReaper.java     |  11 +-
 .../TestPersistentEphemeralNodeListener.java    |   7 +-
 .../queue/TestBoundedDistributedQueue.java      |   6 +-
 .../recipes/queue/TestQueueSharder.java         |   6 +-
 curator-test/pom.xml                            |   3 -
 curator-x-discovery-server/pom.xml              |  24 --
 .../contexts/GenericDiscoveryContext.java       |  20 +-
 .../server/contexts/MapDiscoveryContext.java    |   4 +-
 .../server/jetty_jersey/TestMapsWithJersey.java |   2 +-
 .../TestObjectPayloadWithJersey.java            |  34 +--
 .../jetty_jersey/TestStringsWithJersey.java     |  18 +-
 .../jetty_resteasy/TestStringsWithRestEasy.java |   2 +-
 curator-x-discovery/pom.xml                     |   2 -
 .../apache/curator/x/discovery/TestUriSpec.java |   2 +-
 pom.xml                                         | 273 +++++++++++++++----
 24 files changed, 289 insertions(+), 165 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-client/pom.xml
----------------------------------------------------------------------
diff --git a/curator-client/pom.xml b/curator-client/pom.xml
index eabb135..5fd7d67 100644
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@ -27,7 +27,6 @@
         <version>2.4.2-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.curator</groupId>
     <artifactId>curator-client</artifactId>
     <version>2.4.2-SNAPSHOT</version>
     <packaging>bundle</packaging>

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-client/src/test/java/org/apache/curator/TestSessionFailRetryLoop.java
----------------------------------------------------------------------
diff --git a/curator-client/src/test/java/org/apache/curator/TestSessionFailRetryLoop.java b/curator-client/src/test/java/org/apache/curator/TestSessionFailRetryLoop.java
index e209e40..f3b2e4e 100644
--- a/curator-client/src/test/java/org/apache/curator/TestSessionFailRetryLoop.java
+++ b/curator-client/src/test/java/org/apache/curator/TestSessionFailRetryLoop.java
@@ -22,7 +22,7 @@ import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.KillSession;
 import org.apache.curator.test.Timing;
-import junit.framework.Assert;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.util.concurrent.Callable;
 import java.util.concurrent.atomic.AtomicBoolean;

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-examples/pom.xml
----------------------------------------------------------------------
diff --git a/curator-examples/pom.xml b/curator-examples/pom.xml
index e29d98a..9fb4bb3 100644
--- a/curator-examples/pom.xml
+++ b/curator-examples/pom.xml
@@ -48,11 +48,5 @@
             <groupId>org.apache.curator</groupId>
             <artifactId>curator-x-discovery</artifactId>
         </dependency>
-
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>1.2.16</version>
-        </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-framework/pom.xml
----------------------------------------------------------------------
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index 1bac9cd..162e557 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -27,7 +27,6 @@
         <version>2.4.2-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.curator</groupId>
     <artifactId>curator-framework</artifactId>
     <version>2.4.2-SNAPSHOT</version>
     <packaging>bundle</packaging>

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-recipes/pom.xml
----------------------------------------------------------------------
diff --git a/curator-recipes/pom.xml b/curator-recipes/pom.xml
index 3c290f2..5fe9a31 100644
--- a/curator-recipes/pom.xml
+++ b/curator-recipes/pom.xml
@@ -27,7 +27,6 @@
         <version>2.4.2-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.curator</groupId>
     <artifactId>curator-recipes</artifactId>
     <version>2.4.2-SNAPSHOT</version>
     <packaging>bundle</packaging>

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-recipes/src/test/java/org/apache/curator/framework/client/TestBackgroundStates.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/client/TestBackgroundStates.java b/curator-recipes/src/test/java/org/apache/curator/framework/client/TestBackgroundStates.java
index cb186fc..8cfa342 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/client/TestBackgroundStates.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/client/TestBackgroundStates.java
@@ -20,7 +20,6 @@
 package org.apache.curator.framework.client;
 
 import com.google.common.collect.Queues;
-import com.google.common.io.Closeables;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.recipes.BaseClassForTests;
@@ -30,7 +29,7 @@ import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;
-import org.apache.curator.utils.DebugUtils;
+import org.apache.curator.utils.CloseableUtils;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.util.concurrent.BlockingQueue;
@@ -90,7 +89,7 @@ public class TestBackgroundStates extends BaseClassForTests
         }
         finally
         {
-            Closeables.closeQuietly(client);
+            CloseableUtils.closeQuietly(client);
         }
     }
 
@@ -133,7 +132,7 @@ public class TestBackgroundStates extends BaseClassForTests
         }
         finally
         {
-            Closeables.closeQuietly(client);
+            CloseableUtils.closeQuietly(client);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-recipes/src/test/java/org/apache/curator/framework/client/TestResetConnectionWithBackgroundFailure.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/client/TestResetConnectionWithBackgroundFailure.java b/curator-recipes/src/test/java/org/apache/curator/framework/client/TestResetConnectionWithBackgroundFailure.java
index e634a6d..5b6a5fa 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/client/TestResetConnectionWithBackgroundFailure.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/client/TestResetConnectionWithBackgroundFailure.java
@@ -19,7 +19,6 @@
 
 package org.apache.curator.framework.client;
 
-import com.google.common.io.Closeables;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.recipes.BaseClassForTests;
@@ -31,15 +30,24 @@ import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;
+import org.apache.curator.utils.CloseableUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 public class TestResetConnectionWithBackgroundFailure extends BaseClassForTests
 {
     private final Logger log = LoggerFactory.getLogger(getClass());
 
+    @BeforeMethod
+    @Override
+    public void setup() throws Exception
+    {
+        super.setup();
+    }
+
     @Test
     public void testConnectionStateListener() throws Exception
     {
@@ -96,8 +104,8 @@ public class TestResetConnectionWithBackgroundFailure extends BaseClassForTests
         }
         finally
         {
-            Closeables.closeQuietly(selector);
-            Closeables.closeQuietly(client);
+            CloseableUtils.closeQuietly(selector);
+            CloseableUtils.closeQuietly(client);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphoreCluster.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphoreCluster.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphoreCluster.java
index b3f7a25..2aa8a72 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphoreCluster.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphoreCluster.java
@@ -19,7 +19,6 @@
 package org.apache.curator.framework.recipes.locks;
 
 import com.google.common.collect.Lists;
-import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.ensemble.EnsembleProvider;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
@@ -29,7 +28,8 @@ import org.apache.curator.retry.ExponentialBackoffRetry;
 import org.apache.curator.test.InstanceSpec;
 import org.apache.curator.test.TestingCluster;
 import org.apache.curator.test.Timing;
-import junit.framework.Assert;
+import org.apache.curator.utils.CloseableUtils;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.io.IOException;
 import java.util.Iterator;

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockCleanlinessWithFaults.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockCleanlinessWithFaults.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockCleanlinessWithFaults.java
index b1b9c78..9843848 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockCleanlinessWithFaults.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockCleanlinessWithFaults.java
@@ -18,13 +18,13 @@
  */
 package org.apache.curator.framework.recipes.locks;
 
-import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryNTimes;
-import junit.framework.Assert;
+import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.KeeperException;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.util.List;
 

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
index b11bc8b..0de78fc 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
@@ -18,8 +18,6 @@
  */
 package org.apache.curator.framework.recipes.locks;
 
-import org.apache.curator.utils.CloseableUtils;
-import junit.framework.Assert;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.recipes.BaseClassForTests;
@@ -28,8 +26,10 @@ import org.apache.curator.framework.recipes.leader.LeaderSelectorListener;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.Timing;
+import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.data.Stat;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.io.IOException;
 import java.util.Queue;
@@ -103,7 +103,6 @@ public class TestReaper extends BaseClassForTests
 
         Timing                  timing = new Timing();
         Reaper                  reaper = null;
-        Future<Void>            watcher = null;
         CuratorFramework        client = makeClient(timing, null);
         try
         {
@@ -176,10 +175,6 @@ public class TestReaper extends BaseClassForTests
         }
         finally
         {
-            if ( watcher != null )
-            {
-                watcher.cancel(true);
-            }
             CloseableUtils.closeQuietly(reaper);
             CloseableUtils.closeQuietly(client);
         }
@@ -423,7 +418,7 @@ public class TestReaper extends BaseClassForTests
             timing.sleepABit();
 
             Stat stat = client.checkExists().forPath("/a/b");
-            Assert.assertNull("Child qty: " + ((stat != null) ? stat.getNumChildren() : 0), stat);
+            Assert.assertNull(stat, "Child qty: " + ((stat != null) ? stat.getNumChildren() : 0));
         }
         finally
         {

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNodeListener.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNodeListener.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNodeListener.java
index b97ba41..82d5876 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNodeListener.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNodeListener.java
@@ -19,8 +19,6 @@
 
 package org.apache.curator.framework.recipes.nodes;
 
-import com.google.common.collect.Lists;
-import com.google.common.io.Closeables;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.recipes.BaseClassForTests;
@@ -29,10 +27,9 @@ import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;
+import org.apache.curator.utils.CloseableUtils;
 import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
 import org.testng.annotations.Test;
-import java.util.Collection;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicReference;
@@ -88,7 +85,7 @@ public class TestPersistentEphemeralNodeListener extends BaseClassForTests
         }
         finally
         {
-            Closeables.closeQuietly(client);
+            CloseableUtils.closeQuietly(client);
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestBoundedDistributedQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestBoundedDistributedQueue.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestBoundedDistributedQueue.java
index 6662b7d..1acb051 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestBoundedDistributedQueue.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestBoundedDistributedQueue.java
@@ -18,16 +18,16 @@
  */
 package org.apache.curator.framework.recipes.queue;
 
-import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.Timing;
-import junit.framework.Assert;
+import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.util.Arrays;
 import java.util.List;
@@ -180,7 +180,7 @@ public class TestBoundedDistributedQueue extends BaseClassForTests
 
             for ( int count : counts )
             {
-                Assert.assertTrue(counts.toString(), count <= (MAX_ITEMS * SLOP_FACTOR));
+                Assert.assertTrue(count <= (MAX_ITEMS * SLOP_FACTOR), counts.toString());
             }
         }
         finally

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
index 78c833e..b82ebbc 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
@@ -19,7 +19,7 @@
 package org.apache.curator.framework.recipes.queue;
 
 import com.google.common.collect.Sets;
-import org.apache.curator.utils.CloseableUtils;
+import org.apache.commons.math.stat.descriptive.SummaryStatistics;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.recipes.BaseClassForTests;
@@ -27,8 +27,8 @@ import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.Timing;
-import junit.framework.Assert;
-import org.apache.commons.math.stat.descriptive.SummaryStatistics;
+import org.apache.curator.utils.CloseableUtils;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-test/pom.xml
----------------------------------------------------------------------
diff --git a/curator-test/pom.xml b/curator-test/pom.xml
index a59f082..83d3329 100644
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@ -27,7 +27,6 @@
         <version>2.4.2-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.curator</groupId>
     <artifactId>curator-test</artifactId>
     <version>2.4.2-SNAPSHOT</version>
 
@@ -39,13 +38,11 @@
         <dependency>
             <groupId>org.javassist</groupId>
             <artifactId>javassist</artifactId>
-            <version>3.15.0-GA</version>
         </dependency>
 
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-math</artifactId>
-            <version>2.2</version>
         </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/pom.xml b/curator-x-discovery-server/pom.xml
index 6b95f99..6a3b96b 100644
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@ -27,7 +27,6 @@
         <version>2.4.2-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.curator</groupId>
     <artifactId>curator-x-discovery-server</artifactId>
     <version>2.4.2-SNAPSHOT</version>
     <packaging>bundle</packaging>
@@ -37,7 +36,6 @@
     <inceptionYear>2011</inceptionYear>
 
     <properties>
-        <jersey.version>1.11</jersey.version>
         <osgi.import.package>
             *
         </osgi.import.package>
@@ -55,14 +53,6 @@
         <dependency>
             <groupId>javax.ws.rs</groupId>
             <artifactId>jsr311-api</artifactId>
-            <version>1.1.1</version>
-        </dependency>
-
-        <dependency>
-            <!-- only for TypeLiteral - in the future will be replaced by Guava 13 -->
-            <groupId>com.google.inject</groupId>
-            <artifactId>guice</artifactId>
-            <version>3.0</version>
         </dependency>
 
         <dependency>
@@ -74,56 +64,43 @@
         <dependency>
             <groupId>com.sun.jersey</groupId>
             <artifactId>jersey-server</artifactId>
-            <version>${jersey.version}</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>com.sun.jersey</groupId>
             <artifactId>jersey-servlet</artifactId>
-            <version>${jersey.version}</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>com.sun.jersey</groupId>
             <artifactId>jersey-client</artifactId>
-            <version>${jersey.version}</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>com.sun.jersey</groupId>
             <artifactId>jersey-core</artifactId>
-            <version>${jersey.version}</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>org.mortbay.jetty</groupId>
             <artifactId>jetty</artifactId>
-            <version>6.1.22</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>net.sf.scannotation</groupId>
             <artifactId>scannotation</artifactId>
-            <version>1.0.2</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
             <groupId>org.jboss.resteasy</groupId>
             <artifactId>resteasy-jaxrs</artifactId>
-            <version>2.3.0.GA</version>
             <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.scannotation</groupId>
-                    <artifactId>scannotation</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
     </dependencies>
 
@@ -132,7 +109,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
-                <version>2.13</version>
                 <configuration>
                     <parallel>none</parallel>
                 </configuration>

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/GenericDiscoveryContext.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/GenericDiscoveryContext.java b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/GenericDiscoveryContext.java
index 57ff81a..4929ccc 100644
--- a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/GenericDiscoveryContext.java
+++ b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/GenericDiscoveryContext.java
@@ -18,17 +18,15 @@
  */
 package org.apache.curator.x.discovery.server.contexts;
 
-import javax.ws.rs.ext.ContextResolver;
-import javax.ws.rs.ext.Provider;
-
-import com.google.inject.TypeLiteral;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.node.ObjectNode;
-
+import com.google.common.reflect.TypeToken;
 import org.apache.curator.x.discovery.ProviderStrategy;
 import org.apache.curator.x.discovery.ServiceDiscovery;
 import org.apache.curator.x.discovery.server.rest.DiscoveryContext;
+import org.codehaus.jackson.JsonNode;
+import org.codehaus.jackson.map.ObjectMapper;
+import org.codehaus.jackson.node.ObjectNode;
+import javax.ws.rs.ext.ContextResolver;
+import javax.ws.rs.ext.Provider;
 
 /**
  * For convenience, a version of {@link DiscoveryContext} that uses any generic type as the payload
@@ -39,14 +37,14 @@ public class GenericDiscoveryContext<T> implements DiscoveryContext<T>, ContextR
     private final ServiceDiscovery<T> serviceDiscovery;
     private final ProviderStrategy<T> providerStrategy;
     private final int instanceRefreshMs;
-    private final TypeLiteral<T> payloadType;   // in the future - replace TypeLiteral with corresponding api from Guava 13
+    private final TypeToken<T> payloadType;
 
     public GenericDiscoveryContext(ServiceDiscovery<T> serviceDiscovery, ProviderStrategy<T> providerStrategy, int instanceRefreshMs, Class<T> payloadType)
     {
-        this(serviceDiscovery, providerStrategy, instanceRefreshMs, TypeLiteral.get(payloadType));
+        this(serviceDiscovery, providerStrategy, instanceRefreshMs, TypeToken.of(payloadType));
     }
 
-    public GenericDiscoveryContext(ServiceDiscovery<T> serviceDiscovery, ProviderStrategy<T> providerStrategy, int instanceRefreshMs, TypeLiteral<T> payloadType)
+    public GenericDiscoveryContext(ServiceDiscovery<T> serviceDiscovery, ProviderStrategy<T> providerStrategy, int instanceRefreshMs, TypeToken<T> payloadType)
     {
         this.serviceDiscovery = serviceDiscovery;
         this.providerStrategy = providerStrategy;

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/MapDiscoveryContext.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/MapDiscoveryContext.java b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/MapDiscoveryContext.java
index 3db03fa..864a874 100644
--- a/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/MapDiscoveryContext.java
+++ b/curator-x-discovery-server/src/main/java/org/apache/curator/x/discovery/server/contexts/MapDiscoveryContext.java
@@ -18,7 +18,7 @@
  */
 package org.apache.curator.x.discovery.server.contexts;
 
-import com.google.inject.TypeLiteral;
+import com.google.common.reflect.TypeToken;
 import org.apache.curator.x.discovery.ProviderStrategy;
 import org.apache.curator.x.discovery.ServiceDiscovery;
 import org.apache.curator.x.discovery.server.rest.DiscoveryContext;
@@ -35,6 +35,6 @@ public class MapDiscoveryContext extends GenericDiscoveryContext<Map<String, Str
 {
     public MapDiscoveryContext(ServiceDiscovery<Map<String, String>> serviceDiscovery, ProviderStrategy<Map<String, String>> providerStrategy, int instanceRefreshMs)
     {
-    	super(serviceDiscovery, providerStrategy, instanceRefreshMs, new TypeLiteral<Map<String, String>>(){});
+    	super(serviceDiscovery, providerStrategy, instanceRefreshMs, new TypeToken<Map<String, String>>(){});
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestMapsWithJersey.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestMapsWithJersey.java b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestMapsWithJersey.java
index 1693b86..5dc16c8 100644
--- a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestMapsWithJersey.java
+++ b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestMapsWithJersey.java
@@ -28,7 +28,6 @@ import com.sun.jersey.api.client.config.ClientConfig;
 import com.sun.jersey.api.client.config.DefaultClientConfig;
 import com.sun.jersey.api.core.DefaultResourceConfig;
 import com.sun.jersey.spi.container.servlet.ServletContainer;
-import junit.framework.Assert;
 import org.apache.curator.test.InstanceSpec;
 import org.apache.curator.x.discovery.ServiceInstance;
 import org.apache.curator.x.discovery.ServiceType;
@@ -43,6 +42,7 @@ import org.apache.curator.x.discovery.strategies.RandomStrategy;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.servlet.Context;
 import org.mortbay.jetty.servlet.ServletHolder;
+import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestObjectPayloadWithJersey.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestObjectPayloadWithJersey.java b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestObjectPayloadWithJersey.java
index f6dc27f..80f2e4a 100644
--- a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestObjectPayloadWithJersey.java
+++ b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestObjectPayloadWithJersey.java
@@ -18,20 +18,16 @@
  */
 package org.apache.curator.x.discovery.server.jetty_jersey;
 
-import java.util.Set;
-
-import javax.ws.rs.core.Application;
-import javax.ws.rs.core.MediaType;
-
-import junit.framework.Assert;
-
-import org.apache.curator.test.InstanceSpec;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.ServletHolder;
-
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.GenericType;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.core.DefaultResourceConfig;
+import com.sun.jersey.spi.container.servlet.ServletContainer;
+import org.apache.curator.test.InstanceSpec;
 import org.apache.curator.x.discovery.ServiceInstance;
 import org.apache.curator.x.discovery.ServiceType;
 import org.apache.curator.x.discovery.server.entity.JsonServiceInstanceMarshaller;
@@ -41,16 +37,16 @@ import org.apache.curator.x.discovery.server.entity.ServiceInstances;
 import org.apache.curator.x.discovery.server.entity.ServiceNames;
 import org.apache.curator.x.discovery.server.mocks.MockServiceDiscovery;
 import org.apache.curator.x.discovery.strategies.RandomStrategy;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.GenericType;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.core.DefaultResourceConfig;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.servlet.Context;
+import org.mortbay.jetty.servlet.ServletHolder;
+import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
+import javax.ws.rs.core.Application;
+import javax.ws.rs.core.MediaType;
+import java.util.Set;
 
 public class TestObjectPayloadWithJersey
 {

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestStringsWithJersey.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestStringsWithJersey.java b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestStringsWithJersey.java
index 012ac19..8cf43cc 100644
--- a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestStringsWithJersey.java
+++ b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_jersey/TestStringsWithJersey.java
@@ -20,28 +20,28 @@ package org.apache.curator.x.discovery.server.jetty_jersey;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
+import com.sun.jersey.api.client.Client;
+import com.sun.jersey.api.client.GenericType;
+import com.sun.jersey.api.client.WebResource;
+import com.sun.jersey.api.client.config.ClientConfig;
+import com.sun.jersey.api.client.config.DefaultClientConfig;
+import com.sun.jersey.api.core.DefaultResourceConfig;
+import com.sun.jersey.spi.container.servlet.ServletContainer;
 import org.apache.curator.test.InstanceSpec;
 import org.apache.curator.x.discovery.ServiceInstance;
 import org.apache.curator.x.discovery.ServiceType;
+import org.apache.curator.x.discovery.server.contexts.StringDiscoveryContext;
 import org.apache.curator.x.discovery.server.entity.JsonServiceInstanceMarshaller;
 import org.apache.curator.x.discovery.server.entity.JsonServiceInstancesMarshaller;
 import org.apache.curator.x.discovery.server.entity.JsonServiceNamesMarshaller;
 import org.apache.curator.x.discovery.server.entity.ServiceInstances;
 import org.apache.curator.x.discovery.server.entity.ServiceNames;
 import org.apache.curator.x.discovery.server.mocks.MockServiceDiscovery;
-import org.apache.curator.x.discovery.server.contexts.StringDiscoveryContext;
 import org.apache.curator.x.discovery.strategies.RandomStrategy;
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.GenericType;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.core.DefaultResourceConfig;
-import com.sun.jersey.spi.container.servlet.ServletContainer;
-import junit.framework.Assert;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.servlet.Context;
 import org.mortbay.jetty.servlet.ServletHolder;
+import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_resteasy/TestStringsWithRestEasy.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_resteasy/TestStringsWithRestEasy.java b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_resteasy/TestStringsWithRestEasy.java
index 4ab447f..cc9592c 100644
--- a/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_resteasy/TestStringsWithRestEasy.java
+++ b/curator-x-discovery-server/src/test/java/org/apache/curator/x/discovery/server/jetty_resteasy/TestStringsWithRestEasy.java
@@ -26,13 +26,13 @@ import org.apache.curator.x.discovery.ServiceInstance;
 import org.apache.curator.x.discovery.ServiceType;
 import org.apache.curator.x.discovery.server.entity.ServiceInstances;
 import org.apache.curator.x.discovery.server.entity.ServiceNames;
-import junit.framework.Assert;
 import org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher;
 import org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap;
 import org.jboss.resteasy.spi.ResteasyProviderFactory;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.servlet.Context;
 import org.mortbay.jetty.servlet.ServletHolder;
+import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --git a/curator-x-discovery/pom.xml b/curator-x-discovery/pom.xml
index 36eaf60..fc54b49 100644
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@ -27,7 +27,6 @@
         <version>2.4.2-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.curator</groupId>
     <artifactId>curator-x-discovery</artifactId>
     <version>2.4.2-SNAPSHOT</version>
     <packaging>bundle</packaging>
@@ -54,7 +53,6 @@
         <dependency>
             <groupId>org.codehaus.jackson</groupId>
             <artifactId>jackson-mapper-asl</artifactId>
-            <version>1.9.2</version>
         </dependency>
 
         <dependency>

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestUriSpec.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestUriSpec.java b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestUriSpec.java
index 52cbea8..974e81c 100644
--- a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestUriSpec.java
+++ b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestUriSpec.java
@@ -19,7 +19,7 @@
 package org.apache.curator.x.discovery;
 
 import com.google.common.collect.Maps;
-import junit.framework.Assert;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.util.Iterator;
 import java.util.Map;

http://git-wip-us.apache.org/repos/asf/curator/blob/426db3d3/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 18e5907..0991e04 100644
--- a/pom.xml
+++ b/pom.xml
@@ -56,6 +56,35 @@
         <project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 
+        <jdk-version>1.6</jdk-version>
+
+        <!-- versions -->
+        <maven-project-info-reports-plugin-version>2.7</maven-project-info-reports-plugin-version>
+        <maven-javadoc-plugin-version>2.9.1</maven-javadoc-plugin-version>
+        <maven-dependency-plugin-version>2.8</maven-dependency-plugin-version>
+        <maven-install-plugin-version>2.5.1</maven-install-plugin-version>
+        <maven-compiler-plugin-version>3.1</maven-compiler-plugin-version>
+        <maven-bundle-plugin-version>2.3.7</maven-bundle-plugin-version>
+        <maven-surefire-plugin-version>2.17</maven-surefire-plugin-version>
+        <maven-javadoc-plugin-version>2.9.1</maven-javadoc-plugin-version>
+        <maven-site-plugin-version>3.3</maven-site-plugin-version>
+        <doxia-module-confluence-version>1.5</doxia-module-confluence-version>
+        <maven-scm-publish-plugin-version>1.0</maven-scm-publish-plugin-version>
+        <maven-license-plugin-version>1.9.0</maven-license-plugin-version>
+        <maven-release-plugin-version>2.5</maven-release-plugin-version>
+        <apache-rat-plugin-version>0.10</apache-rat-plugin-version>
+        <javassist-version>3.18.1-GA</javassist-version>
+        <commons-math-version>2.2</commons-math-version>
+        <jackson-mapper-asl-version>1.9.13</jackson-mapper-asl-version>
+        <jersey-version>1.18.1</jersey-version>
+        <jsr311-api-version>1.1.1</jsr311-api-version>
+        <jetty-version>6.1.26</jetty-version>
+        <scannotation-version>1.0.2</scannotation-version>
+        <resteasy-jaxrs-version>2.3.0.GA</resteasy-jaxrs-version>
+        <zookeeper-version>3.4.6</zookeeper-version>
+        <guava-version>16.0.1</guava-version>
+        <testng-version>6.8.8</testng-version>
+
         <!-- OSGi Properties -->
         <osgi.export.package />
         <osgi.import.package />
@@ -231,49 +260,157 @@
             <dependency>
                 <groupId>org.slf4j</groupId>
                 <artifactId>slf4j-api</artifactId>
-                <version>1.6.4</version>
+                <version>1.7.6</version>
             </dependency>
 
             <dependency>
                 <groupId>org.mockito</groupId>
                 <artifactId>mockito-core</artifactId>
-                <version>1.8.5</version>
+                <version>1.9.5</version>
             </dependency>
 
             <dependency>
                 <groupId>org.apache.curator</groupId>
                 <artifactId>curator-client</artifactId>
-                <version>2.4.2-SNAPSHOT</version>
+                <version>${project.version}</version>
             </dependency>
 
             <dependency>
                 <groupId>org.apache.curator</groupId>
                 <artifactId>curator-framework</artifactId>
-                <version>2.4.2-SNAPSHOT</version>
+                <version>${project.version}</version>
             </dependency>
 
             <dependency>
                 <groupId>org.apache.curator</groupId>
                 <artifactId>curator-recipes</artifactId>
-                <version>2.4.2-SNAPSHOT</version>
+                <version>${project.version}</version>
             </dependency>
 
             <dependency>
                 <groupId>org.apache.curator</groupId>
                 <artifactId>curator-test</artifactId>
-                <version>2.4.2-SNAPSHOT</version>
+                <version>${project.version}</version>
             </dependency>
 
             <dependency>
                 <groupId>org.apache.curator</groupId>
                 <artifactId>curator-x-discovery</artifactId>
-                <version>2.4.2-SNAPSHOT</version>
+                <version>${project.version}</version>
             </dependency>
 
             <dependency>
                 <groupId>org.apache.curator</groupId>
                 <artifactId>curator-x-discovery-server</artifactId>
-                <version>2.4.2-SNAPSHOT</version>
+                <version>${project.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.javassist</groupId>
+                <artifactId>javassist</artifactId>
+                <version>${javassist-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.commons</groupId>
+                <artifactId>commons-math</artifactId>
+                <version>${commons-math-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.codehaus.jackson</groupId>
+                <artifactId>jackson-mapper-asl</artifactId>
+                <version>${jackson-mapper-asl-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.sun.jersey</groupId>
+                <artifactId>jersey-server</artifactId>
+                <version>${jersey-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.sun.jersey</groupId>
+                <artifactId>jersey-servlet</artifactId>
+                <version>${jersey-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.sun.jersey</groupId>
+                <artifactId>jersey-client</artifactId>
+                <version>${jersey-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.sun.jersey</groupId>
+                <artifactId>jersey-core</artifactId>
+                <version>${jersey-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>javax.ws.rs</groupId>
+                <artifactId>jsr311-api</artifactId>
+                <version>${jsr311-api-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.mortbay.jetty</groupId>
+                <artifactId>jetty</artifactId>
+                <version>${jetty-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>net.sf.scannotation</groupId>
+                <artifactId>scannotation</artifactId>
+                <version>${scannotation-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.jboss.resteasy</groupId>
+                <artifactId>resteasy-jaxrs</artifactId>
+                <version>${resteasy-jaxrs-version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>org.scannotation</groupId>
+                        <artifactId>scannotation</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+
+            <dependency>
+                <groupId>org.apache.zookeeper</groupId>
+                <artifactId>zookeeper</artifactId>
+                <version>${zookeeper-version}</version>
+                <exclusions>
+                    <exclusion>
+                        <groupId>com.sun.jmx</groupId>
+                        <artifactId>jmxri</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>com.sun.jdmk</groupId>
+                        <artifactId>jmxtools</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>javax.jms</groupId>
+                        <artifactId>jms</artifactId>
+                    </exclusion>
+                    <exclusion>
+                        <groupId>junit</groupId>
+                        <artifactId>junit</artifactId>
+                    </exclusion>
+                </exclusions>
+            </dependency>
+
+            <dependency>
+                <groupId>com.google.guava</groupId>
+                <artifactId>guava</artifactId>
+                <version>${guava-version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>org.testng</groupId>
+                <artifactId>testng</artifactId>
+                <version>${testng-version}</version>
             </dependency>
         </dependencies>
     </dependencyManagement>
@@ -282,44 +419,16 @@
         <dependency>
             <groupId>org.apache.zookeeper</groupId>
             <artifactId>zookeeper</artifactId>
-            <version>3.4.5</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.sun.jmx</groupId>
-                    <artifactId>jmxri</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>com.sun.jdmk</groupId>
-                    <artifactId>jmxtools</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>javax.jms</groupId>
-                    <artifactId>jms</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>junit</groupId>
-                    <artifactId>junit</artifactId>
-                </exclusion>
-            </exclusions>
         </dependency>
 
         <dependency>
             <groupId>com.google.guava</groupId>
             <artifactId>guava</artifactId>
-            <version>14.0.1</version>
         </dependency>
 
         <dependency>
             <groupId>org.testng</groupId>
             <artifactId>testng</artifactId>
-            <version>6.1.1</version>
-            <scope>test</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>1.2.16</version>
             <scope>test</scope>
         </dependency>
     </dependencies>
@@ -329,13 +438,13 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-project-info-reports-plugin</artifactId>
-                <version>2.7</version>
+                <version>${maven-project-info-reports-plugin-version}</version>
             </plugin>
 
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-javadoc-plugin</artifactId>
-                <version>2.9.1</version>
+                <version>${maven-javadoc-plugin-version}</version>
                 <configuration>
                     <aggregate>true</aggregate>
                 </configuration>
@@ -344,6 +453,76 @@
     </reporting>
 
     <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-dependency-plugin</artifactId>
+                    <version>${maven-dependency-plugin-version}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-install-plugin</artifactId>
+                    <version>${maven-install-plugin-version}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>${maven-compiler-plugin-version}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.felix</groupId>
+                    <artifactId>maven-bundle-plugin</artifactId>
+                    <version>${maven-bundle-plugin-version}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>${maven-surefire-plugin-version}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-javadoc-plugin</artifactId>
+                    <version>${maven-javadoc-plugin-version}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-site-plugin</artifactId>
+                    <version>${maven-site-plugin-version}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-scm-publish-plugin</artifactId>
+                    <version>${maven-scm-publish-plugin-version}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>com.mycila.maven-license-plugin</groupId>
+                    <artifactId>maven-license-plugin</artifactId>
+                    <version>${maven-license-plugin-version}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-release-plugin</artifactId>
+                    <version>${maven-release-plugin-version}</version>
+                </plugin>
+
+                <plugin>
+                    <groupId>org.apache.rat</groupId>
+                    <artifactId>apache-rat-plugin</artifactId>
+                    <version>${apache-rat-plugin-version}</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+
         <resources>
             <resource>
                 <directory>${basedir}</directory>
@@ -360,13 +539,11 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-dependency-plugin</artifactId>
-                <version>2.8</version>
             </plugin>
 
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-install-plugin</artifactId>
-                <version>2.3.1</version>
                 <configuration>
                     <createChecksum>true</createChecksum>
                 </configuration>
@@ -375,16 +552,15 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-compiler-plugin</artifactId>
-                <version>3.0</version>
                 <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
+                    <source>${jdk-version}</source>
+                    <target>${jdk-version}</target>
                 </configuration>
             </plugin>
+
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
-                <version>2.3.7</version>
                 <extensions>true</extensions>
                 <inherited>true</inherited>
                 <configuration>
@@ -420,7 +596,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
-                <version>2.16</version>
                 <configuration>
                     <forkCount>1</forkCount>
                     <reuseForks>false</reuseForks>
@@ -431,7 +606,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-javadoc-plugin</artifactId>
-                <version>2.9</version>
                 <configuration>
                     <aggregate>true</aggregate>
                 </configuration>
@@ -440,7 +614,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-site-plugin</artifactId>
-                <version>3.3</version>
                 <configuration>
                     <locales>en</locales>
                     <skipDeploy>true</skipDeploy>
@@ -449,7 +622,7 @@
                     <dependency>
                         <groupId>org.apache.maven.doxia</groupId>
                         <artifactId>doxia-module-confluence</artifactId>
-                        <version>1.3</version>
+                        <version>${doxia-module-confluence-version}</version>
                     </dependency>
                 </dependencies>
                 <executions>
@@ -465,7 +638,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-scm-publish-plugin</artifactId>
-                <version>1.0-beta-2</version>
                 <inherited>false</inherited>
                 <configuration>
                     <checkinComment>Curator website deployment</checkinComment>
@@ -486,7 +658,6 @@
             <plugin>
                 <groupId>com.mycila.maven-license-plugin</groupId>
                 <artifactId>maven-license-plugin</artifactId>
-                <version>1.9.0</version>
                 <configuration>
                     <header>src/etc/header.txt</header>
                     <excludes>
@@ -518,7 +689,6 @@
             <plugin>
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-release-plugin</artifactId>
-                <version>2.4.1</version>
                 <configuration>
                     <arguments>-Dmaven.test.skip=true</arguments>
                     <mavenExecutorId>forked-path</mavenExecutorId>
@@ -528,7 +698,6 @@
             <plugin>
                 <groupId>org.apache.rat</groupId>
                 <artifactId>apache-rat-plugin</artifactId>
-                <version>0.8</version>
                 <configuration>
                     <numUnapprovedLicenses>0</numUnapprovedLicenses>
                     <excludeSubProjects>false</excludeSubProjects>


[06/29] git commit: Making Connection erros less verbose. Only first error is logged with error level; subsequent errors are logged as debug

Posted by ra...@apache.org.
Making Connection erros less verbose. Only first error is logged with
error level; subsequent errors are logged as debug

Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/ab3ff72d
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/ab3ff72d
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/ab3ff72d

Branch: refs/heads/CURATOR-105
Commit: ab3ff72d309378f3c6e166e47e75b7ba49835f20
Parents: 0f7acf7
Author: eceejcr <ev...@yahoo.es>
Authored: Fri May 2 23:53:40 2014 +0200
Committer: eceejcr <ev...@yahoo.es>
Committed: Fri May 2 23:53:40 2014 +0200

----------------------------------------------------------------------
 .../framework/imps/CuratorFrameworkImpl.java    | 29 +++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/ab3ff72d/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index 7854308..d6a5973 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -51,6 +51,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
 
 public class CuratorFrameworkImpl implements CuratorFramework
@@ -72,6 +73,7 @@ public class CuratorFrameworkImpl implements CuratorFramework
     private final NamespaceWatcherMap                                   namespaceWatcherMap = new NamespaceWatcherMap(this);
 
     private volatile ExecutorService                                    executorService;
+    private AtomicBoolean                                               logAsErrorConnectionErrors = new AtomicBoolean(false);
 
     interface DebugBackgroundListener
     {
@@ -231,7 +233,19 @@ public class CuratorFrameworkImpl implements CuratorFramework
         try
         {
             connectionStateManager.start(); // ordering dependency - must be called before client.start()
+            ConnectionStateListener listener = new ConnectionStateListener() {
+				@Override
+				public void stateChanged(CuratorFramework client, ConnectionState newState) {
+					if ( ConnectionState.CONNECTED == newState || ConnectionState.RECONNECTED == newState )
+					{
+						logAsErrorConnectionErrors.set(true);
+					}
+				}
+			};
+			this.getConnectionStateListenable().addListener(listener);
+
             client.start();
+
             executorService = Executors.newFixedThreadPool(2, threadFactory);  // 1 for listeners, 1 for background ops
 
             executorService.submit
@@ -509,7 +523,20 @@ public class CuratorFrameworkImpl implements CuratorFramework
 
         if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) || !(e instanceof KeeperException) )
         {
-            log.error(reason, e);
+            if ( e instanceof KeeperException.ConnectionLossException || e instanceof CuratorConnectionLossException ) {
+                if ( logAsErrorConnectionErrors.compareAndSet(true, false) )
+                {
+                    log.error(reason, e);
+                }
+                else
+                {
+                    log.debug(reason, e);
+                }
+            }
+            else
+            {
+                log.error(reason, e);
+            }
         }
 
         final String        localReason = reason;


[23/29] git commit: updated comments

Posted by ra...@apache.org.
updated comments


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/4e548a29
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4e548a29
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4e548a29

Branch: refs/heads/CURATOR-105
Commit: 4e548a29e60c3de1809db4eedf320e38f925671e
Parents: c6700f0
Author: randgalt <ra...@apache.org>
Authored: Fri May 23 07:25:00 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Fri May 23 07:25:00 2014 -0500

----------------------------------------------------------------------
 .../curator/framework/recipes/locks/LockInternals.java      | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/4e548a29/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
index 0f7460f..812cfd8 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
@@ -296,6 +296,7 @@ public class LockInternals
                     {
                         try 
                         {
+                            // use getData instead of exists to avoid leaving unneeded watchers which is a type of resource leak
                             client.getData().usingWatcher(watcher).forPath(previousSequencePath);
                             if ( millisToWait != null )
                             {
@@ -316,16 +317,10 @@ public class LockInternals
                         }
                         catch ( KeeperException.NoNodeException e ) 
                         {
-                            // ignore - clearly already deleted
-                        }
-                        catch ( Exception e) 
-                        {
-                            // bubble it up
-                            throw e;
+                            // it has been deleted (i.e. lock released). Try to acquire again
                         }
                     }
                 }
-                // else it may have been deleted (i.e. lock released). Try to acquire again
             }
         }
         catch ( Exception e )


[04/29] git commit: Removed junit dep

Posted by ra...@apache.org.
Removed junit dep


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/43cfb8f3
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/43cfb8f3
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/43cfb8f3

Branch: refs/heads/CURATOR-105
Commit: 43cfb8f3f8b1d271538ac0989d689eba78cdecb7
Parents: c6d5f21
Author: randgalt <ra...@apache.org>
Authored: Wed Apr 2 21:24:06 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Wed Apr 2 21:24:06 2014 -0500

----------------------------------------------------------------------
 .../org/apache/curator/framework/recipes/locks/TestReaper.java   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/43cfb8f3/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
index 39c4817..48868d5 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
@@ -19,7 +19,6 @@
 
 package org.apache.curator.framework.recipes.locks;
 
-import junit.framework.Assert;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.recipes.BaseClassForTests;
@@ -31,6 +30,7 @@ import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.data.Stat;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.io.IOException;
 import java.util.Queue;
@@ -476,7 +476,7 @@ public class TestReaper extends BaseClassForTests
             timing.sleepABit();
 
             Stat stat = client.checkExists().forPath("/a/b");
-            Assert.assertNull("Child qty: " + ((stat != null) ? stat.getNumChildren() : 0), stat);
+            Assert.assertNull(stat, "Child qty: " + ((stat != null) ? stat.getNumChildren() : 0));
         }
         finally
         {


[07/29] git commit: Added System property to choose if connection issues are always logged as error level or only first issue is logged as error level, and subsequent issues are logged as debug. By default only first issue is logged as error

Posted by ra...@apache.org.
Added System property to choose if connection issues are always logged
as error level or only first issue is logged as error level, and
subsequent issues are logged as debug. By default only first issue is
logged as error

Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/048688a3
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/048688a3
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/048688a3

Branch: refs/heads/CURATOR-105
Commit: 048688a36856d1ef7e080410b8818952210fb1e8
Parents: ab3ff72
Author: eceejcr <ec...@E7B499BAE9DDE0.ericsson.se>
Authored: Sun May 11 01:05:03 2014 +0200
Committer: eceejcr <ec...@E7B499BAE9DDE0.ericsson.se>
Committed: Sun May 11 01:05:03 2014 +0200

----------------------------------------------------------------------
 .../org/apache/curator/utils/DebugUtils.java    |  1 +
 .../framework/imps/CuratorFrameworkImpl.java    | 33 ++++++++++++--------
 2 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/048688a3/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java b/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
index 64c2d6e..0ce2729 100644
--- a/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
+++ b/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
@@ -22,6 +22,7 @@ public class DebugUtils
 {
     public static final String          PROPERTY_LOG_EVENTS = "curator-log-events";
     public static final String          PROPERTY_DONT_LOG_CONNECTION_ISSUES = "curator-dont-log-connection-problems";
+    public static final String          PROPERTY_LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL = "curator-log-all-connection-issues-as-error-level";
 
     private DebugUtils()
     {

http://git-wip-us.apache.org/repos/asf/curator/blob/048688a3/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index d6a5973..3a78967 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -56,7 +56,8 @@ import java.util.concurrent.atomic.AtomicReference;
 
 public class CuratorFrameworkImpl implements CuratorFramework
 {
-    private final Logger                                                log = LoggerFactory.getLogger(getClass());
+
+	private final Logger                                                log = LoggerFactory.getLogger(getClass());
     private final CuratorZookeeperClient                                client;
     private final ListenerContainer<CuratorListener>                    listeners;
     private final ListenerContainer<UnhandledErrorListener>             unhandledErrorListeners;
@@ -73,7 +74,9 @@ public class CuratorFrameworkImpl implements CuratorFramework
     private final NamespaceWatcherMap                                   namespaceWatcherMap = new NamespaceWatcherMap(this);
 
     private volatile ExecutorService                                    executorService;
-    private AtomicBoolean                                               logAsErrorConnectionErrors = new AtomicBoolean(false);
+    private final AtomicBoolean                                         logAsErrorConnectionErrors = new AtomicBoolean(false);
+
+    private static final boolean                                        LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL = Boolean.getBoolean(DebugUtils.PROPERTY_LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL);
 
     interface DebugBackgroundListener
     {
@@ -233,16 +236,20 @@ public class CuratorFrameworkImpl implements CuratorFramework
         try
         {
             connectionStateManager.start(); // ordering dependency - must be called before client.start()
-            ConnectionStateListener listener = new ConnectionStateListener() {
-				@Override
-				public void stateChanged(CuratorFramework client, ConnectionState newState) {
-					if ( ConnectionState.CONNECTED == newState || ConnectionState.RECONNECTED == newState )
-					{
-						logAsErrorConnectionErrors.set(true);
-					}
-				}
-			};
-			this.getConnectionStateListenable().addListener(listener);
+            
+            final ConnectionStateListener listener = new ConnectionStateListener()
+            {
+                @Override
+                public void stateChanged(CuratorFramework client, ConnectionState newState)
+                {
+                    if ( ConnectionState.CONNECTED == newState || ConnectionState.RECONNECTED == newState )
+                    {
+                        logAsErrorConnectionErrors.set(true);
+                    }
+                }
+            };
+            
+            this.getConnectionStateListenable().addListener(listener);
 
             client.start();
 
@@ -524,7 +531,7 @@ public class CuratorFrameworkImpl implements CuratorFramework
         if ( !Boolean.getBoolean(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES) || !(e instanceof KeeperException) )
         {
             if ( e instanceof KeeperException.ConnectionLossException || e instanceof CuratorConnectionLossException ) {
-                if ( logAsErrorConnectionErrors.compareAndSet(true, false) )
+                if ( LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL || logAsErrorConnectionErrors.compareAndSet(true, false) )
                 {
                     log.error(reason, e);
                 }


[03/29] git commit: Merge branch 'master' into CURATOR-96

Posted by ra...@apache.org.
Merge branch 'master' into CURATOR-96

Conflicts:
	curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c6d5f21b
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c6d5f21b
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c6d5f21b

Branch: refs/heads/CURATOR-105
Commit: c6d5f21b012e6c8407dfa5d5871c03eb1eae014b
Parents: 568c699 2ef7181
Author: randgalt <ra...@apache.org>
Authored: Wed Apr 2 21:22:35 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Wed Apr 2 21:22:35 2014 -0500

----------------------------------------------------------------------
 .../framework/recipes/locks/ChildReaper.java    |  19 +-
 .../curator/framework/recipes/locks/Reaper.java |  96 +++++++--
 .../framework/recipes/locks/TestReaper.java     | 200 ++++++++++++-------
 3 files changed, 228 insertions(+), 87 deletions(-)
----------------------------------------------------------------------



[08/29] git commit: Replace TAB by spaces

Posted by ra...@apache.org.
Replace TAB by spaces

Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/abe07d4b
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/abe07d4b
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/abe07d4b

Branch: refs/heads/CURATOR-105
Commit: abe07d4b1190f70ac3f171fd897400c77d0d0de5
Parents: 048688a
Author: eceejcr <ec...@E7B499BAE9DDE0.ericsson.se>
Authored: Sun May 11 01:08:38 2014 +0200
Committer: eceejcr <ec...@E7B499BAE9DDE0.ericsson.se>
Committed: Sun May 11 01:08:38 2014 +0200

----------------------------------------------------------------------
 .../org/apache/curator/framework/imps/CuratorFrameworkImpl.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/abe07d4b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index 3a78967..99c8245 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -57,7 +57,7 @@ import java.util.concurrent.atomic.AtomicReference;
 public class CuratorFrameworkImpl implements CuratorFramework
 {
 
-	private final Logger                                                log = LoggerFactory.getLogger(getClass());
+    private final Logger                                                log = LoggerFactory.getLogger(getClass());
     private final CuratorZookeeperClient                                client;
     private final ListenerContainer<CuratorListener>                    listeners;
     private final ListenerContainer<UnhandledErrorListener>             unhandledErrorListeners;


[19/29] git commit: Lock is leaving dangling watchers for nodes that don't exist.

Posted by ra...@apache.org.
Lock is leaving dangling watchers for nodes that don't exist.


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/8a94985c
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/8a94985c
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/8a94985c

Branch: refs/heads/CURATOR-105
Commit: 8a94985c07b3e6f74ac1a2935af008cbdb649410
Parents: 351c67c
Author: Dominic Wong <do...@hailocab.com>
Authored: Wed May 21 13:20:55 2014 +0100
Committer: Dominic Wong <do...@hailocab.com>
Committed: Wed May 21 13:20:55 2014 +0100

----------------------------------------------------------------------
 .../apache/curator/framework/recipes/locks/LockInternals.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/8a94985c/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
index 06a1f6b..4b0d085 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
@@ -295,8 +295,8 @@ public class LockInternals
 
                     synchronized(this)
                     {
-                        Stat stat = client.checkExists().usingWatcher(watcher).forPath(previousSequencePath);
-                        if ( stat != null )
+                        byte[] data = client.getData().usingWatcher(watcher).forPath(previousSequencePath);
+                        if ( data != null )
                         {
                             if ( millisToWait != null )
                             {


[10/29] git commit: Merge branch 'CURATOR-96'

Posted by ra...@apache.org.
Merge branch 'CURATOR-96'


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/6784f807
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/6784f807
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/6784f807

Branch: refs/heads/CURATOR-105
Commit: 6784f80749d0995ec10875fd4973a52d8b962520
Parents: 3c468b2 449eeff
Author: randgalt <ra...@apache.org>
Authored: Wed May 14 10:11:31 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Wed May 14 10:11:31 2014 -0500

----------------------------------------------------------------------
 curator-client/pom.xml                          |   1 -
 .../curator/TestSessionFailRetryLoop.java       |   2 +-
 curator-examples/pom.xml                        |   6 -
 curator-framework/pom.xml                       |   1 -
 curator-recipes/pom.xml                         |   1 -
 .../framework/client/TestBackgroundStates.java  |   7 +-
 ...estResetConnectionWithBackgroundFailure.java |  14 +-
 .../locks/TestInterProcessSemaphoreCluster.java |   4 +-
 .../locks/TestLockCleanlinessWithFaults.java    |   4 +-
 .../framework/recipes/locks/TestReaper.java     |   4 +-
 .../TestPersistentEphemeralNodeListener.java    |   7 +-
 .../queue/TestBoundedDistributedQueue.java      |   6 +-
 .../recipes/queue/TestQueueSharder.java         |   6 +-
 curator-test/pom.xml                            |   3 -
 curator-x-discovery-server/pom.xml              |  24 --
 .../contexts/GenericDiscoveryContext.java       |  20 +-
 .../server/contexts/MapDiscoveryContext.java    |   4 +-
 .../server/jetty_jersey/TestMapsWithJersey.java |   2 +-
 .../TestObjectPayloadWithJersey.java            |  34 +--
 .../jetty_jersey/TestStringsWithJersey.java     |  18 +-
 .../jetty_resteasy/TestStringsWithRestEasy.java |   2 +-
 curator-x-discovery/pom.xml                     |   2 -
 .../apache/curator/x/discovery/TestUriSpec.java |   2 +-
 pom.xml                                         | 273 +++++++++++++++----
 24 files changed, 288 insertions(+), 159 deletions(-)
----------------------------------------------------------------------



[26/29] git commit: use getData() instead of exists() to avoid leaving unneeded watchers which is a type of resource leak. However, this might have performance affects. Therefore, added system proprety "curator-path-children-cache-use-exists" to use the

Posted by ra...@apache.org.
use getData() instead of exists() to avoid leaving unneeded watchers which is a type of resource leak. However, this might have
performance affects. Therefore, added system proprety "curator-path-children-cache-use-exists" to use the old behavior. i.e.
add -Dcurator-path-children-cache-use-exists=true or call System.setProperty("curator-path-children-cache-use-exists", "true") to
use the old behavior of calling exists() instead.


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/0dcf8335
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/0dcf8335
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/0dcf8335

Branch: refs/heads/CURATOR-105
Commit: 0dcf8335745003c578dbaf09b3be658b89b4a045
Parents: 91d6503
Author: randgalt <ra...@apache.org>
Authored: Fri May 23 07:48:11 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Fri May 23 07:48:11 2014 -0500

----------------------------------------------------------------------
 .../recipes/cache/PathChildrenCache.java        | 30 ++++++++------------
 1 file changed, 12 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/0dcf8335/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
index 855d060..dc23e04 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
@@ -89,6 +89,8 @@ public class PathChildrenCache implements Closeable
 
     private static final ChildData NULL_CHILD_DATA = new ChildData(null, null, null);
 
+    private static final boolean USE_EXISTS = Boolean.getBoolean("curator-path-children-cache-use-exists");
+
     private final Watcher childrenWatcher = new Watcher()
     {
         @Override
@@ -508,39 +510,31 @@ public class PathChildrenCache implements Closeable
 
     void getDataAndStat(final String fullPath) throws Exception
     {
-        BackgroundCallback existsCallback = new BackgroundCallback()
+        BackgroundCallback callback = new BackgroundCallback()
         {
             @Override
             public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
             {
-                applyNewData(fullPath, event.getResultCode(), event.getStat(), null);
+                applyNewData(fullPath, event.getResultCode(), event.getStat(), cacheData ? event.getData() : null);
             }
         };
 
-        BackgroundCallback getDataCallback = new BackgroundCallback()
+        if ( USE_EXISTS && !cacheData )
         {
-            @Override
-            public void processResult(CuratorFramework client, CuratorEvent event) throws Exception
-            {
-                applyNewData(fullPath, event.getResultCode(), event.getStat(), event.getData());
-            }
-        };
-
-        if ( cacheData )
+            client.checkExists().usingWatcher(dataWatcher).inBackground(callback).forPath(fullPath);
+        }
+        else
         {
-            if ( dataIsCompressed )
+            // always use getData() instead of exists() to avoid leaving unneeded watchers which is a type of resource leak
+            if ( dataIsCompressed && cacheData )
             {
-                client.getData().decompressed().usingWatcher(dataWatcher).inBackground(getDataCallback).forPath(fullPath);
+                client.getData().decompressed().usingWatcher(dataWatcher).inBackground(callback).forPath(fullPath);
             }
             else
             {
-                client.getData().usingWatcher(dataWatcher).inBackground(getDataCallback).forPath(fullPath);
+                client.getData().usingWatcher(dataWatcher).inBackground(callback).forPath(fullPath);
             }
         }
-        else
-        {
-            client.checkExists().usingWatcher(dataWatcher).inBackground(existsCallback).forPath(fullPath);
-        }
     }
 
     /**


[21/29] git commit: No need for null check

Posted by ra...@apache.org.
No need for null check


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/ac57e11b
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/ac57e11b
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/ac57e11b

Branch: refs/heads/CURATOR-105
Commit: ac57e11b34bb2970775b385f5a1e94bccd287232
Parents: c971649
Author: Dominic Wong <do...@hailocab.com>
Authored: Wed May 21 13:45:54 2014 +0100
Committer: Dominic Wong <do...@hailocab.com>
Committed: Wed May 21 13:45:54 2014 +0100

----------------------------------------------------------------------
 .../framework/recipes/locks/LockInternals.java  | 27 +++++++++-----------
 1 file changed, 12 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/ac57e11b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
index c66e4d1..d6298ce 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
@@ -298,24 +298,21 @@ public class LockInternals
                         try 
                         {
                             byte[] data = client.getData().usingWatcher(watcher).forPath(previousSequencePath);
-                            if ( data != null )
+                            if ( millisToWait != null )
                             {
-                                if ( millisToWait != null )
+                                millisToWait -= (System.currentTimeMillis() - startMillis);
+                                startMillis = System.currentTimeMillis();
+                                if ( millisToWait <= 0 )
                                 {
-                                    millisToWait -= (System.currentTimeMillis() - startMillis);
-                                    startMillis = System.currentTimeMillis();
-                                    if ( millisToWait <= 0 )
-                                    {
-                                        doDelete = true;    // timed out - delete our node
-                                        break;
-                                    }
-
-                                    wait(millisToWait);
-                                }
-                                else
-                                {
-                                    wait();
+                                    doDelete = true;    // timed out - delete our node
+                                    break;
                                 }
+
+                                wait(millisToWait);
+                            }
+                            else
+                            {
+                                wait();
                             }
                         }
                         catch ( KeeperException.NoNodeException e ) 


[11/29] git commit: refine failure assertion

Posted by ra...@apache.org.
refine failure assertion


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/e04eb471
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/e04eb471
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/e04eb471

Branch: refs/heads/CURATOR-105
Commit: e04eb47171bbafe49ee8c080c08a7156c386777a
Parents: 6784f80
Author: randgalt <ra...@apache.org>
Authored: Thu May 15 13:56:32 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 15 13:56:32 2014 -0500

----------------------------------------------------------------------
 .../ensemble/exhibitor/TestExhibitorEnsembleProvider.java     | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/e04eb471/curator-client/src/test/java/org/apache/curator/ensemble/exhibitor/TestExhibitorEnsembleProvider.java
----------------------------------------------------------------------
diff --git a/curator-client/src/test/java/org/apache/curator/ensemble/exhibitor/TestExhibitorEnsembleProvider.java b/curator-client/src/test/java/org/apache/curator/ensemble/exhibitor/TestExhibitorEnsembleProvider.java
index b38cb43..7bc6cde 100644
--- a/curator-client/src/test/java/org/apache/curator/ensemble/exhibitor/TestExhibitorEnsembleProvider.java
+++ b/curator-client/src/test/java/org/apache/curator/ensemble/exhibitor/TestExhibitorEnsembleProvider.java
@@ -207,7 +207,7 @@ public class TestExhibitorEnsembleProvider extends BaseClassForTests
         ExhibitorEnsembleProvider   provider = new ExhibitorEnsembleProvider(exhibitors, mockRestClient, "/foo", 10, new RetryOneTime(1));
         provider.pollForInitialEnsemble();
 
-        Timing                      timing = new Timing(4);
+        Timing                      timing = new Timing();
         CuratorZookeeperClient      client = new CuratorZookeeperClient(provider, timing.session(), timing.connection(), null, new ExponentialBackoffRetry(timing.milliseconds(), 3));
         client.start();
         try
@@ -217,10 +217,7 @@ public class TestExhibitorEnsembleProvider extends BaseClassForTests
         }
         catch ( Exception e )
         {
-            System.out.println("provider.getConnectionString(): " + provider.getConnectionString() + " server.getPort(): " + server.getPort());
-            e.printStackTrace();
-            Assert.fail();
-            throw e;
+            Assert.fail("provider.getConnectionString(): " + provider.getConnectionString() + " server.getPort(): " + server.getPort(), e);
         }
         finally
         {


[17/29] git commit: More tightening of tests

Posted by ra...@apache.org.
More tightening of tests


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/ab618960
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/ab618960
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/ab618960

Branch: refs/heads/CURATOR-105
Commit: ab618960332ebb2e39f536b6175e6ef9eb033b9b
Parents: 78cf189
Author: randgalt <ra...@apache.org>
Authored: Thu May 15 16:55:15 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 15 16:55:15 2014 -0500

----------------------------------------------------------------------
 .../framework/imps/TestFrameworkEdges.java      | 25 ++++++++++----------
 1 file changed, 12 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/ab618960/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
index aec45b6..3de1e56 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
@@ -20,7 +20,6 @@
 package org.apache.curator.framework.imps;
 
 import com.google.common.collect.Queues;
-import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.RetryPolicy;
 import org.apache.curator.RetrySleeper;
 import org.apache.curator.framework.CuratorFramework;
@@ -35,6 +34,7 @@ import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.KillSession;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;
+import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.utils.ZKPaths;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
@@ -52,10 +52,11 @@ import java.util.concurrent.atomic.AtomicInteger;
 
 public class TestFrameworkEdges extends BaseClassForTests
 {
+    private final Timing timing = new Timing();
+
     @Test
     public void connectionLossWithBackgroundTest() throws Exception
     {
-        Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), 1, new RetryOneTime(1));
         try
         {
@@ -84,7 +85,6 @@ public class TestFrameworkEdges extends BaseClassForTests
     @Test
     public void testReconnectAfterLoss() throws Exception
     {
-        Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         try
         {
@@ -133,7 +133,7 @@ public class TestFrameworkEdges extends BaseClassForTests
     public void testGetAclNoStat() throws Exception
     {
 
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -155,7 +155,7 @@ public class TestFrameworkEdges extends BaseClassForTests
     @Test
     public void testMissedResponseOnBackgroundESCreate() throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -172,7 +172,7 @@ public class TestFrameworkEdges extends BaseClassForTests
                 }
             };
             createBuilder.withProtection().withMode(CreateMode.EPHEMERAL_SEQUENTIAL).inBackground(callback).forPath("/");
-            String ourPath = queue.poll(10, TimeUnit.SECONDS);
+            String ourPath = queue.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS);
             Assert.assertTrue(ourPath.startsWith(ZKPaths.makePath("/", CreateBuilderImpl.PROTECTED_PREFIX)));
             Assert.assertFalse(createBuilder.failNextCreateForTesting);
         }
@@ -185,7 +185,7 @@ public class TestFrameworkEdges extends BaseClassForTests
     @Test
     public void testMissedResponseOnESCreate() throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -204,7 +204,7 @@ public class TestFrameworkEdges extends BaseClassForTests
     @Test
     public void testSessionKilled() throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -236,7 +236,7 @@ public class TestFrameworkEdges extends BaseClassForTests
     @Test
     public void testNestedCalls() throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -275,7 +275,6 @@ public class TestFrameworkEdges extends BaseClassForTests
     @Test
     public void testBackgroundFailure() throws Exception
     {
-        Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
@@ -341,7 +340,7 @@ public class TestFrameworkEdges extends BaseClassForTests
         final int MAX_RETRIES = 3;
         final int serverPort = server.getPort();
 
-        final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), 1000, 1000, new RetryOneTime(10));
+        final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(10));
         client.start();
         try
         {
@@ -375,7 +374,7 @@ public class TestFrameworkEdges extends BaseClassForTests
 
             // test foreground retry
             client.checkExists().forPath("/hey");
-            Assert.assertTrue(semaphore.tryAcquire(MAX_RETRIES, 10, TimeUnit.SECONDS));
+            Assert.assertTrue(semaphore.tryAcquire(MAX_RETRIES, timing.forWaiting().seconds(), TimeUnit.SECONDS));
 
             semaphore.drainPermits();
             retries.set(0);
@@ -384,7 +383,7 @@ public class TestFrameworkEdges extends BaseClassForTests
 
             // test background retry
             client.checkExists().inBackground().forPath("/hey");
-            Assert.assertTrue(semaphore.tryAcquire(MAX_RETRIES, 10, TimeUnit.SECONDS));
+            Assert.assertTrue(semaphore.tryAcquire(MAX_RETRIES, timing.forWaiting().seconds(), TimeUnit.SECONDS));
         }
         catch ( Throwable e )
         {


[09/29] git commit: By default all the connection issues are logged as error now to maintain backwards compatibility

Posted by ra...@apache.org.
By default all the connection issues are logged as error now to maintain
backwards compatibility

This closes #6


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/3c468b23
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/3c468b23
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/3c468b23

Branch: refs/heads/CURATOR-105
Commit: 3c468b235ee0dc5942fc1658687deca5124b1441
Parents: abe07d4
Author: eceejcr <ec...@E7B499BAE9DDE0.ericsson.se>
Authored: Mon May 12 08:27:47 2014 +0200
Committer: randgalt <ra...@apache.org>
Committed: Wed May 14 09:41:40 2014 -0500

----------------------------------------------------------------------
 .../src/main/java/org/apache/curator/utils/DebugUtils.java         | 2 +-
 .../org/apache/curator/framework/imps/CuratorFrameworkImpl.java    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/3c468b23/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java b/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
index 0ce2729..ce751ec 100644
--- a/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
+++ b/curator-client/src/main/java/org/apache/curator/utils/DebugUtils.java
@@ -22,7 +22,7 @@ public class DebugUtils
 {
     public static final String          PROPERTY_LOG_EVENTS = "curator-log-events";
     public static final String          PROPERTY_DONT_LOG_CONNECTION_ISSUES = "curator-dont-log-connection-problems";
-    public static final String          PROPERTY_LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL = "curator-log-all-connection-issues-as-error-level";
+    public static final String          PROPERTY_LOG_ONLY_FIRST_CONNECTION_ISSUE_AS_ERROR_LEVEL = "curator-log-only-first-connection-issue-as-error-level";
 
     private DebugUtils()
     {

http://git-wip-us.apache.org/repos/asf/curator/blob/3c468b23/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
index 99c8245..e8eb76c 100644
--- a/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
+++ b/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
@@ -76,7 +76,7 @@ public class CuratorFrameworkImpl implements CuratorFramework
     private volatile ExecutorService                                    executorService;
     private final AtomicBoolean                                         logAsErrorConnectionErrors = new AtomicBoolean(false);
 
-    private static final boolean                                        LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL = Boolean.getBoolean(DebugUtils.PROPERTY_LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL);
+    private static final boolean                                        LOG_ALL_CONNECTION_ISSUES_AS_ERROR_LEVEL = !Boolean.getBoolean(DebugUtils.PROPERTY_LOG_ONLY_FIRST_CONNECTION_ISSUE_AS_ERROR_LEVEL);
 
     interface DebugBackgroundListener
     {


[28/29] git commit: Nulling the watchers seems to help free more memory. I don't understand why. TODO for another day

Posted by ra...@apache.org.
Nulling the watchers seems to help free more memory. I don't understand why. TODO for another day


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/9b9b9ae9
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/9b9b9ae9
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/9b9b9ae9

Branch: refs/heads/CURATOR-105
Commit: 9b9b9ae96c9c5fa423b263aba3768fc16c77a794
Parents: 0bffdb0
Author: randgalt <ra...@apache.org>
Authored: Fri May 23 10:06:39 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Fri May 23 10:06:39 2014 -0500

----------------------------------------------------------------------
 .../recipes/cache/PathChildrenCache.java        |  9 ++-
 .../x/discovery/ServiceCacheLeakTest.java       | 61 --------------------
 .../x/discovery/ServiceCacheLeakTester.java     | 61 ++++++++++++++++++++
 3 files changed, 65 insertions(+), 66 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/9b9b9ae9/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
index 04de09b..dd41b5f 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
@@ -91,7 +91,7 @@ public class PathChildrenCache implements Closeable
 
     private static final boolean USE_EXISTS = Boolean.getBoolean("curator-path-children-cache-use-exists");
 
-    private final Watcher childrenWatcher = new Watcher()
+    private volatile Watcher childrenWatcher = new Watcher()
     {
         @Override
         public void process(WatchedEvent event)
@@ -373,13 +373,12 @@ public class PathChildrenCache implements Closeable
             client.clearWatcherReferences(childrenWatcher);
             client.clearWatcherReferences(dataWatcher);
 
-/*
-            This seems to enable even more GC - I'm not sure why yet
-
+            // TODO
+            // This seems to enable even more GC - I'm not sure why yet - it
+            // has something to do with Guava's cache and circular references
             connectionStateListener = null;
             childrenWatcher = null;
             dataWatcher = null;
-*/
         }
     }
 

http://git-wip-us.apache.org/repos/asf/curator/blob/9b9b9ae9/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTest.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTest.java b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTest.java
deleted file mode 100644
index a8c130c..0000000
--- a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.apache.curator.x.discovery;
-
-import org.apache.curator.framework.CuratorFramework;
-import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.retry.RetryOneTime;
-import org.apache.curator.test.TestingServer;
-import org.apache.curator.utils.CloseableUtils;
-import org.apache.curator.x.discovery.strategies.RandomStrategy;
-import org.testng.annotations.Test;
-
-public class ServiceCacheLeakTest
-{
-    @Test
-    public void serviceCacheInstancesLeaked() throws Exception
-    {
-        TestingServer testingServer = new TestingServer();
-
-        final CuratorFramework curatorFramework = CuratorFrameworkFactory.newClient(testingServer.getConnectString(), new RetryOneTime(1));
-        try
-        {
-            curatorFramework.start();
-
-            doWork(curatorFramework);
-            System.gc();
-
-            System.out.println("Done - get dump");
-            Thread.currentThread().join();
-        }
-        finally
-        {
-            CloseableUtils.closeQuietly(curatorFramework);
-            CloseableUtils.closeQuietly(testingServer);
-        }
-    }
-
-    private void doWork(CuratorFramework curatorFramework) throws Exception
-    {
-        ServiceInstance<Void> thisInstance = ServiceInstance.<Void>builder().name("myservice").build();
-        final ServiceDiscovery<Void> serviceDiscovery = ServiceDiscoveryBuilder.builder(Void.class).client(curatorFramework.usingNamespace("dev")).basePath("/instances").thisInstance(thisInstance).build();
-        serviceDiscovery.start();
-
-        for ( int i = 0; i < 100000; i++ )
-        {
-            final ServiceProvider<Void> s = serviceProvider(serviceDiscovery, "myservice");
-            s.start();
-            try
-            {
-                s.getInstance().buildUriSpec();
-            }
-            finally
-            {
-                s.close();
-            }
-        }
-    }
-
-    private ServiceProvider<Void> serviceProvider(ServiceDiscovery<Void> serviceDiscovery, String name) throws Exception
-    {
-        return serviceDiscovery.serviceProviderBuilder().serviceName(name).providerStrategy(new RandomStrategy<Void>()).build();
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/curator/blob/9b9b9ae9/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTester.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTester.java b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTester.java
new file mode 100644
index 0000000..b4e08d1
--- /dev/null
+++ b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTester.java
@@ -0,0 +1,61 @@
+package org.apache.curator.x.discovery;
+
+import org.apache.curator.framework.CuratorFramework;
+import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.TestingServer;
+import org.apache.curator.utils.CloseableUtils;
+import org.apache.curator.x.discovery.strategies.RandomStrategy;
+import org.testng.annotations.Test;
+
+public class ServiceCacheLeakTester
+{
+    @Test
+    public void serviceCacheInstancesLeaked() throws Exception
+    {
+        TestingServer testingServer = new TestingServer();
+
+        final CuratorFramework curatorFramework = CuratorFrameworkFactory.newClient(testingServer.getConnectString(), new RetryOneTime(1));
+        try
+        {
+            curatorFramework.start();
+
+            doWork(curatorFramework);
+            System.gc();
+
+            System.out.println("Done - get dump");
+            Thread.currentThread().join();
+        }
+        finally
+        {
+            CloseableUtils.closeQuietly(curatorFramework);
+            CloseableUtils.closeQuietly(testingServer);
+        }
+    }
+
+    private void doWork(CuratorFramework curatorFramework) throws Exception
+    {
+        ServiceInstance<Void> thisInstance = ServiceInstance.<Void>builder().name("myservice").build();
+        final ServiceDiscovery<Void> serviceDiscovery = ServiceDiscoveryBuilder.builder(Void.class).client(curatorFramework.usingNamespace("dev")).basePath("/instances").thisInstance(thisInstance).build();
+        serviceDiscovery.start();
+
+        for ( int i = 0; i < 100000; i++ )
+        {
+            final ServiceProvider<Void> s = serviceProvider(serviceDiscovery, "myservice");
+            s.start();
+            try
+            {
+                s.getInstance().buildUriSpec();
+            }
+            finally
+            {
+                s.close();
+            }
+        }
+    }
+
+    private ServiceProvider<Void> serviceProvider(ServiceDiscovery<Void> serviceDiscovery, String name) throws Exception
+    {
+        return serviceDiscovery.serviceProviderBuilder().serviceName(name).providerStrategy(new RandomStrategy<Void>()).build();
+    }
+}
\ No newline at end of file


[16/29] git commit: More tightening of tests

Posted by ra...@apache.org.
More tightening of tests


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/78cf189c
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/78cf189c
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/78cf189c

Branch: refs/heads/CURATOR-105
Commit: 78cf189c7afdd68bd4ccd468f0df61412aaf6fa8
Parents: 460a9b3
Author: randgalt <ra...@apache.org>
Authored: Thu May 15 15:28:17 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 15 15:28:17 2014 -0500

----------------------------------------------------------------------
 .../recipes/locks/TestInterProcessSemaphore.java     | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/78cf189c/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
index 559b012..798cb3e 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
@@ -473,11 +473,11 @@ public class TestInterProcessSemaphore extends BaseClassForTests
         final int MAX_LEASES = 3;
         Timing timing = new Timing();
 
+        List<Lease> leases = Lists.newArrayList();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
-            List<Lease> leases = Lists.newArrayList();
             for ( int i = 0; i < MAX_LEASES; ++i )
             {
                 InterProcessSemaphoreV2 semaphore = new InterProcessSemaphoreV2(client, "/test", MAX_LEASES);
@@ -495,7 +495,11 @@ public class TestInterProcessSemaphore extends BaseClassForTests
         }
         finally
         {
-            client.close();
+            for ( Lease l : leases )
+            {
+                CloseableUtils.closeQuietly(l);
+            }
+            CloseableUtils.closeQuietly(client);
         }
     }
 
@@ -506,19 +510,24 @@ public class TestInterProcessSemaphore extends BaseClassForTests
 
         Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
+        List<Lease> leases = Lists.newArrayList();
         client.start();
         try
         {
             InterProcessSemaphoreV2 semaphore = new InterProcessSemaphoreV2(client, "/test", LEASES);
             for ( int i = 0; i < LEASES; ++i )
             {
-                semaphore.acquire();
+                leases.add(semaphore.acquire());
             }
 
             Assert.assertEquals(semaphore.getParticipantNodes().size(), LEASES);
         }
         finally
         {
+            for ( Lease l : leases )
+            {
+                CloseableUtils.closeQuietly(l);
+            }
             CloseableUtils.closeQuietly(client);
         }
     }


[18/29] git commit: Major refactoring. Moved all "BaseClassForTests" versions into curator-test. Added checks for server binding errors to this as occassionally getting a random port doesn't seem to work. Also, added general retries of tests as, occasion

Posted by ra...@apache.org.
Major refactoring. Moved all "BaseClassForTests" versions into curator-test. Added checks for server binding errors to this as occassionally
getting a random port doesn't seem to work. Also, added general retries of tests as, occasionally, there are random problems.


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/351c67c9
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/351c67c9
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/351c67c9

Branch: refs/heads/CURATOR-105
Commit: 351c67c978d77f6f7241808b6b1b8824ffd8c52a
Parents: ab61896
Author: randgalt <ra...@apache.org>
Authored: Tue May 20 10:30:46 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Tue May 20 10:30:46 2014 -0500

----------------------------------------------------------------------
 .../org/apache/curator/BaseClassForTests.java   | 42 ---------
 .../java/org/apache/curator/BasicTests.java     |  1 +
 .../java/org/apache/curator/TestRetryLoop.java  |  1 +
 .../curator/TestSessionFailRetryLoop.java       |  1 +
 .../TestExhibitorEnsembleProvider.java          |  2 +-
 .../framework/imps/BaseClassForTests.java       | 49 ----------
 .../curator/framework/imps/TestCompression.java |  1 +
 .../framework/imps/TestFailedDeleteManager.java |  1 +
 .../curator/framework/imps/TestFramework.java   |  1 +
 .../framework/imps/TestFrameworkBackground.java |  1 +
 .../framework/imps/TestFrameworkEdges.java      |  1 +
 .../curator/framework/imps/TestMultiClient.java |  1 +
 .../framework/imps/TestNamespaceFacade.java     |  1 +
 .../framework/imps/TestTempFramework.java       |  1 +
 .../framework/imps/TestTransactions.java        |  1 +
 .../framework/imps/TestWatcherIdentity.java     |  1 +
 .../framework/client/TestBackgroundStates.java  |  2 +-
 ...estResetConnectionWithBackgroundFailure.java |  2 +-
 .../framework/recipes/BaseClassForTests.java    | 42 ---------
 .../recipes/atomic/TestCachedAtomicCounter.java |  2 +-
 .../atomic/TestDistributedAtomicLong.java       |  2 +-
 .../barriers/TestDistributedBarrier.java        |  2 +-
 .../barriers/TestDistributedDoubleBarrier.java  |  2 +-
 .../framework/recipes/cache/TestNodeCache.java  |  2 +-
 .../recipes/cache/TestPathChildrenCache.java    |  2 +-
 .../recipes/leader/TestLeaderLatch.java         |  2 +-
 .../recipes/leader/TestLeaderSelector.java      |  2 +-
 .../recipes/leader/TestLeaderSelectorEdges.java |  2 +-
 .../leader/TestLeaderSelectorParticipants.java  |  2 +-
 .../leader/TestLeaderSelectorWithExecutor.java  |  2 +-
 .../recipes/locks/TestChildReaper.java          |  2 +-
 .../locks/TestInterProcessMutexBase.java        |  2 +-
 .../locks/TestInterProcessReadWriteLock.java    |  2 +-
 .../locks/TestInterProcessSemaphore.java        |  2 +-
 .../framework/recipes/locks/TestLockACLs.java   |  2 +-
 .../locks/TestLockCleanlinessWithFaults.java    |  2 +-
 .../framework/recipes/locks/TestReaper.java     |  2 +-
 .../nodes/TestPersistentEphemeralNode.java      |  2 +-
 .../TestPersistentEphemeralNodeListener.java    |  2 +-
 .../queue/TestBoundedDistributedQueue.java      |  2 +-
 .../queue/TestDistributedDelayQueue.java        |  2 +-
 .../recipes/queue/TestDistributedIdQueue.java   |  2 +-
 .../queue/TestDistributedPriorityQueue.java     |  2 +-
 .../recipes/queue/TestDistributedQueue.java     |  2 +-
 .../recipes/queue/TestQueueSharder.java         |  2 +-
 .../queue/TestSimpleDistributedQueue.java       |  2 +-
 .../recipes/shared/TestSharedCount.java         |  2 +-
 curator-test/pom.xml                            |  6 ++
 .../apache/curator/test/BaseClassForTests.java  | 98 ++++++++++++++++++++
 .../curator/test/TestingZooKeeperMain.java      | 51 ++++++----
 .../curator/test/TestingZooKeeperServer.java    |  2 +-
 .../curator/x/discovery/TestServiceCache.java   | 11 +--
 .../x/discovery/TestServiceDiscovery.java       | 13 +--
 53 files changed, 188 insertions(+), 201 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-client/src/test/java/org/apache/curator/BaseClassForTests.java
----------------------------------------------------------------------
diff --git a/curator-client/src/test/java/org/apache/curator/BaseClassForTests.java b/curator-client/src/test/java/org/apache/curator/BaseClassForTests.java
deleted file mode 100644
index 1356139..0000000
--- a/curator-client/src/test/java/org/apache/curator/BaseClassForTests.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.curator;
-
-import org.apache.curator.test.TestingServer;
-import org.apache.curator.utils.DebugUtils;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
-public class BaseClassForTests
-{
-    protected TestingServer server;
-
-    @BeforeMethod
-    public void     setup() throws Exception
-    {
-        System.setProperty(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES, "true");
-        server = new TestingServer();
-    }
-
-    @AfterMethod
-    public void     teardown() throws Exception
-    {
-        server.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-client/src/test/java/org/apache/curator/BasicTests.java
----------------------------------------------------------------------
diff --git a/curator-client/src/test/java/org/apache/curator/BasicTests.java b/curator-client/src/test/java/org/apache/curator/BasicTests.java
index e9a9402..b886f3c 100644
--- a/curator-client/src/test/java/org/apache/curator/BasicTests.java
+++ b/curator-client/src/test/java/org/apache/curator/BasicTests.java
@@ -20,6 +20,7 @@ package org.apache.curator;
 
 import org.apache.curator.ensemble.fixed.FixedEnsembleProvider;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.KillSession;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java
----------------------------------------------------------------------
diff --git a/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java b/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java
index 1549183..c839807 100644
--- a/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java
+++ b/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java
@@ -20,6 +20,7 @@ package org.apache.curator;
 
 import org.apache.curator.retry.ExponentialBackoffRetry;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.TestingServer;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.ZooDefs;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-client/src/test/java/org/apache/curator/TestSessionFailRetryLoop.java
----------------------------------------------------------------------
diff --git a/curator-client/src/test/java/org/apache/curator/TestSessionFailRetryLoop.java b/curator-client/src/test/java/org/apache/curator/TestSessionFailRetryLoop.java
index f3b2e4e..c17b5bf 100644
--- a/curator-client/src/test/java/org/apache/curator/TestSessionFailRetryLoop.java
+++ b/curator-client/src/test/java/org/apache/curator/TestSessionFailRetryLoop.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.KillSession;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-client/src/test/java/org/apache/curator/ensemble/exhibitor/TestExhibitorEnsembleProvider.java
----------------------------------------------------------------------
diff --git a/curator-client/src/test/java/org/apache/curator/ensemble/exhibitor/TestExhibitorEnsembleProvider.java b/curator-client/src/test/java/org/apache/curator/ensemble/exhibitor/TestExhibitorEnsembleProvider.java
index 7bc6cde..60c817a 100644
--- a/curator-client/src/test/java/org/apache/curator/ensemble/exhibitor/TestExhibitorEnsembleProvider.java
+++ b/curator-client/src/test/java/org/apache/curator/ensemble/exhibitor/TestExhibitorEnsembleProvider.java
@@ -19,8 +19,8 @@
 package org.apache.curator.ensemble.exhibitor;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
-import org.apache.curator.BaseClassForTests;
 import org.apache.curator.CuratorZookeeperClient;
 import org.apache.curator.RetryLoop;
 import org.apache.curator.retry.ExponentialBackoffRetry;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/BaseClassForTests.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/BaseClassForTests.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/BaseClassForTests.java
deleted file mode 100644
index 13fd0b6..0000000
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/BaseClassForTests.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.curator.framework.imps;
-
-import org.apache.curator.test.TestingServer;
-import org.apache.curator.utils.DebugUtils;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
-public class BaseClassForTests
-{
-    protected TestingServer server;
-
-    @BeforeMethod
-    public void     setup() throws Exception
-    {
-        System.setProperty(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES, "true");
-        server = new TestingServer();
-    }
-
-    @AfterMethod
-    public void     teardown()
-    {
-        try
-        {
-            server.close();
-        }
-        catch ( Throwable e )
-        {
-            e.printStackTrace();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/TestCompression.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestCompression.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestCompression.java
index 2a8ec7c..520d0b6 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestCompression.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestCompression.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator.framework.imps;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFailedDeleteManager.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFailedDeleteManager.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFailedDeleteManager.java
index fa27285..fe74a72 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFailedDeleteManager.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFailedDeleteManager.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator.framework.imps;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
index 7a9a386..93d346b 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFramework.java
@@ -19,6 +19,7 @@
 package org.apache.curator.framework.imps;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
index 6e76931..44792d9 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkBackground.java
@@ -20,6 +20,7 @@
 package org.apache.curator.framework.imps;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
index 3de1e56..52897b6 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestFrameworkEdges.java
@@ -31,6 +31,7 @@ import org.apache.curator.framework.api.CuratorListener;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.KillSession;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/TestMultiClient.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestMultiClient.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestMultiClient.java
index 69d688b..1d7634b 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestMultiClient.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestMultiClient.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator.framework.imps;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/TestNamespaceFacade.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestNamespaceFacade.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestNamespaceFacade.java
index c99dc85..32b26dd 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestNamespaceFacade.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestNamespaceFacade.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator.framework.imps;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/TestTempFramework.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestTempFramework.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestTempFramework.java
index a9e123e..d87e138 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestTempFramework.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestTempFramework.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator.framework.imps;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.CuratorTempFramework;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/TestTransactions.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestTransactions.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestTransactions.java
index ba1104c..3b7e062 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestTransactions.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestTransactions.java
@@ -24,6 +24,7 @@ import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.transaction.CuratorTransactionResult;
 import org.apache.curator.framework.api.transaction.OperationType;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.data.Stat;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-framework/src/test/java/org/apache/curator/framework/imps/TestWatcherIdentity.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestWatcherIdentity.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestWatcherIdentity.java
index 84ef025..e950516 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestWatcherIdentity.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestWatcherIdentity.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator.framework.imps;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/client/TestBackgroundStates.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/client/TestBackgroundStates.java b/curator-recipes/src/test/java/org/apache/curator/framework/client/TestBackgroundStates.java
index 8cfa342..ac7c7a9 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/client/TestBackgroundStates.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/client/TestBackgroundStates.java
@@ -22,11 +22,11 @@ package org.apache.curator.framework.client;
 import com.google.common.collect.Queues;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.recipes.nodes.PersistentEphemeralNode;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/client/TestResetConnectionWithBackgroundFailure.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/client/TestResetConnectionWithBackgroundFailure.java b/curator-recipes/src/test/java/org/apache/curator/framework/client/TestResetConnectionWithBackgroundFailure.java
index 5b6a5fa..83025af 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/client/TestResetConnectionWithBackgroundFailure.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/client/TestResetConnectionWithBackgroundFailure.java
@@ -21,13 +21,13 @@ package org.apache.curator.framework.client;
 
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.recipes.leader.LeaderSelector;
 import org.apache.curator.framework.recipes.leader.LeaderSelectorListener;
 import org.apache.curator.framework.recipes.leader.LeaderSelectorListenerAdapter;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/BaseClassForTests.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/BaseClassForTests.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/BaseClassForTests.java
deleted file mode 100644
index 36e753c..0000000
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/BaseClassForTests.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.curator.framework.recipes;
-
-import org.apache.curator.test.TestingServer;
-import org.apache.curator.utils.DebugUtils;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
-public class BaseClassForTests
-{
-    protected TestingServer server;
-
-    @BeforeMethod
-    public void     setup() throws Exception
-    {
-        System.setProperty(DebugUtils.PROPERTY_DONT_LOG_CONNECTION_ISSUES, "true");
-        server = new TestingServer();
-    }
-
-    @AfterMethod
-    public void     teardown() throws Exception
-    {
-        server.close();
-    }
-}

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/atomic/TestCachedAtomicCounter.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/atomic/TestCachedAtomicCounter.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/atomic/TestCachedAtomicCounter.java
index c0fe097..bdc03c2 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/atomic/TestCachedAtomicCounter.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/atomic/TestCachedAtomicCounter.java
@@ -20,8 +20,8 @@ package org.apache.curator.framework.recipes.atomic;
 
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.util.concurrent.atomic.AtomicReference;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/atomic/TestDistributedAtomicLong.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/atomic/TestDistributedAtomicLong.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/atomic/TestDistributedAtomicLong.java
index cb7a839..c2e0888 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/atomic/TestDistributedAtomicLong.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/atomic/TestDistributedAtomicLong.java
@@ -21,11 +21,11 @@ package org.apache.curator.framework.recipes.atomic;
 import org.apache.curator.RetryPolicy;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.ExponentialBackoffRetry;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.commons.math.stat.descriptive.SummaryStatistics;
 import org.apache.commons.math.stat.descriptive.SynchronizedSummaryStatistics;
+import org.apache.curator.test.BaseClassForTests;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import org.testng.collections.Lists;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/barriers/TestDistributedBarrier.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/barriers/TestDistributedBarrier.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/barriers/TestDistributedBarrier.java
index 4926053..a870367 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/barriers/TestDistributedBarrier.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/barriers/TestDistributedBarrier.java
@@ -19,10 +19,10 @@
 package org.apache.curator.framework.recipes.barriers;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.zookeeper.KeeperException;
 import org.testng.Assert;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/barriers/TestDistributedDoubleBarrier.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/barriers/TestDistributedDoubleBarrier.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/barriers/TestDistributedDoubleBarrier.java
index 53bfeda..24fd3cb 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/barriers/TestDistributedDoubleBarrier.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/barriers/TestDistributedDoubleBarrier.java
@@ -19,10 +19,10 @@
 package org.apache.curator.framework.recipes.barriers;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.Timing;
 import org.testng.Assert;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestNodeCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestNodeCache.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestNodeCache.java
index c81619e..27af6ac 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestNodeCache.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestNodeCache.java
@@ -18,11 +18,11 @@
  */
 package org.apache.curator.framework.recipes.cache;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.UnhandledErrorListener;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.KillSession;
 import org.apache.curator.test.Timing;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
index 679d180..bf57ed8 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
@@ -22,8 +22,8 @@ import com.google.common.collect.Lists;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.UnhandledErrorListener;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.KillSession;
 import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderLatch.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderLatch.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderLatch.java
index 1dcd352..b827e15 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderLatch.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderLatch.java
@@ -24,10 +24,10 @@ import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelector.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelector.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelector.java
index a4ae2ba..87306a1 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelector.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelector.java
@@ -22,9 +22,9 @@ package org.apache.curator.framework.recipes.leader;
 import com.google.common.collect.Lists;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.KillSession;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorEdges.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorEdges.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorEdges.java
index e89c958..d13fea7 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorEdges.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorEdges.java
@@ -23,9 +23,9 @@ import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.api.CuratorEvent;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryNTimes;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.server.ServerCnxnFactory;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorParticipants.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorParticipants.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorParticipants.java
index 778a1b6..d7329ab 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorParticipants.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorParticipants.java
@@ -19,10 +19,10 @@
 package org.apache.curator.framework.recipes.leader;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryOneTime;
 import org.testng.Assert;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorWithExecutor.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorWithExecutor.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorWithExecutor.java
index c34a25f..214931b 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorWithExecutor.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/leader/TestLeaderSelectorWithExecutor.java
@@ -18,10 +18,10 @@
  */
 package org.apache.curator.framework.recipes.leader;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.ExponentialBackoffRetry;
 import org.apache.curator.test.Timing;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
index e9b91f7..309bd99 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestChildReaper.java
@@ -18,10 +18,10 @@
  */
 package org.apache.curator.framework.recipes.locks;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.Timing;
 import org.apache.zookeeper.data.Stat;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessMutexBase.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessMutexBase.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessMutexBase.java
index b1373fa..8b4ce46 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessMutexBase.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessMutexBase.java
@@ -20,10 +20,10 @@
 package org.apache.curator.framework.recipes.locks;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.ExponentialBackoffRetry;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessReadWriteLock.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessReadWriteLock.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessReadWriteLock.java
index 5b44c7c..23c9eca 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessReadWriteLock.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessReadWriteLock.java
@@ -19,10 +19,10 @@
 package org.apache.curator.framework.recipes.locks;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryOneTime;
 import org.testng.Assert;
 import org.testng.annotations.Test;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
index 798cb3e..dd3f98f 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
@@ -20,10 +20,10 @@
 package org.apache.curator.framework.recipes.locks;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.recipes.shared.SharedCount;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.Timing;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java
index e6e7418..2d9a9aa 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockACLs.java
@@ -19,12 +19,12 @@
 
 package org.apache.curator.framework.recipes.locks;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.RetryPolicy;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.ACLProvider;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.ExponentialBackoffRetry;
 import org.apache.curator.test.TestingServer;
 import org.apache.zookeeper.ZooDefs;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockCleanlinessWithFaults.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockCleanlinessWithFaults.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockCleanlinessWithFaults.java
index 9843848..457be75 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockCleanlinessWithFaults.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestLockCleanlinessWithFaults.java
@@ -20,8 +20,8 @@ package org.apache.curator.framework.recipes.locks;
 
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryNTimes;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.KeeperException;
 import org.testng.Assert;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
index 48868d5..83ec960 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestReaper.java
@@ -21,11 +21,11 @@ package org.apache.curator.framework.recipes.locks;
 
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.recipes.leader.LeaderSelector;
 import org.apache.curator.framework.recipes.leader.LeaderSelectorListener;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.CreateMode;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
index 35cb9e8..a07ee14 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
@@ -22,10 +22,10 @@ import com.google.common.base.Throwables;
 import com.google.common.collect.Lists;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.KillSession;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNodeListener.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNodeListener.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNodeListener.java
index 82d5876..3a4eda8 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNodeListener.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNodeListener.java
@@ -21,10 +21,10 @@ package org.apache.curator.framework.recipes.nodes;
 
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestBoundedDistributedQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestBoundedDistributedQueue.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestBoundedDistributedQueue.java
index 1acb051..edae618 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestBoundedDistributedQueue.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestBoundedDistributedQueue.java
@@ -20,9 +20,9 @@ package org.apache.curator.framework.recipes.queue;
 
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.WatchedEvent;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedDelayQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedDelayQueue.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedDelayQueue.java
index ecce020..d6b592f 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedDelayQueue.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedDelayQueue.java
@@ -18,10 +18,10 @@
  */
 package org.apache.curator.framework.recipes.queue;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.Timing;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedIdQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedIdQueue.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedIdQueue.java
index 9b74199..30e552f 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedIdQueue.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedIdQueue.java
@@ -19,10 +19,10 @@
 package org.apache.curator.framework.recipes.queue;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedPriorityQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedPriorityQueue.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedPriorityQueue.java
index e5c5e73..6c5ac7d 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedPriorityQueue.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedPriorityQueue.java
@@ -18,10 +18,10 @@
  */
 package org.apache.curator.framework.recipes.queue;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedQueue.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedQueue.java
index 02fc5d6..80509bc 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedQueue.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestDistributedQueue.java
@@ -20,6 +20,7 @@ package org.apache.curator.framework.recipes.queue;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import com.google.common.util.concurrent.MoreExecutors;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
@@ -27,7 +28,6 @@ import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.BackgroundCallback;
 import org.apache.curator.framework.imps.CuratorFrameworkState;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.ExponentialBackoffRetry;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
index e6f0d8e..7c4f298 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
@@ -22,10 +22,10 @@ import com.google.common.collect.Sets;
 import org.apache.commons.math.stat.descriptive.SummaryStatistics;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.RetryOneTime;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;
 import org.testng.Assert;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestSimpleDistributedQueue.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestSimpleDistributedQueue.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestSimpleDistributedQueue.java
index 6d27340..dab1674 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestSimpleDistributedQueue.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestSimpleDistributedQueue.java
@@ -18,10 +18,10 @@
  */
 package org.apache.curator.framework.recipes.queue;
 
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryOneTime;
 import org.testng.Assert;
 import org.testng.annotations.Test;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
index 4ad8318..08f7263 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/shared/TestSharedCount.java
@@ -19,11 +19,11 @@
 package org.apache.curator.framework.recipes.shared;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
-import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.retry.RetryOneTime;
 import org.testng.Assert;

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-test/pom.xml
----------------------------------------------------------------------
diff --git a/curator-test/pom.xml b/curator-test/pom.xml
index 86ffd46..ca1f675 100644
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@ -44,5 +44,11 @@
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-math</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <scope>provided</scope>
+        </dependency>
     </dependencies>
 </project>

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-test/src/main/java/org/apache/curator/test/BaseClassForTests.java
----------------------------------------------------------------------
diff --git a/curator-test/src/main/java/org/apache/curator/test/BaseClassForTests.java b/curator-test/src/main/java/org/apache/curator/test/BaseClassForTests.java
new file mode 100644
index 0000000..767ae4e
--- /dev/null
+++ b/curator-test/src/main/java/org/apache/curator/test/BaseClassForTests.java
@@ -0,0 +1,98 @@
+package org.apache.curator.test;
+
+import org.testng.IRetryAnalyzer;
+import org.testng.ITestContext;
+import org.testng.ITestNGMethod;
+import org.testng.ITestResult;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.BeforeSuite;
+import java.net.BindException;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+public class BaseClassForTests
+{
+    protected TestingServer server;
+
+    private static final int    RETRY_WAIT_MS = 5000;
+    private static final String INTERNAL_PROPERTY_DONT_LOG_CONNECTION_ISSUES;
+    static
+    {
+        String s = null;
+        try
+        {
+            // use reflection to avoid adding a circular dependency in the pom
+            s = (String)Class.forName("org.apache.curator.utils.DebugUtils").getField("PROPERTY_DONT_LOG_CONNECTION_ISSUES").get(null);
+        }
+        catch ( Exception e )
+        {
+            e.printStackTrace();
+        }
+        INTERNAL_PROPERTY_DONT_LOG_CONNECTION_ISSUES = s;
+    }
+
+    @BeforeSuite(alwaysRun = true)
+    public void beforeSuite(ITestContext context)
+    {
+        for ( ITestNGMethod method : context.getAllTestMethods() )
+        {
+            method.setRetryAnalyzer(new RetryTest());
+        }
+    }
+
+    @BeforeMethod
+    public void setup() throws Exception
+    {
+        if ( INTERNAL_PROPERTY_DONT_LOG_CONNECTION_ISSUES != null )
+        {
+            System.setProperty(INTERNAL_PROPERTY_DONT_LOG_CONNECTION_ISSUES, "true");
+        }
+
+        while ( server == null )
+        {
+            try
+            {
+                server = new TestingServer();
+            }
+            catch ( BindException e )
+            {
+                System.err.println("Getting bind exception - retrying to allocate server");
+                server = null;
+            }
+        }
+    }
+
+    @AfterMethod
+    public void teardown() throws Exception
+    {
+        server.close();
+        server = null;
+    }
+
+    private static class RetryTest implements IRetryAnalyzer
+    {
+        private final AtomicBoolean hasBeenRetried = new AtomicBoolean(false);
+
+        @Override
+        public boolean retry(ITestResult result)
+        {
+            boolean isRetrying = hasBeenRetried.compareAndSet(false, true);
+            if ( isRetrying )
+            {
+                System.err.println(String.format("Waiting " + RETRY_WAIT_MS + " ms and retrying test. Name: %s - TestName: %s ", result.getName(), result.getTestName()));
+                try
+                {
+                    Thread.sleep(RETRY_WAIT_MS);
+                }
+                catch ( InterruptedException e )
+                {
+                    System.err.println(String.format("Retry interrupted. Name: %s - TestName: %s ", result.getName(), result.getTestName()));
+                    Thread.currentThread().interrupt();
+                    isRetrying = false;
+                }
+            }
+            return isRetrying;
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java
----------------------------------------------------------------------
diff --git a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java
index 2193acb..bb70da5 100644
--- a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java
+++ b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperMain.java
@@ -16,6 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
+
 package org.apache.curator.test;
 
 import org.apache.zookeeper.server.ServerCnxnFactory;
@@ -29,10 +30,12 @@ import java.io.IOException;
 import java.lang.reflect.Field;
 import java.nio.channels.ServerSocketChannel;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
 
 public class TestingZooKeeperMain extends ZooKeeperServerMain implements ZooKeeperMainFace
 {
-    private final CountDownLatch        latch = new CountDownLatch(1);
+    private final CountDownLatch latch = new CountDownLatch(1);
+    private final AtomicReference<Exception> startingException = new AtomicReference<Exception>(null);
 
     private static final int MAX_WAIT_MS = 1000;
 
@@ -41,12 +44,12 @@ public class TestingZooKeeperMain extends ZooKeeperServerMain implements ZooKeep
     {
         try
         {
-            Field               cnxnFactoryField = ZooKeeperServerMain.class.getDeclaredField("cnxnFactory");
+            Field cnxnFactoryField = ZooKeeperServerMain.class.getDeclaredField("cnxnFactory");
             cnxnFactoryField.setAccessible(true);
-            ServerCnxnFactory   cnxnFactory = (ServerCnxnFactory)cnxnFactoryField.get(this);
+            ServerCnxnFactory cnxnFactory = (ServerCnxnFactory)cnxnFactoryField.get(this);
             cnxnFactory.closeAll();
 
-            Field               ssField = cnxnFactory.getClass().getDeclaredField("ss");
+            Field ssField = cnxnFactory.getClass().getDeclaredField("ss");
             ssField.setAccessible(true);
             ServerSocketChannel ss = (ServerSocketChannel)ssField.get(cnxnFactory);
             ss.close();
@@ -62,10 +65,18 @@ public class TestingZooKeeperMain extends ZooKeeperServerMain implements ZooKeep
     @Override
     public void runFromConfig(QuorumPeerConfig config) throws Exception
     {
-        ServerConfig        serverConfig = new ServerConfig();
+        ServerConfig serverConfig = new ServerConfig();
         serverConfig.readFrom(config);
         latch.countDown();
-        super.runFromConfig(serverConfig);
+        try
+        {
+            super.runFromConfig(serverConfig);
+        }
+        catch ( IOException e )
+        {
+            startingException.set(e);
+            throw e;
+        }
     }
 
     @Override
@@ -80,13 +91,13 @@ public class TestingZooKeeperMain extends ZooKeeperServerMain implements ZooKeep
     {
         latch.await();
 
-        ServerCnxnFactory   cnxnFactory = getServerConnectionFactory();
+        ServerCnxnFactory cnxnFactory = getServerConnectionFactory();
         if ( cnxnFactory != null )
         {
-            final ZooKeeperServer     zkServer = getZooKeeperServer(cnxnFactory);
+            final ZooKeeperServer zkServer = getZooKeeperServer(cnxnFactory);
             if ( zkServer != null )
             {
-                synchronized ( zkServer )
+                synchronized(zkServer)
                 {
                     if ( !zkServer.isRunning() )
                     {
@@ -95,6 +106,14 @@ public class TestingZooKeeperMain extends ZooKeeperServerMain implements ZooKeep
                 }
             }
         }
+
+        Thread.sleep(1000);
+
+        Exception exception = startingException.get();
+        if ( exception != null )
+        {
+            throw exception;
+        }
     }
 
     @Override
@@ -104,13 +123,13 @@ public class TestingZooKeeperMain extends ZooKeeperServerMain implements ZooKeep
 
         try
         {
-            ServerCnxnFactory   cnxnFactory = getServerConnectionFactory();
+            ServerCnxnFactory cnxnFactory = getServerConnectionFactory();
             if ( cnxnFactory != null )
             {
-                ZooKeeperServer     zkServer = getZooKeeperServer(cnxnFactory);
+                ZooKeeperServer zkServer = getZooKeeperServer(cnxnFactory);
                 if ( zkServer != null )
                 {
-                    ZKDatabase      zkDb = zkServer.getZKDatabase();
+                    ZKDatabase zkDb = zkServer.getZKDatabase();
                     if ( zkDb != null )
                     {
                         // make ZK server close its log files
@@ -127,9 +146,9 @@ public class TestingZooKeeperMain extends ZooKeeperServerMain implements ZooKeep
 
     private ServerCnxnFactory getServerConnectionFactory() throws Exception
     {
-        Field               cnxnFactoryField = ZooKeeperServerMain.class.getDeclaredField("cnxnFactory");
+        Field cnxnFactoryField = ZooKeeperServerMain.class.getDeclaredField("cnxnFactory");
         cnxnFactoryField.setAccessible(true);
-        ServerCnxnFactory   cnxnFactory;
+        ServerCnxnFactory cnxnFactory;
 
         // Wait until the cnxnFactory field is non-null or up to 1s, whichever comes first.
         long startTime = System.currentTimeMillis();
@@ -144,9 +163,9 @@ public class TestingZooKeeperMain extends ZooKeeperServerMain implements ZooKeep
 
     private ZooKeeperServer getZooKeeperServer(ServerCnxnFactory cnxnFactory) throws Exception
     {
-        Field               zkServerField = ServerCnxnFactory.class.getDeclaredField("zkServer");
+        Field zkServerField = ServerCnxnFactory.class.getDeclaredField("zkServer");
         zkServerField.setAccessible(true);
-        ZooKeeperServer     zkServer;
+        ZooKeeperServer zkServer;
 
         // Wait until the zkServer field is non-null or up to 1s, whichever comes first.
         long startTime = System.currentTimeMillis();

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperServer.java
----------------------------------------------------------------------
diff --git a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperServer.java b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperServer.java
index be1a1b6..e706847 100644
--- a/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperServer.java
+++ b/curator-test/src/main/java/org/apache/curator/test/TestingZooKeeperServer.java
@@ -135,7 +135,7 @@ public class TestingZooKeeperServer extends QuorumPeerMain implements Closeable
                     }
                     catch ( Exception e )
                     {
-                        logger.error(String.format("From testing server (random state: %s)", String.valueOf(configBuilder.isFromRandom())), e);
+                        logger.error(String.format("From testing server (random state: %s) for instance: %s", String.valueOf(configBuilder.isFromRandom()), getInstanceSpec()), e);
                     }
                 }
             }

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceCache.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceCache.java b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceCache.java
index d1dc3bd..be114d4 100644
--- a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceCache.java
+++ b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceCache.java
@@ -19,6 +19,7 @@
 package org.apache.curator.x.discovery;
 
 import com.google.common.collect.Lists;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
@@ -37,14 +38,12 @@ import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
-public class TestServiceCache
+public class TestServiceCache extends BaseClassForTests
 {
     @Test
     public void     testInitialLoad() throws Exception
     {
         List<Closeable> closeables = Lists.newArrayList();
-        TestingServer server = new TestingServer();
-        closeables.add(server);
         try
         {
             CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
@@ -106,8 +105,6 @@ public class TestServiceCache
         Timing timing = new Timing();
 
         List<Closeable> closeables = Lists.newArrayList();
-        TestingServer server = new TestingServer();
-        closeables.add(server);
         try
         {
             CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
@@ -155,8 +152,6 @@ public class TestServiceCache
     public void     testUpdate() throws Exception
     {
         List<Closeable>     closeables = Lists.newArrayList();
-        TestingServer       server = new TestingServer();
-        closeables.add(server);
         try
         {
             CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
@@ -209,8 +204,6 @@ public class TestServiceCache
     public void testCache() throws Exception
     {
         List<Closeable> closeables = Lists.newArrayList();
-        TestingServer server = new TestingServer();
-        closeables.add(server);
         try
         {
             CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));

http://git-wip-us.apache.org/repos/asf/curator/blob/351c67c9/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
index b615c74..354b88a 100644
--- a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
+++ b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/TestServiceDiscovery.java
@@ -20,6 +20,7 @@ package org.apache.curator.x.discovery;
 
 import com.google.common.collect.Lists;
 import com.google.common.collect.Sets;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
@@ -38,7 +39,7 @@ import java.util.Comparator;
 import java.util.List;
 import java.util.concurrent.Semaphore;
 
-public class TestServiceDiscovery
+public class TestServiceDiscovery extends BaseClassForTests
 {
     private static final Comparator<ServiceInstance<Void>>      comparator = new Comparator<ServiceInstance<Void>>()
     {
@@ -53,8 +54,6 @@ public class TestServiceDiscovery
     public void         testCrashedServerMultiInstances() throws Exception
     {
         List<Closeable>     closeables = Lists.newArrayList();
-        TestingServer       server = new TestingServer();
-        closeables.add(server);
         try
         {
             Timing              timing = new Timing();
@@ -103,8 +102,6 @@ public class TestServiceDiscovery
     public void         testCrashedServer() throws Exception
     {
         List<Closeable>     closeables = Lists.newArrayList();
-        TestingServer       server = new TestingServer();
-        closeables.add(server);
         try
         {
             Timing              timing = new Timing();
@@ -151,8 +148,6 @@ public class TestServiceDiscovery
     public void         testCrashedInstance() throws Exception
     {
         List<Closeable>     closeables = Lists.newArrayList();
-        TestingServer       server = new TestingServer();
-        closeables.add(server);
         try
         {
             Timing              timing = new Timing();
@@ -190,8 +185,6 @@ public class TestServiceDiscovery
         final String        SERVICE_TWO = "two";
 
         List<Closeable>     closeables = Lists.newArrayList();
-        TestingServer       server = new TestingServer();
-        closeables.add(server);
         try
         {
             CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
@@ -245,8 +238,6 @@ public class TestServiceDiscovery
     public void         testBasic() throws Exception
     {
         List<Closeable>     closeables = Lists.newArrayList();
-        TestingServer       server = new TestingServer();
-        closeables.add(server);
         try
         {
             CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));


[25/29] git commit: use getData() instead of exists() to avoid leaving unneeded watchers which is a type of resource leak

Posted by ra...@apache.org.
use getData() instead of exists() to avoid leaving unneeded watchers which is a type of resource leak


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/91d65037
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/91d65037
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/91d65037

Branch: refs/heads/CURATOR-105
Commit: 91d65037bf28947b5b28b75ec83614bb70a3e12a
Parents: 290186a
Author: randgalt <ra...@apache.org>
Authored: Fri May 23 07:47:56 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Fri May 23 07:47:56 2014 -0500

----------------------------------------------------------------------
 .../org/apache/curator/framework/recipes/leader/LeaderLatch.java  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/91d65037/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java
index ecdd903..88456af 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/leader/LeaderLatch.java
@@ -519,7 +519,8 @@ public class LeaderLatch implements Closeable
                     }
                 }
             };
-            client.checkExists().usingWatcher(watcher).inBackground(callback).forPath(ZKPaths.makePath(latchPath, watchPath));
+            // use getData() instead of exists() to avoid leaving unneeded watchers which is a type of resource leak
+            client.getData().usingWatcher(watcher).inBackground(callback).forPath(ZKPaths.makePath(latchPath, watchPath));
         }
     }
 


[27/29] git commit: Merge branch 'master' into CURATOR-105

Posted by ra...@apache.org.
Merge branch 'master' into CURATOR-105

Conflicts:
	curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/0bffdb02
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/0bffdb02
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/0bffdb02

Branch: refs/heads/CURATOR-105
Commit: 0bffdb020d78d8c6599a1eb9c2c702f9dd1192bd
Parents: a0fe6ae 0dcf833
Author: randgalt <ra...@apache.org>
Authored: Fri May 23 09:46:02 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Fri May 23 09:46:02 2014 -0500

----------------------------------------------------------------------
 curator-client/pom.xml                          |   1 -
 .../org/apache/curator/utils/DebugUtils.java    |   1 +
 .../org/apache/curator/BaseClassForTests.java   |  42 ---
 .../java/org/apache/curator/BasicTests.java     |   1 +
 .../java/org/apache/curator/TestRetryLoop.java  |   1 +
 .../curator/TestSessionFailRetryLoop.java       |   3 +-
 .../TestExhibitorEnsembleProvider.java          |   9 +-
 curator-examples/pom.xml                        |   6 -
 curator-framework/pom.xml                       |   1 -
 .../framework/imps/CuratorFrameworkImpl.java    |  36 ++-
 .../framework/imps/BaseClassForTests.java       |  49 ----
 .../curator/framework/imps/TestCompression.java |   1 +
 .../framework/imps/TestFailedDeleteManager.java |   1 +
 .../curator/framework/imps/TestFramework.java   |   1 +
 .../framework/imps/TestFrameworkBackground.java |   1 +
 .../framework/imps/TestFrameworkEdges.java      |  26 +-
 .../curator/framework/imps/TestMultiClient.java |   1 +
 .../framework/imps/TestNamespaceFacade.java     |   1 +
 .../framework/imps/TestTempFramework.java       |   1 +
 .../framework/imps/TestTransactions.java        |   1 +
 .../framework/imps/TestWatcherIdentity.java     |   1 +
 curator-recipes/pom.xml                         |   1 -
 .../recipes/cache/PathChildrenCache.java        |  32 +--
 .../framework/recipes/leader/LeaderLatch.java   |   3 +-
 .../framework/recipes/locks/LockInternals.java  |  13 +-
 .../framework/client/TestBackgroundStates.java  |   9 +-
 ...estResetConnectionWithBackgroundFailure.java |  16 +-
 .../framework/recipes/BaseClassForTests.java    |  42 ---
 .../recipes/atomic/TestCachedAtomicCounter.java |   2 +-
 .../atomic/TestDistributedAtomicLong.java       |   2 +-
 .../barriers/TestDistributedBarrier.java        |   2 +-
 .../barriers/TestDistributedDoubleBarrier.java  |   2 +-
 .../framework/recipes/cache/TestNodeCache.java  |   2 +-
 .../recipes/cache/TestPathChildrenCache.java    |  76 +++---
 .../recipes/leader/TestLeaderLatch.java         |   2 +-
 .../recipes/leader/TestLeaderSelector.java      |   2 +-
 .../recipes/leader/TestLeaderSelectorEdges.java |   2 +-
 .../leader/TestLeaderSelectorParticipants.java  |   2 +-
 .../leader/TestLeaderSelectorWithExecutor.java  |   2 +-
 .../recipes/locks/TestChildReaper.java          |   2 +-
 .../locks/TestInterProcessMutexBase.java        |   2 +-
 .../locks/TestInterProcessReadWriteLock.java    |   2 +-
 .../locks/TestInterProcessSemaphore.java        |  36 ++-
 .../locks/TestInterProcessSemaphoreCluster.java |   4 +-
 .../framework/recipes/locks/TestLockACLs.java   |   2 +-
 .../locks/TestLockCleanlinessWithFaults.java    |   6 +-
 .../framework/recipes/locks/TestReaper.java     |   6 +-
 .../nodes/TestPersistentEphemeralNode.java      |  39 ++-
 .../TestPersistentEphemeralNodeListener.java    |   9 +-
 .../queue/TestBoundedDistributedQueue.java      |   8 +-
 .../queue/TestDistributedDelayQueue.java        |   2 +-
 .../recipes/queue/TestDistributedIdQueue.java   |   2 +-
 .../queue/TestDistributedPriorityQueue.java     |   2 +-
 .../recipes/queue/TestDistributedQueue.java     |   2 +-
 .../recipes/queue/TestQueueSharder.java         |   8 +-
 .../queue/TestSimpleDistributedQueue.java       |   2 +-
 .../recipes/shared/TestSharedCount.java         |   2 +-
 curator-test/pom.xml                            |   9 +-
 .../apache/curator/test/BaseClassForTests.java  |  98 +++++++
 .../curator/test/TestingZooKeeperMain.java      |  51 ++--
 .../curator/test/TestingZooKeeperServer.java    |   2 +-
 curator-x-discovery-server/pom.xml              |  24 --
 .../contexts/GenericDiscoveryContext.java       |  20 +-
 .../server/contexts/MapDiscoveryContext.java    |   4 +-
 .../server/jetty_jersey/TestMapsWithJersey.java |   2 +-
 .../TestObjectPayloadWithJersey.java            |  34 +--
 .../jetty_jersey/TestStringsWithJersey.java     |  18 +-
 .../jetty_resteasy/TestStringsWithRestEasy.java |   2 +-
 curator-x-discovery/pom.xml                     |   2 -
 .../curator/x/discovery/TestServiceCache.java   |  11 +-
 .../x/discovery/TestServiceDiscovery.java       |  13 +-
 .../apache/curator/x/discovery/TestUriSpec.java |   2 +-
 pom.xml                                         | 273 +++++++++++++++----
 73 files changed, 631 insertions(+), 467 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/0bffdb02/curator-framework/src/main/java/org/apache/curator/framework/imps/CuratorFrameworkImpl.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/curator/blob/0bffdb02/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/PathChildrenCache.java
----------------------------------------------------------------------


[14/29] git commit: Added more timing to tests

Posted by ra...@apache.org.
Added more timing to tests


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/5dbd6729
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/5dbd6729
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/5dbd6729

Branch: refs/heads/CURATOR-105
Commit: 5dbd6729092dec76fa6939fe35027fbb6a7ddae0
Parents: de71564
Author: randgalt <ra...@apache.org>
Authored: Thu May 15 14:32:38 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 15 14:32:38 2014 -0500

----------------------------------------------------------------------
 .../curator/framework/recipes/locks/TestInterProcessSemaphore.java  | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/5dbd6729/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
index f6956ff..559b012 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
@@ -410,6 +410,7 @@ public class TestInterProcessSemaphore extends BaseClassForTests
     {
         final int THREAD_QTY = 10;
 
+        Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try


[29/29] git commit: Leave this tester around for future use

Posted by ra...@apache.org.
Leave this tester around for future use


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/07db9f6c
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/07db9f6c
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/07db9f6c

Branch: refs/heads/CURATOR-105
Commit: 07db9f6c1c4593840cc9ed5188bf520e257d54d6
Parents: 9b9b9ae
Author: randgalt <ra...@apache.org>
Authored: Fri May 23 10:06:50 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Fri May 23 10:06:50 2014 -0500

----------------------------------------------------------------------
 .../apache/curator/x/discovery/ServiceCacheLeakTester.java   | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/07db9f6c/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTester.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTester.java b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTester.java
index b4e08d1..ca3f76a 100644
--- a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTester.java
+++ b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/ServiceCacheLeakTester.java
@@ -6,12 +6,10 @@ import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.x.discovery.strategies.RandomStrategy;
-import org.testng.annotations.Test;
 
 public class ServiceCacheLeakTester
 {
-    @Test
-    public void serviceCacheInstancesLeaked() throws Exception
+    public static void main(String[] args) throws Exception
     {
         TestingServer testingServer = new TestingServer();
 
@@ -33,7 +31,7 @@ public class ServiceCacheLeakTester
         }
     }
 
-    private void doWork(CuratorFramework curatorFramework) throws Exception
+    private static void doWork(CuratorFramework curatorFramework) throws Exception
     {
         ServiceInstance<Void> thisInstance = ServiceInstance.<Void>builder().name("myservice").build();
         final ServiceDiscovery<Void> serviceDiscovery = ServiceDiscoveryBuilder.builder(Void.class).client(curatorFramework.usingNamespace("dev")).basePath("/instances").thisInstance(thisInstance).build();
@@ -54,7 +52,7 @@ public class ServiceCacheLeakTester
         }
     }
 
-    private ServiceProvider<Void> serviceProvider(ServiceDiscovery<Void> serviceDiscovery, String name) throws Exception
+    private static ServiceProvider<Void> serviceProvider(ServiceDiscovery<Void> serviceDiscovery, String name) throws Exception
     {
         return serviceDiscovery.serviceProviderBuilder().serviceName(name).providerStrategy(new RandomStrategy<Void>()).build();
     }


[13/29] git commit: Added more timing to tests

Posted by ra...@apache.org.
Added more timing to tests


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/de71564c
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/de71564c
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/de71564c

Branch: refs/heads/CURATOR-105
Commit: de71564cfbda114dbf87cbaa4af96f074354675a
Parents: 0ba5de3
Author: randgalt <ra...@apache.org>
Authored: Thu May 15 14:32:29 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 15 14:32:29 2014 -0500

----------------------------------------------------------------------
 .../recipes/locks/TestInterProcessSemaphore.java  | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/de71564c/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
index e3e75a1..f6956ff 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/locks/TestInterProcessSemaphore.java
@@ -117,8 +117,8 @@ public class TestInterProcessSemaphore extends BaseClassForTests
         InterProcessSemaphoreV2 semaphore2;
         try
         {
-            client1 = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
-            client2 = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+            client1 = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
+            client2 = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
 
             client1.start();
             client2.start();
@@ -270,7 +270,7 @@ public class TestInterProcessSemaphore extends BaseClassForTests
                         @Override
                         public Object call() throws Exception
                         {
-                            CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+                            CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
                             client.start();
                             try
                             {
@@ -324,7 +324,7 @@ public class TestInterProcessSemaphore extends BaseClassForTests
         final int MAX_LEASES = 11;
         final int THREADS = 100;
 
-        final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -390,6 +390,7 @@ public class TestInterProcessSemaphore extends BaseClassForTests
                 completionService.take();
             }
 
+            timing.sleepABit();
             synchronized(counter)
             {
                 Assert.assertTrue(counter.currentCount == 0);
@@ -409,7 +410,7 @@ public class TestInterProcessSemaphore extends BaseClassForTests
     {
         final int THREAD_QTY = 10;
 
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -451,7 +452,7 @@ public class TestInterProcessSemaphore extends BaseClassForTests
     public void testSimple() throws Exception
     {
         Timing timing = new Timing();
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -471,7 +472,7 @@ public class TestInterProcessSemaphore extends BaseClassForTests
         final int MAX_LEASES = 3;
         Timing timing = new Timing();
 
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -502,7 +503,8 @@ public class TestInterProcessSemaphore extends BaseClassForTests
     {
         final int LEASES = 3;
 
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        Timing timing = new Timing();
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {


[05/29] git commit: Merge branch 'master' into CURATOR-96

Posted by ra...@apache.org.
Merge branch 'master' into CURATOR-96

Conflicts:
	pom.xml


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/449eeff5
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/449eeff5
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/449eeff5

Branch: refs/heads/CURATOR-105
Commit: 449eeff54377a2dd0ab8f06d72b678aa877d97cc
Parents: 43cfb8f 0f7acf7
Author: randgalt <ra...@apache.org>
Authored: Mon Apr 21 17:44:07 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Apr 21 17:44:07 2014 -0500

----------------------------------------------------------------------
 curator-client/pom.xml                          |   4 +-
 .../apache/curator/CuratorZookeeperClient.java  |   2 +
 .../main/java/org/apache/curator/RetryLoop.java |   6 +-
 .../apache/curator/SessionFailRetryLoop.java    |  11 +-
 .../apache/curator/utils/CloseableUtils.java    |   4 +-
 .../org/apache/curator/utils/EnsurePath.java    |  10 +-
 curator-examples/pom.xml                        |   2 +-
 curator-framework/pom.xml                       |   4 +-
 .../curator/framework/CuratorFramework.java     |   2 +-
 .../curator/framework/api/CreateBuilder.java    |   4 +-
 .../api/transaction/CuratorTransaction.java     |  16 +--
 .../transaction/CuratorTransactionResult.java   |   4 +-
 curator-recipes/pom.xml                         |   4 +-
 .../framework/recipes/cache/ChildData.java      |   4 +-
 .../recipes/cache/PathChildrenCache.java        |  11 +-
 .../framework/recipes/leader/LeaderLatch.java   |  38 ++++---
 .../recipes/leader/LeaderSelector.java          |  68 ++++++-------
 .../recipes/locks/InterProcessLock.java         |  13 +--
 .../recipes/locks/InterProcessMutex.java        |   4 +-
 .../locks/InterProcessReadWriteLock.java        |   6 +-
 .../recipes/locks/InterProcessSemaphoreV2.java  |   8 --
 .../recipes/nodes/PersistentEphemeralNode.java  |   1 -
 .../framework/recipes/queue/ChildrenCache.java  |   6 +-
 .../recipes/queue/DistributedDelayQueue.java    |   4 +-
 .../recipes/queue/DistributedIdQueue.java       |   2 +-
 .../recipes/queue/DistributedPriorityQueue.java |   4 +-
 .../recipes/queue/DistributedQueue.java         |  16 ++-
 .../recipes/leader/TestLeaderSelector.java      | 101 +++++++++++++++++++
 curator-test/pom.xml                            |   4 +-
 curator-x-discovery-server/pom.xml              |   4 +-
 .../server/rest/DiscoveryResource.java          |   4 +-
 curator-x-discovery/pom.xml                     |   4 +-
 .../curator/x/discovery/ServiceDiscovery.java   |   1 -
 .../discovery/details/ServiceDiscoveryImpl.java |   1 -
 pom.xml                                         |   4 +-
 35 files changed, 240 insertions(+), 141 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/449eeff5/curator-client/pom.xml
----------------------------------------------------------------------
diff --cc curator-client/pom.xml
index 5fd7d67,88948b5..04cce79
--- a/curator-client/pom.xml
+++ b/curator-client/pom.xml
@@@ -24,11 -24,12 +24,11 @@@
      <parent>
          <groupId>org.apache.curator</groupId>
          <artifactId>apache-curator</artifactId>
-         <version>2.4.2-SNAPSHOT</version>
+         <version>2.4.3-SNAPSHOT</version>
      </parent>
  
 -    <groupId>org.apache.curator</groupId>
      <artifactId>curator-client</artifactId>
-     <version>2.4.2-SNAPSHOT</version>
+     <version>2.4.3-SNAPSHOT</version>
      <packaging>bundle</packaging>
  
      <name>Curator Client</name>

http://git-wip-us.apache.org/repos/asf/curator/blob/449eeff5/curator-examples/pom.xml
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/curator/blob/449eeff5/curator-framework/pom.xml
----------------------------------------------------------------------
diff --cc curator-framework/pom.xml
index 162e557,4703b1a..1b95c31
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@@ -24,11 -24,12 +24,11 @@@
      <parent>
          <groupId>org.apache.curator</groupId>
          <artifactId>apache-curator</artifactId>
-         <version>2.4.2-SNAPSHOT</version>
+         <version>2.4.3-SNAPSHOT</version>
      </parent>
  
 -    <groupId>org.apache.curator</groupId>
      <artifactId>curator-framework</artifactId>
-     <version>2.4.2-SNAPSHOT</version>
+     <version>2.4.3-SNAPSHOT</version>
      <packaging>bundle</packaging>
  
      <name>Curator Framework</name>

http://git-wip-us.apache.org/repos/asf/curator/blob/449eeff5/curator-recipes/pom.xml
----------------------------------------------------------------------
diff --cc curator-recipes/pom.xml
index 5fe9a31,9a7bcdf..77069a1
--- a/curator-recipes/pom.xml
+++ b/curator-recipes/pom.xml
@@@ -24,11 -24,12 +24,11 @@@
      <parent>
          <groupId>org.apache.curator</groupId>
          <artifactId>apache-curator</artifactId>
-         <version>2.4.2-SNAPSHOT</version>
+         <version>2.4.3-SNAPSHOT</version>
      </parent>
  
 -    <groupId>org.apache.curator</groupId>
      <artifactId>curator-recipes</artifactId>
-     <version>2.4.2-SNAPSHOT</version>
+     <version>2.4.3-SNAPSHOT</version>
      <packaging>bundle</packaging>
  
      <name>Curator Recipes</name>

http://git-wip-us.apache.org/repos/asf/curator/blob/449eeff5/curator-test/pom.xml
----------------------------------------------------------------------
diff --cc curator-test/pom.xml
index 83d3329,91828e4..86ffd46
--- a/curator-test/pom.xml
+++ b/curator-test/pom.xml
@@@ -24,11 -24,12 +24,11 @@@
      <parent>
          <groupId>org.apache.curator</groupId>
          <artifactId>apache-curator</artifactId>
-         <version>2.4.2-SNAPSHOT</version>
+         <version>2.4.3-SNAPSHOT</version>
      </parent>
  
 -    <groupId>org.apache.curator</groupId>
      <artifactId>curator-test</artifactId>
-     <version>2.4.2-SNAPSHOT</version>
+     <version>2.4.3-SNAPSHOT</version>
  
      <name>Curator Testing</name>
      <description>Unit testing utilities.</description>

http://git-wip-us.apache.org/repos/asf/curator/blob/449eeff5/curator-x-discovery-server/pom.xml
----------------------------------------------------------------------
diff --cc curator-x-discovery-server/pom.xml
index 6a3b96b,8523e49..418afeb
--- a/curator-x-discovery-server/pom.xml
+++ b/curator-x-discovery-server/pom.xml
@@@ -24,11 -24,12 +24,11 @@@
      <parent>
          <groupId>org.apache.curator</groupId>
          <artifactId>apache-curator</artifactId>
-         <version>2.4.2-SNAPSHOT</version>
+         <version>2.4.3-SNAPSHOT</version>
      </parent>
  
 -    <groupId>org.apache.curator</groupId>
      <artifactId>curator-x-discovery-server</artifactId>
-     <version>2.4.2-SNAPSHOT</version>
+     <version>2.4.3-SNAPSHOT</version>
      <packaging>bundle</packaging>
  
      <name>Curator Service Discovery Server</name>

http://git-wip-us.apache.org/repos/asf/curator/blob/449eeff5/curator-x-discovery/pom.xml
----------------------------------------------------------------------
diff --cc curator-x-discovery/pom.xml
index fc54b49,2ecd301..57bc598
--- a/curator-x-discovery/pom.xml
+++ b/curator-x-discovery/pom.xml
@@@ -24,11 -24,12 +24,11 @@@
      <parent>
          <groupId>org.apache.curator</groupId>
          <artifactId>apache-curator</artifactId>
-         <version>2.4.2-SNAPSHOT</version>
+         <version>2.4.3-SNAPSHOT</version>
      </parent>
  
 -    <groupId>org.apache.curator</groupId>
      <artifactId>curator-x-discovery</artifactId>
-     <version>2.4.2-SNAPSHOT</version>
+     <version>2.4.3-SNAPSHOT</version>
      <packaging>bundle</packaging>
  
      <name>Curator Service Discovery</name>

http://git-wip-us.apache.org/repos/asf/curator/blob/449eeff5/pom.xml
----------------------------------------------------------------------


[20/29] git commit: Catch no node exception

Posted by ra...@apache.org.
Catch no node exception


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c9716499
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c9716499
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c9716499

Branch: refs/heads/CURATOR-105
Commit: c9716499642b2dd4a0d77e5df6f9b84e8dfc90d0
Parents: 8a94985
Author: Dominic Wong <do...@hailocab.com>
Authored: Wed May 21 13:40:39 2014 +0100
Committer: Dominic Wong <do...@hailocab.com>
Committed: Wed May 21 13:40:39 2014 +0100

----------------------------------------------------------------------
 .../framework/recipes/locks/LockInternals.java  | 42 +++++++++++++-------
 1 file changed, 27 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/c9716499/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
index 4b0d085..c66e4d1 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
@@ -295,29 +295,41 @@ public class LockInternals
 
                     synchronized(this)
                     {
-                        byte[] data = client.getData().usingWatcher(watcher).forPath(previousSequencePath);
-                        if ( data != null )
+                        try 
                         {
-                            if ( millisToWait != null )
+                            byte[] data = client.getData().usingWatcher(watcher).forPath(previousSequencePath);
+                            if ( data != null )
                             {
-                                millisToWait -= (System.currentTimeMillis() - startMillis);
-                                startMillis = System.currentTimeMillis();
-                                if ( millisToWait <= 0 )
+                                if ( millisToWait != null )
                                 {
-                                    doDelete = true;    // timed out - delete our node
-                                    break;
-                                }
+                                    millisToWait -= (System.currentTimeMillis() - startMillis);
+                                    startMillis = System.currentTimeMillis();
+                                    if ( millisToWait <= 0 )
+                                    {
+                                        doDelete = true;    // timed out - delete our node
+                                        break;
+                                    }
 
-                                wait(millisToWait);
-                            }
-                            else
-                            {
-                                wait();
+                                    wait(millisToWait);
+                                }
+                                else
+                                {
+                                    wait();
+                                }
                             }
                         }
+                        catch ( KeeperException.NoNodeException e ) 
+                        {
+                            // ignore - clearly already deleted
+                        }
+                        catch ( Exception e) 
+                        {
+                            // bubble it up
+                            throw e;
+                        }
                     }
-                    // else it may have been deleted (i.e. lock released). Try to acquire again
                 }
+                // else it may have been deleted (i.e. lock released). Try to acquire again
             }
         }
         catch ( Exception e )


[24/29] git commit: comment udpate

Posted by ra...@apache.org.
comment udpate


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/290186af
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/290186af
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/290186af

Branch: refs/heads/CURATOR-105
Commit: 290186af13dca06fd15868b422583dfdae5b594e
Parents: 4e548a2
Author: randgalt <ra...@apache.org>
Authored: Fri May 23 07:47:30 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Fri May 23 07:47:30 2014 -0500

----------------------------------------------------------------------
 .../org/apache/curator/framework/recipes/locks/LockInternals.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/290186af/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
index 812cfd8..706b242 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
@@ -296,7 +296,7 @@ public class LockInternals
                     {
                         try 
                         {
-                            // use getData instead of exists to avoid leaving unneeded watchers which is a type of resource leak
+                            // use getData() instead of exists() to avoid leaving unneeded watchers which is a type of resource leak
                             client.getData().usingWatcher(watcher).forPath(previousSequencePath);
                             if ( millisToWait != null )
                             {


[12/29] git commit: Added timing to tests

Posted by ra...@apache.org.
Added timing to tests


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/0ba5de39
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/0ba5de39
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/0ba5de39

Branch: refs/heads/CURATOR-105
Commit: 0ba5de39a809e23dc020faf8f28f1e70b1f24676
Parents: e04eb47
Author: randgalt <ra...@apache.org>
Authored: Thu May 15 14:03:56 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 15 14:03:56 2014 -0500

----------------------------------------------------------------------
 .../recipes/cache/TestPathChildrenCache.java    | 74 +++++++++++---------
 1 file changed, 42 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/0ba5de39/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
index 7e7ae42..679d180 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestPathChildrenCache.java
@@ -19,7 +19,6 @@
 package org.apache.curator.framework.recipes.cache;
 
 import com.google.common.collect.Lists;
-import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.api.UnhandledErrorListener;
@@ -27,6 +26,7 @@ import org.apache.curator.framework.recipes.BaseClassForTests;
 import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.KillSession;
 import org.apache.curator.test.Timing;
+import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.testng.Assert;
@@ -78,8 +78,9 @@ public class TestPathChildrenCache extends BaseClassForTests
     @Test
     public void testAsyncInitialPopulation() throws Exception
     {
+        Timing timing = new Timing();
         PathChildrenCache cache = null;
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         try
         {
             client.start();
@@ -102,10 +103,10 @@ public class TestPathChildrenCache extends BaseClassForTests
                 );
             cache.start(PathChildrenCache.StartMode.POST_INITIALIZED_EVENT);
 
-            PathChildrenCacheEvent event = events.poll(10, TimeUnit.SECONDS);
+            PathChildrenCacheEvent event = events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS);
             Assert.assertEquals(event.getType(), PathChildrenCacheEvent.Type.CHILD_ADDED);
 
-            event = events.poll(10, TimeUnit.SECONDS);
+            event = events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS);
             Assert.assertEquals(event.getType(), PathChildrenCacheEvent.Type.INITIALIZED);
             Assert.assertEquals(event.getInitialData().size(), 1);
         }
@@ -220,7 +221,7 @@ public class TestPathChildrenCache extends BaseClassForTests
     {
         Timing timing = new Timing();
 
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -246,7 +247,8 @@ public class TestPathChildrenCache extends BaseClassForTests
     @Test
     public void testDeleteThenCreate() throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        Timing timing = new Timing();
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -299,10 +301,10 @@ public class TestPathChildrenCache extends BaseClassForTests
             cache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
 
             client.delete().forPath("/test/foo");
-            Assert.assertTrue(removedLatch.await(10, TimeUnit.SECONDS));
+            Assert.assertTrue(timing.awaitLatch(removedLatch));
             client.create().forPath("/test/foo", "two".getBytes());
             postRemovedLatch.countDown();
-            Assert.assertTrue(dataLatch.await(10, TimeUnit.SECONDS));
+            Assert.assertTrue(timing.awaitLatch(dataLatch));
 
             Throwable t = error.get();
             if ( t != null )
@@ -321,7 +323,8 @@ public class TestPathChildrenCache extends BaseClassForTests
     @Test
     public void testRebuildAgainstOtherProcesses() throws Exception
     {
-        final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        Timing timing = new Timing();
+        final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -398,7 +401,7 @@ public class TestPathChildrenCache extends BaseClassForTests
             cache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
             future.get();
 
-            Assert.assertTrue(addedLatch.await(10, TimeUnit.SECONDS));
+            Assert.assertTrue(timing.awaitLatch(addedLatch));
             Assert.assertNotNull(cache.getCurrentData("/test/test"));
             Assert.assertNull(cache.getCurrentData(deletedPath.get()));
             Assert.assertEquals(cache.getCurrentData("/test/snafu").getData(), "grilled".getBytes());
@@ -415,7 +418,8 @@ public class TestPathChildrenCache extends BaseClassForTests
     @Test
     public void testIssue27() throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        Timing timing = new Timing();
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -443,13 +447,13 @@ public class TestPathChildrenCache extends BaseClassForTests
                 );
             cache.start();
 
-            Assert.assertTrue(semaphore.tryAcquire(3, 10, TimeUnit.SECONDS));
+            Assert.assertTrue(timing.acquireSemaphore(semaphore, 3));
 
             client.delete().forPath("/base/a");
-            Assert.assertTrue(semaphore.tryAcquire(1, 10, TimeUnit.SECONDS));
+            Assert.assertTrue(timing.acquireSemaphore(semaphore, 1));
 
             client.create().forPath("/base/a");
-            Assert.assertTrue(semaphore.tryAcquire(1, 10, TimeUnit.SECONDS));
+            Assert.assertTrue(timing.acquireSemaphore(semaphore, 1));
 
             List<PathChildrenCacheEvent.Type> expected = Lists.newArrayList
                 (
@@ -471,7 +475,8 @@ public class TestPathChildrenCache extends BaseClassForTests
     @Test
     public void testIssue27Alt() throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        Timing timing = new Timing();
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -500,10 +505,10 @@ public class TestPathChildrenCache extends BaseClassForTests
             cache.start(PathChildrenCache.StartMode.BUILD_INITIAL_CACHE);
 
             client.delete().forPath("/base/a");
-            Assert.assertTrue(semaphore.tryAcquire(1, 10, TimeUnit.SECONDS));
+            Assert.assertTrue(timing.acquireSemaphore(semaphore, 1));
 
             client.create().forPath("/base/a");
-            Assert.assertTrue(semaphore.tryAcquire(1, 10, TimeUnit.SECONDS));
+            Assert.assertTrue(timing.acquireSemaphore(semaphore, 1));
 
             List<PathChildrenCacheEvent.Type> expected = Lists.newArrayList
                 (
@@ -580,7 +585,8 @@ public class TestPathChildrenCache extends BaseClassForTests
     @Test
     public void testModes() throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        Timing timing = new Timing();
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -603,8 +609,9 @@ public class TestPathChildrenCache extends BaseClassForTests
     @Test
     public void testRebuildNode() throws Exception
     {
+        Timing timing = new Timing();
         PathChildrenCache cache = null;
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -688,7 +695,8 @@ public class TestPathChildrenCache extends BaseClassForTests
     @Test
     public void testBasics() throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        Timing timing = new Timing();
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -713,14 +721,14 @@ public class TestPathChildrenCache extends BaseClassForTests
             cache.start();
 
             client.create().forPath("/test/one", "hey there".getBytes());
-            Assert.assertEquals(events.poll(10, TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_ADDED);
+            Assert.assertEquals(events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_ADDED);
 
             client.setData().forPath("/test/one", "sup!".getBytes());
-            Assert.assertEquals(events.poll(10, TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_UPDATED);
+            Assert.assertEquals(events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_UPDATED);
             Assert.assertEquals(new String(cache.getCurrentData("/test/one").getData()), "sup!");
 
             client.delete().forPath("/test/one");
-            Assert.assertEquals(events.poll(10, TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_REMOVED);
+            Assert.assertEquals(events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_REMOVED);
 
             cache.close();
         }
@@ -733,7 +741,8 @@ public class TestPathChildrenCache extends BaseClassForTests
     @Test
     public void testBasicsOnTwoCachesWithSameExecutor() throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        Timing timing = new Timing();
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -776,18 +785,18 @@ public class TestPathChildrenCache extends BaseClassForTests
             cache2.start();
 
             client.create().forPath("/test/one", "hey there".getBytes());
-            Assert.assertEquals(events.poll(10, TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_ADDED);
-            Assert.assertEquals(events2.poll(10, TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_ADDED);
+            Assert.assertEquals(events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_ADDED);
+            Assert.assertEquals(events2.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_ADDED);
 
             client.setData().forPath("/test/one", "sup!".getBytes());
-            Assert.assertEquals(events.poll(10, TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_UPDATED);
-            Assert.assertEquals(events2.poll(10, TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_UPDATED);
+            Assert.assertEquals(events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_UPDATED);
+            Assert.assertEquals(events2.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_UPDATED);
             Assert.assertEquals(new String(cache.getCurrentData("/test/one").getData()), "sup!");
             Assert.assertEquals(new String(cache2.getCurrentData("/test/one").getData()), "sup!");
 
             client.delete().forPath("/test/one");
-            Assert.assertEquals(events.poll(10, TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_REMOVED);
-            Assert.assertEquals(events2.poll(10, TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_REMOVED);
+            Assert.assertEquals(events.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_REMOVED);
+            Assert.assertEquals(events2.poll(timing.forWaiting().seconds(), TimeUnit.SECONDS), PathChildrenCacheEvent.Type.CHILD_REMOVED);
 
             cache.close();
             cache2.close();
@@ -802,7 +811,8 @@ public class TestPathChildrenCache extends BaseClassForTests
     public void testDeleteNodeAfterCloseDoesntCallExecutor()
             throws Exception
     {
-        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), new RetryOneTime(1));
+        Timing timing = new Timing();
+        CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
         try
         {
@@ -823,7 +833,7 @@ public class TestPathChildrenCache extends BaseClassForTests
             Assert.assertFalse(exec.isExecuteCalled());
 
             client.delete().forPath("/test/one");
-            Thread.sleep(100);
+            timing.sleepABit();
             Assert.assertFalse(exec.isExecuteCalled());
         }
         finally {


[15/29] git commit: Added more timing to tests

Posted by ra...@apache.org.
Added more timing to tests


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/460a9b37
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/460a9b37
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/460a9b37

Branch: refs/heads/CURATOR-105
Commit: 460a9b373a7c58ec250b5045d4485ba3d0c726e6
Parents: 5dbd672
Author: randgalt <ra...@apache.org>
Authored: Thu May 15 15:05:08 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 15 15:05:08 2014 -0500

----------------------------------------------------------------------
 .../nodes/TestPersistentEphemeralNode.java      | 37 +++++++++-----------
 1 file changed, 17 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/460a9b37/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
index 4ca487a..35cb9e8 100644
--- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
+++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/nodes/TestPersistentEphemeralNode.java
@@ -20,7 +20,6 @@ package org.apache.curator.framework.recipes.nodes;
 
 import com.google.common.base.Throwables;
 import com.google.common.collect.Lists;
-import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.CuratorFrameworkFactory;
 import org.apache.curator.framework.recipes.BaseClassForTests;
@@ -30,7 +29,7 @@ import org.apache.curator.retry.RetryOneTime;
 import org.apache.curator.test.KillSession;
 import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;
-import org.apache.curator.utils.DebugUtils;
+import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.utils.ZKPaths;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
@@ -55,6 +54,8 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
     private final Collection<CuratorFramework> curatorInstances = Lists.newArrayList();
     private final Collection<PersistentEphemeralNode> createdNodes = Lists.newArrayList();
 
+    private final Timing timing = new Timing();
+
     @AfterMethod
     public void teardown() throws Exception
     {
@@ -76,7 +77,6 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
     {
         server.close();
 
-        Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         try
         {
@@ -124,7 +124,6 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
     {
         server.close();
 
-        Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         try
         {
@@ -193,14 +192,13 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
     public void testSettingData() throws Exception
     {
         PersistentEphemeralNode node = null;
-        Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         try
         {
             client.start();
             node = new PersistentEphemeralNode(client, PersistentEphemeralNode.Mode.EPHEMERAL, PATH, "a".getBytes());
             node.start();
-            Assert.assertTrue(node.waitForInitialCreate(5, TimeUnit.SECONDS));
+            Assert.assertTrue(node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS));
 
             Assert.assertEquals(node.getActualPath(), PATH);
             Assert.assertEquals(client.getData().forPath(PATH), "a".getBytes());
@@ -266,7 +264,7 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
 
         PersistentEphemeralNode node = new PersistentEphemeralNode(curator, PersistentEphemeralNode.Mode.EPHEMERAL, PATH, new byte[0]);
         node.start();
-        node.waitForInitialCreate(5, TimeUnit.SECONDS);
+        node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
 
         String path = node.getActualPath();
         node.close();
@@ -286,7 +284,7 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
         node.start();
         try
         {
-            node.waitForInitialCreate(5, TimeUnit.SECONDS);
+            node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
             assertNodeExists(observer, node.getActualPath());
 
             // Register a watch that will fire when the node is deleted...
@@ -296,7 +294,7 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
             killSession(curator);
 
             // Make sure the node got deleted
-            assertTrue(deletedTrigger.firedWithin(10, TimeUnit.SECONDS));
+            assertTrue(deletedTrigger.firedWithin(timing.forWaiting().seconds(), TimeUnit.SECONDS));
         }
         finally
         {
@@ -323,12 +321,12 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
             killSession(curator);
 
             // Make sure the node got deleted...
-            assertTrue(deletedTrigger.firedWithin(10, TimeUnit.SECONDS));
+            assertTrue(deletedTrigger.firedWithin(timing.forWaiting().seconds(), TimeUnit.SECONDS));
 
             // Check for it to be recreated...
             Trigger createdTrigger = Trigger.created();
             Stat stat = observer.checkExists().usingWatcher(createdTrigger).forPath(node.getActualPath());
-            assertTrue(stat != null || createdTrigger.firedWithin(10, TimeUnit.SECONDS));
+            assertTrue(stat != null || createdTrigger.firedWithin(timing.forWaiting().seconds(), TimeUnit.SECONDS));
         }
         finally
         {
@@ -346,7 +344,7 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
         node.start();
         try
         {
-            node.waitForInitialCreate(5, TimeUnit.SECONDS);
+            node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
             String path = node.getActualPath();
             assertNodeExists(observer, path);
 
@@ -360,12 +358,12 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
                 killSession(curator);
 
                 // Make sure the node ended up getting deleted...
-                assertTrue(deletionTrigger.firedWithin(10, TimeUnit.SECONDS));
+                assertTrue(deletionTrigger.firedWithin(timing.forWaiting().seconds(), TimeUnit.SECONDS));
 
                 // Now put a watch in the background looking to see if it gets created...
                 Trigger creationTrigger = Trigger.created();
                 Stat stat = observer.checkExists().usingWatcher(creationTrigger).forPath(path);
-                assertTrue(stat != null || creationTrigger.firedWithin(10, TimeUnit.SECONDS));
+                assertTrue(stat != null || creationTrigger.firedWithin(timing.forWaiting().seconds(), TimeUnit.SECONDS));
             }
         }
         finally
@@ -383,7 +381,7 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
         node.start();
         try
         {
-            node.waitForInitialCreate(5, TimeUnit.SECONDS);
+            node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
             String originalNode = node.getActualPath();
             assertNodeExists(curator, originalNode);
 
@@ -394,7 +392,7 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
             // node that gets created is going to be exactly the same as the original.
             Trigger createdWatchTrigger = Trigger.created();
             Stat stat = curator.checkExists().usingWatcher(createdWatchTrigger).forPath(originalNode);
-            assertTrue(stat != null || createdWatchTrigger.firedWithin(10, TimeUnit.SECONDS));
+            assertTrue(stat != null || createdWatchTrigger.firedWithin(timing.forWaiting().seconds(), TimeUnit.SECONDS));
         }
         finally
         {
@@ -411,14 +409,14 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
         node1.start();
         try
         {
-            node1.waitForInitialCreate(5, TimeUnit.SECONDS);
+            node1.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
             String path1 = node1.getActualPath();
 
             PersistentEphemeralNode node2 = new PersistentEphemeralNode(curator, PersistentEphemeralNode.Mode.EPHEMERAL_SEQUENTIAL, PATH, new byte[0]);
             node2.start();
             try
             {
-                node2.waitForInitialCreate(5, TimeUnit.SECONDS);
+                node2.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
                 String path2 = node2.getActualPath();
 
                 assertFalse(path1.equals(path2));
@@ -444,7 +442,7 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
         node.start();
         try
         {
-            node.waitForInitialCreate(5, TimeUnit.SECONDS);
+            node.waitForInitialCreate(timing.forWaiting().seconds(), TimeUnit.SECONDS);
             assertTrue(Arrays.equals(curator.getData().forPath(node.getActualPath()), data));
         }
         finally
@@ -466,7 +464,6 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
 
     private CuratorFramework newCurator() throws IOException
     {
-        Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         client.start();
 


[22/29] git commit: data isn't used

Posted by ra...@apache.org.
data isn't used


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/c6700f0b
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/c6700f0b
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/c6700f0b

Branch: refs/heads/CURATOR-105
Commit: c6700f0bea33c3daf5fb0f5f5890fae627cf908e
Parents: ac57e11
Author: randgalt <ra...@apache.org>
Authored: Thu May 22 17:54:06 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu May 22 17:54:06 2014 -0500

----------------------------------------------------------------------
 .../apache/curator/framework/recipes/locks/LockInternals.java   | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/c6700f0b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
index d6298ce..0f7460f 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java
@@ -26,13 +26,12 @@ import org.apache.curator.RetryLoop;
 import org.apache.curator.framework.CuratorFramework;
 import org.apache.curator.framework.api.CuratorWatcher;
 import org.apache.curator.framework.imps.CuratorFrameworkState;
+import org.apache.curator.utils.PathUtils;
 import org.apache.curator.utils.ZKPaths;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;
 import org.apache.zookeeper.WatchedEvent;
 import org.apache.zookeeper.Watcher;
-import org.apache.curator.utils.PathUtils;
-import org.apache.zookeeper.data.Stat;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -297,7 +296,7 @@ public class LockInternals
                     {
                         try 
                         {
-                            byte[] data = client.getData().usingWatcher(watcher).forPath(previousSequencePath);
+                            client.getData().usingWatcher(watcher).forPath(previousSequencePath);
                             if ( millisToWait != null )
                             {
                                 millisToWait -= (System.currentTimeMillis() - startMillis);


[02/29] git commit: Merge branch 'master' into CURATOR-96

Posted by ra...@apache.org.
Merge branch 'master' into CURATOR-96


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/568c6997
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/568c6997
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/568c6997

Branch: refs/heads/CURATOR-105
Commit: 568c69979b17b165343228814fc366c001294303
Parents: 426db3d d19aff7
Author: randgalt <ra...@apache.org>
Authored: Sun Mar 30 13:31:42 2014 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun Mar 30 13:31:42 2014 -0500

----------------------------------------------------------------------
 .../curator/framework/recipes/queue/QueueSharder.java  | 13 +++++--------
 .../framework/recipes/queue/TestQueueSharder.java      |  2 +-
 2 files changed, 6 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/568c6997/curator-recipes/src/test/java/org/apache/curator/framework/recipes/queue/TestQueueSharder.java
----------------------------------------------------------------------