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/20 17:32:03 UTC
[01/13] git commit: Making Connection erros less verbose. Only first
error is logged with error level; subsequent errors are logged as debug
Repository: curator
Updated Branches:
refs/heads/CURATOR-96 449eeff54 -> 351c67c97
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-96
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;
[12/13] 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-96
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 )
{
[11/13] 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-96
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);
}
}
[02/13] 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-96
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);
}
[09/13] 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-96
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
[06/13] 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-96
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
{
[10/13] 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-96
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();
[04/13] 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-96
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
{
[03/13] 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-96
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;
[07/13] 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-96
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 {
[05/13] 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-96
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(-)
----------------------------------------------------------------------
[08/13] 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-96
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
{
[13/13] 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-96
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));