curator-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From randg...@apache.org
Subject [4/7] git commit: removed some dead code (left over port/dirs)
Date Wed, 18 Jun 2014 16:58:58 GMT
removed some dead code (left over port/dirs)


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

Branch: refs/heads/master
Commit: 95893ad37da229d91973bd428ebf19f17cb8a9d8
Parents: 2337b64
Author: randgalt <randgalt@apache.org>
Authored: Tue Jun 17 23:07:43 2014 -0500
Committer: randgalt <randgalt@apache.org>
Committed: Tue Jun 17 23:07:43 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/curator/BasicTests.java     |  5 --
 .../java/org/apache/curator/TestRetryLoop.java  |  5 --
 .../framework/imps/TestFailedDeleteManager.java |  9 +---
 .../curator/framework/imps/TestFramework.java   |  5 +-
 .../framework/imps/TestFrameworkEdges.java      |  3 --
 .../curator/test/TestingZooKeeperServer.java    | 51 ++++++++------------
 6 files changed, 25 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/95893ad3/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 d25ae61..eee5047 100644
--- a/curator-client/src/test/java/org/apache/curator/BasicTests.java
+++ b/curator-client/src/test/java/org/apache/curator/BasicTests.java
@@ -22,7 +22,6 @@ 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;
 import org.apache.curator.utils.ZookeeperFactory;
 import org.apache.zookeeper.CreateMode;
@@ -34,7 +33,6 @@ import org.apache.zookeeper.ZooKeeper;
 import org.mockito.Mockito;
 import org.testng.Assert;
 import org.testng.annotations.Test;
