You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ca...@apache.org on 2015/04/28 05:58:28 UTC

[1/2] curator git commit: Merge branch 'CURATOR-190'

Repository: curator
Updated Branches:
  refs/heads/CURATOR-210 [created] c47ae7402


Merge branch 'CURATOR-190'


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

Branch: refs/heads/CURATOR-210
Commit: da8b2d4232c3d50d109aa7dbcb47a64c338e599d
Parents: 11d1dd4 017e199
Author: Cameron McKenzie <ca...@unico.com.au>
Authored: Tue Apr 28 11:01:18 2015 +1000
Committer: Cameron McKenzie <ca...@unico.com.au>
Committed: Tue Apr 28 11:01:18 2015 +1000

----------------------------------------------------------------------
 .../framework/client/TestBackgroundStates.java        | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------



[2/2] curator git commit: CURATOR-210 - Fixes to unit tests to restart() the TestingServer instance instead of close()ing it and then recreating it to simulate connection loss.

Posted by ca...@apache.org.
CURATOR-210 - Fixes to unit tests to restart() the TestingServer instance
instead of close()ing it and then recreating it to simulate connection
loss.


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

Branch: refs/heads/CURATOR-210
Commit: c47ae7402e093f21f5eb3244b855e45c0bc77f55
Parents: da8b2d4
Author: Cameron McKenzie <ca...@unico.com.au>
Authored: Tue Apr 28 13:57:41 2015 +1000
Committer: Cameron McKenzie <ca...@unico.com.au>
Committed: Tue Apr 28 13:57:41 2015 +1000

----------------------------------------------------------------------
 .../curator/framework/imps/TestFrameworkBackground.java     | 4 ++--
 .../apache/curator/framework/imps/TestFrameworkEdges.java   | 4 ++--
 .../curator/framework/client/TestBackgroundStates.java      | 2 --
 .../client/TestResetConnectionWithBackgroundFailure.java    | 8 ++++----
 .../recipes/nodes/TestPersistentEphemeralNode.java          | 4 ++--
 .../recipes/nodes/TestPersistentEphemeralNodeListener.java  | 9 +++------
 6 files changed, 13 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/c47ae740/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 3f1c41f..26cc941 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
@@ -48,7 +48,7 @@ public class TestFrameworkBackground extends BaseClassForTests
     @Test
     public void testListenerConnectedAtStart() throws Exception
     {
-        server.close();
+        server.stop();
 
         Timing timing = new Timing(2);
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryNTimes(0, 0));
@@ -80,7 +80,7 @@ public class TestFrameworkBackground extends BaseClassForTests
             // due to CURATOR-72, this was causing a LOST event to precede the CONNECTED event
             client.create().inBackground().forPath("/foo");
 
-            server = new TestingServer(server.getPort());
+            server.restart();
 
             Assert.assertTrue(timing.awaitLatch(connectedLatch));
             Assert.assertFalse(firstListenerAction.get());

http://git-wip-us.apache.org/repos/asf/curator/blob/c47ae740/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 d9ef8d7..cd3ae77 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
@@ -170,7 +170,7 @@ public class TestFrameworkEdges extends BaseClassForTests
 
             client.checkExists().forPath("/");
 
-            server.close();
+            server.stop();
 
             Assert.assertTrue(timing.awaitLatch(lostLatch));
 
@@ -184,7 +184,7 @@ public class TestFrameworkEdges extends BaseClassForTests
                 // correct
             }
 
-            server = new TestingServer(server.getPort());
+            server.restart();
             client.checkExists().forPath("/");
         }
         finally

http://git-wip-us.apache.org/repos/asf/curator/blob/c47ae740/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 19cb9a2..f264615 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
@@ -82,8 +82,6 @@ public class TestBackgroundStates extends BaseClassForTests
             Assert.assertTrue(node.waitForInitialCreate(timing.forWaiting().milliseconds(), TimeUnit.MILLISECONDS));
             server.restart();
             timing.sleepABit();
-            //server = new TestingServer(server.getPort());
-            timing.sleepABit();
             Assert.assertTrue(timing.awaitLatch(reconnectedLatch));
             timing.sleepABit();
             Assert.assertEquals(lastState.get(), ConnectionState.RECONNECTED);

http://git-wip-us.apache.org/repos/asf/curator/blob/c47ae740/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 83025af..7d2cb89 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
@@ -51,7 +51,7 @@ public class TestResetConnectionWithBackgroundFailure extends BaseClassForTests
     @Test
     public void testConnectionStateListener() throws Exception
     {
-        server.close();
+        server.stop();
 
         final StringBuilder listenerSequence = new StringBuilder();
         LeaderSelector selector = null;
@@ -85,15 +85,15 @@ public class TestResetConnectionWithBackgroundFailure extends BaseClassForTests
 
             client.getConnectionStateListenable().addListener(listener1);
             log.debug("Starting ZK server");
-            server = new TestingServer(server.getPort());
+            server.restart();
             timing.forWaiting().sleepABit();
 
             log.debug("Stopping ZK server");
-            server.close();
+            server.stop();
             timing.forWaiting().sleepABit();
 
             log.debug("Starting ZK server");
-            server = new TestingServer(server.getPort());
+            server.restart();
             timing.forWaiting().sleepABit();
 
             log.debug("Stopping ZK server");

http://git-wip-us.apache.org/repos/asf/curator/blob/c47ae740/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 1c66271..34620ff 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
@@ -127,7 +127,7 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
     @Test
     public void testNoServerAtStart() throws Exception
     {
-        server.close();
+        server.stop();
 
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
         try
@@ -152,7 +152,7 @@ public class TestPersistentEphemeralNode extends BaseClassForTests
 
             timing.sleepABit();
 
-            server = new TestingServer(server.getPort());
+            server.restart();
 
             Assert.assertTrue(timing.awaitLatch(connectedLatch));
 

http://git-wip-us.apache.org/repos/asf/curator/blob/c47ae740/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 3a4eda8..ceff4c5 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
@@ -39,7 +39,7 @@ public class TestPersistentEphemeralNodeListener extends BaseClassForTests
     @Test
     public void testListenersReconnectedIsOK() throws Exception
     {
-        server.close();
+        server.stop();
 
         Timing timing = new Timing();
         CuratorFramework client = CuratorFrameworkFactory.newClient(server.getConnectString(), timing.session(), timing.connection(), new RetryOneTime(1));
@@ -66,18 +66,15 @@ public class TestPersistentEphemeralNodeListener extends BaseClassForTests
                     {
                         reconnectedLatch.countDown();
                     }
-                    System.out.println("XXXX " + newState);
                 }
             };
             client.getConnectionStateListenable().addListener(listener);
             timing.sleepABit();
-            server = new TestingServer(server.getPort());
+            server.restart();
             Assert.assertTrue(timing.awaitLatch(connectedLatch));
             timing.sleepABit();
             Assert.assertTrue(node.waitForInitialCreate(timing.forWaiting().milliseconds(), TimeUnit.MILLISECONDS));
-            server.close();
-            timing.sleepABit();
-            server = new TestingServer(server.getPort());
+            server.restart();
             timing.sleepABit();
             Assert.assertTrue(timing.awaitLatch(reconnectedLatch));
             timing.sleepABit();