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 2015/08/23 16:33:52 UTC

curator git commit: more work on repairing tests for new connection handling

Repository: curator
Updated Branches:
  refs/heads/CURATOR-247 5f094f8bb -> e001e0098


more work on repairing tests for new connection handling


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

Branch: refs/heads/CURATOR-247
Commit: e001e0098f64baa8e0b3b887507bc98972c775dc
Parents: 5f094f8
Author: randgalt <ra...@apache.org>
Authored: Sun Aug 23 09:33:46 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Sun Aug 23 09:33:46 2015 -0500

----------------------------------------------------------------------
 .../org/apache/curator/CuratorZookeeperClient.java    | 14 --------------
 .../src/main/java/org/apache/curator/RetryLoop.java   |  6 ------
 .../curator/framework/imps/TestFrameworkEdges.java    |  3 ---
 .../x/discovery/details/TestServiceDiscovery.java     |  2 ++
 4 files changed, 2 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/e001e009/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
index c8a9936..d6c2072 100644
--- a/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
+++ b/curator-client/src/main/java/org/apache/curator/CuratorZookeeperClient.java
@@ -19,7 +19,6 @@
 
 package org.apache.curator;
 
-import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import org.apache.curator.connection.ClassicConnectionHandlingPolicy;
 import org.apache.curator.connection.ConnectionHandlingPolicy;
@@ -54,7 +53,6 @@ public class CuratorZookeeperClient implements Closeable
     private final AtomicBoolean started = new AtomicBoolean(false);
     private final AtomicReference<TracerDriver> tracer = new AtomicReference<TracerDriver>(new DefaultTracerDriver());
     private final ConnectionHandlingPolicy connectionHandlingPolicy;
-    private final AtomicReference<Exception> debugException = new AtomicReference<>();
 
     /**
      *
@@ -336,18 +334,6 @@ public class CuratorZookeeperClient implements Closeable
         return connectionHandlingPolicy;
     }
 
-    @VisibleForTesting
-    public void setDebugException(Exception e)
-    {
-        debugException.set(e);
-    }
-
-    @VisibleForTesting
-    Exception getDebugException()
-    {
-        return debugException.get();
-    }
-
     void addParentWatcher(Watcher watcher)
     {
         state.addParentWatcher(watcher);

http://git-wip-us.apache.org/repos/asf/curator/blob/e001e009/curator-client/src/main/java/org/apache/curator/RetryLoop.java
----------------------------------------------------------------------
diff --git a/curator-client/src/main/java/org/apache/curator/RetryLoop.java b/curator-client/src/main/java/org/apache/curator/RetryLoop.java
index 4353c61..e58ce20 100644
--- a/curator-client/src/main/java/org/apache/curator/RetryLoop.java
+++ b/curator-client/src/main/java/org/apache/curator/RetryLoop.java
@@ -96,12 +96,6 @@ public class RetryLoop
      */
     public static<T> T      callWithRetry(CuratorZookeeperClient client, Callable<T> proc) throws Exception
     {
-        Exception debugException = client.getDebugException();
-        if ( debugException != null )
-        {
-            throw debugException;
-        }
-
         return client.getConnectionHandlingPolicy().callWithRetry(client, proc);
     }
 

http://git-wip-us.apache.org/repos/asf/curator/blob/e001e009/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 15781dc..ef77087 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
@@ -423,7 +423,6 @@ public class TestFrameworkEdges extends BaseClassForTests
                         {
                             throw new Error(e);
                         }
-                        client.getZookeeperClient().setDebugException(null);
                     }
                     try
                     {
@@ -441,7 +440,6 @@ public class TestFrameworkEdges extends BaseClassForTests
             server.stop();
 
             // test foreground retry
-            client.getZookeeperClient().setDebugException(new KeeperException.ConnectionLossException());
             client.checkExists().forPath("/hey");
             Assert.assertTrue(semaphore.tryAcquire(MAX_RETRIES, timing.forWaiting().seconds(), TimeUnit.SECONDS), "Remaining leases: " + semaphore.availablePermits());
 
@@ -456,7 +454,6 @@ public class TestFrameworkEdges extends BaseClassForTests
             server.stop();
 
             // test background retry
-            client.getZookeeperClient().setDebugException(new KeeperException.ConnectionLossException());
             client.checkExists().inBackground().forPath("/hey");
             Assert.assertTrue(semaphore.tryAcquire(MAX_RETRIES, timing.forWaiting().seconds(), TimeUnit.SECONDS), "Remaining leases: " + semaphore.availablePermits());
         }

http://git-wip-us.apache.org/repos/asf/curator/blob/e001e009/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestServiceDiscovery.java
----------------------------------------------------------------------
diff --git a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestServiceDiscovery.java b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestServiceDiscovery.java
index 8b1e5fc..989edaf 100644
--- a/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestServiceDiscovery.java
+++ b/curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestServiceDiscovery.java
@@ -269,6 +269,7 @@ public class TestServiceDiscovery extends BaseClassForTests
     @Test
     public void testNoServerOnStart() throws Exception
     {
+        Timing timing = new Timing();
         server.stop();
         List<Closeable> closeables = Lists.newArrayList();
         try
@@ -283,6 +284,7 @@ public class TestServiceDiscovery extends BaseClassForTests
             discovery.start();
 
             server.restart();
+            timing.sleepABit();
             Assert.assertEquals(discovery.queryForNames(), Collections.singletonList("test"));
 
             List<ServiceInstance<String>> list = Lists.newArrayList();