-import java.io.File;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -123,9 +121,6 @@ public class BasicTests extends BaseClassForTests
     @Test
     public void     testReconnect() throws Exception
     {
-        int                 serverPort = server.getPort();
-        File                tempDirectory = server.getTempDirectory();
-
         CuratorZookeeperClient client = new CuratorZookeeperClient(server.getConnectString(),
10000, 10000, null, new RetryOneTime(1));
         client.start();
         try

http://git-wip-us.apache.org/repos/asf/curator/blob/95893ad3/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 430f587..0fa9020 100644
--- a/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java
+++ b/curator-client/src/test/java/org/apache/curator/TestRetryLoop.java
@@ -21,12 +21,10 @@ 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;
 import org.testng.Assert;
 import org.testng.annotations.Test;
-import java.io.File;
 import java.util.concurrent.TimeUnit;
 
 public class TestRetryLoop extends BaseClassForTests
@@ -52,9 +50,6 @@ public class TestRetryLoop extends BaseClassForTests
     @Test
     public void     testRetryLoopWithFailure() throws Exception
     {
-        int                 serverPort = server.getPort();
-        File                tempDirectory = server.getTempDirectory();
-
         CuratorZookeeperClient client = new CuratorZookeeperClient(server.getConnectString(),
5000, 5000, null, new RetryOneTime(1));
         client.start();
         try

http://git-wip-us.apache.org/repos/asf/curator/blob/95893ad3/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 0e66f0e..b684276 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,20 +18,18 @@
  */
 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;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.framework.state.ConnectionStateListener;
 import org.apache.curator.retry.ExponentialBackoffRetry;
 import org.apache.curator.retry.RetryOneTime;
-import org.apache.curator.test.TestingServer;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.Timing;
+import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.KeeperException;
 import org.testng.Assert;
 import org.testng.annotations.Test;
-import java.io.File;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Semaphore;
 
@@ -236,9 +234,6 @@ public class TestFailedDeleteManager extends BaseClassForTests
             client.create().creatingParentsIfNeeded().forPath(PATH);
             Assert.assertNotNull(client.checkExists().forPath(PATH));
 
-            File    serverDir = server.getTempDirectory();
-            int     serverPort = server.getPort();
-
             server.stop(); // cause the next delete to fail
             try
             {

http://git-wip-us.apache.org/repos/asf/curator/blob/95893ad3/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 08a284c..2bd6053 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,8 +19,6 @@
 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;
 import org.apache.curator.framework.api.BackgroundCallback;
@@ -30,8 +28,9 @@ 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.TestingServer;
+import org.apache.curator.test.BaseClassForTests;
 import org.apache.curator.test.Timing;
+import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.utils.EnsurePath;
 import org.apache.zookeeper.CreateMode;
 import org.apache.zookeeper.KeeperException;

http://git-wip-us.apache.org/repos/asf/curator/blob/95893ad3/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 9adb70f..9c02c7d 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
@@ -44,7 +44,6 @@ import org.apache.zookeeper.Watcher;
 import org.apache.zookeeper.data.Stat;
 import org.testng.Assert;
 import org.testng.annotations.Test;
-import java.io.File;
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Semaphore;
@@ -340,8 +339,6 @@ public class TestFrameworkEdges extends BaseClassForTests
     public void testRetry() throws Exception
     {
         final int MAX_RETRIES = 3;
-        final int serverPort = server.getPort();
-        final File tempDirectory = server.getTempDirectory();
 
         final CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(),
timing.session(), timing.connection(), new RetryOneTime(10));
         client.start();

http://git-wip-us.apache.org/repos/asf/curator/blob/95893ad3/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 cb855e9..eeec877 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
@@ -16,32 +16,30 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.curator.test;
 
-import java.io.Closeable;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.concurrent.atomic.AtomicReference;
+package org.apache.curator.test;
 
 import org.apache.zookeeper.server.quorum.QuorumPeer;
 import org.apache.zookeeper.server.quorum.QuorumPeerConfig;
 import org.apache.zookeeper.server.quorum.QuorumPeerMain;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * Thanks to Jeremie BORDIER (ahfeel) for this code
  */
 public class TestingZooKeeperServer extends QuorumPeerMain implements Closeable
 {
-    private static final Logger logger = LoggerFactory
-            .getLogger(TestingZooKeeperServer.class);
+    private static final Logger logger = LoggerFactory.getLogger(TestingZooKeeperServer.class);
 
     private final QuorumConfigBuilder configBuilder;
     private final int thisInstanceIndex;
     private volatile ZooKeeperMainFace main;
-    private final AtomicReference<State> state = new AtomicReference<State>(
-            State.LATENT);
+    private final AtomicReference<State> state = new AtomicReference<State>(State.LATENT);
 
     private enum State
     {
@@ -53,13 +51,11 @@ public class TestingZooKeeperServer extends QuorumPeerMain implements
Closeable
         this(configBuilder, 0);
     }
 
-    public TestingZooKeeperServer(QuorumConfigBuilder configBuilder,
-            int thisInstanceIndex)
+    public TestingZooKeeperServer(QuorumConfigBuilder configBuilder, int thisInstanceIndex)
     {
         this.configBuilder = configBuilder;
         this.thisInstanceIndex = thisInstanceIndex;
-        main = (configBuilder.size() > 1) ? new TestingQuorumPeerMain()
-                : new TestingZooKeeperMain();
+        main = (configBuilder.size() > 1) ? new TestingQuorumPeerMain() : new TestingZooKeeperMain();
     }
 
     public QuorumPeer getQuorumPeer()
@@ -83,19 +79,19 @@ public class TestingZooKeeperServer extends QuorumPeerMain implements
Closeable
      * started again. If it is not running (in a LATENT or STOPPED state) then
      * it will be restarted. If it is in a CLOSED state then an exception will
      * be thrown.
-     * 
+     *
      * @throws Exception
      */
     public void restart() throws Exception
     {
         // Can't restart from a closed state as all the temporary data is gone
-        if (state.get() == State.CLOSED)
+        if ( state.get() == State.CLOSED )
         {
             throw new IllegalStateException("Cannot restart a closed instance");
         }
 
         // If the server's currently running then stop it.
-        if (state.get() == State.STARTED)
+        if ( state.get() == State.STARTED )
         {
             stop();
         }
@@ -103,14 +99,13 @@ public class TestingZooKeeperServer extends QuorumPeerMain implements
Closeable
         // Set to a LATENT state so we can restart
         state.set(State.LATENT);
 
-        main = (configBuilder.size() > 1) ? new TestingQuorumPeerMain()
-                : new TestingZooKeeperMain();
+        main = (configBuilder.size() > 1) ? new TestingQuorumPeerMain() : new TestingZooKeeperMain();
         start();
     }
 
     public void stop() throws IOException
     {
-        if (state.compareAndSet(State.STARTED, State.STOPPED))
+        if ( state.compareAndSet(State.STARTED, State.STOPPED) )
         {
             main.close();
         }
@@ -126,10 +121,10 @@ public class TestingZooKeeperServer extends QuorumPeerMain implements
Closeable
     {
         stop();
 
-        if (state.compareAndSet(State.STOPPED, State.CLOSED))
+        if ( state.compareAndSet(State.STOPPED, State.CLOSED) )
         {
             InstanceSpec spec = getInstanceSpec();
-            if (spec.deleteDataDirectoryOnClose())
+            if ( spec.deleteDataDirectoryOnClose() )
             {
                 DirectoryUtils.deleteRecursively(spec.getDataDirectory());
             }
@@ -138,7 +133,7 @@ public class TestingZooKeeperServer extends QuorumPeerMain implements
Closeable
 
     public void start() throws Exception
     {
-        if (!state.compareAndSet(State.LATENT, State.STARTED))
+        if ( !state.compareAndSet(State.LATENT, State.STARTED) )
         {
             return;
         }
@@ -149,16 +144,12 @@ public class TestingZooKeeperServer extends QuorumPeerMain implements
Closeable
             {
                 try
                 {
-                    QuorumPeerConfig config = configBuilder
-                            .buildConfig(thisInstanceIndex);
+                    QuorumPeerConfig config = configBuilder.buildConfig(thisInstanceIndex);
                     main.runFromConfig(config);
-                } catch (Exception e)
+                }
+                catch ( Exception e )
                 {
-                    logger.error(
-                            String.format(
-                                    "From testing server (random state: %s) for instance:
%s",
-                                    String.valueOf(configBuilder.isFromRandom()),
-                                    getInstanceSpec()), e);
+                    logger.error(String.format("From testing server (random state: %s) for
instance: %s", String.valueOf(configBuilder.isFromRandom()), getInstanceSpec()), e);
                 }
             }
         }).start();


Mime
View raw message