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:25 UTC
[7/8] git commit: More tightening of tests
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/master
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 )
{