Return-Path: X-Original-To: apmail-curator-commits-archive@minotaur.apache.org Delivered-To: apmail-curator-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4604D11377 for ; Fri, 23 May 2014 15:07:03 +0000 (UTC) Received: (qmail 8187 invoked by uid 500); 23 May 2014 15:07:03 -0000 Delivered-To: apmail-curator-commits-archive@curator.apache.org Received: (qmail 8088 invoked by uid 500); 23 May 2014 15:07:03 -0000 Mailing-List: contact commits-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list commits@curator.apache.org Received: (qmail 7805 invoked by uid 99); 23 May 2014 15:07:03 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 May 2014 15:07:03 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id C7F7C9A47C0; Fri, 23 May 2014 15:07:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: randgalt@apache.org To: commits@curator.apache.org Date: Fri, 23 May 2014 15:07:18 -0000 Message-Id: <5893fd336d0043beb8ea62714da60a44@git.apache.org> In-Reply-To: <4c52c9a752f84f3cb1c1fa8c60e52b3d@git.apache.org> References: <4c52c9a752f84f3cb1c1fa8c60e52b3d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [17/29] 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/CURATOR-105 Commit: ab618960332ebb2e39f536b6175e6ef9eb033b9b Parents: 78cf189 Author: randgalt Authored: Thu May 15 16:55:15 2014 -0500 Committer: randgalt 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 ) {