svn commit: r18513 - in /dev/curator/2.12.0: ./ apache-curator-2.12.0-source-release.zip apache-curator-2.12.0-source-release.zip.asc apache-curator-2.12.0-source-release.zip.md5 apache-curator-2.12.0

2017-02-28 Thread cammckenzie
Author: cammckenzie
Date: Wed Mar  1 04:24:49 2017
New Revision: 18513

Log:
2.12.0 binaries

Added:
dev/curator/2.12.0/
dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip   (with props)
dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.asc   (with 
props)
dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.md5   (with 
props)
dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.sha1   (with 
props)

Added: dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip
==
Binary file - no diff available.

Propchange: dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip
--
svn:executable = *

Propchange: dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip
--
svn:mime-type = application/octet-stream

Added: dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.asc
==
--- dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.asc (added)
+++ dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.asc Wed Mar  1 
04:24:49 2017
@@ -0,0 +1,18 @@
+-BEGIN PGP SIGNATURE-
+Version: GnuPG v1
+Comment: GPGTools - https://gpgtools.org
+
+iQIcBAABCgAGBQJYtkAGAAoJEG17iHfZHfuJcVYP/2Q/BpfVu5VJHUWgh/JNxU4H
+MrQTg/E1nXPY3I7tRkWQt7KPTXxpO3HZRfbJpsdfIWnzTlip4w/Br46HIZLY5/O0
+j76mOQKzsTDwH0cYHBC3u1H26W99oO9pc3ix4Bya7ohhajKkHNLeMLhU67rNDKvJ
+sakriOYR4msb40sfUErqCqeG3tuwtz9gR7GfXULYHHZKXaRfjqXzmrTDZWcPfx20
+08rGeAa96PbwX8jeQ2a3M8RxaYXPESnlfIUIdbmxa2mQrmO+f4AtsZPyLvDZOhRY
+wIFT6yLnJSwmq+EQ1UOmn1kEx8v4NO37ehq5TN2Vn0+t8x0cnxpa/Bku4dUH3cD5
+7wedx4rJaJRtQv0Z48kbFoVz12nvOlgF/w61R920YoGA74cIvTEPdjMyOOAjaxyB
+BqfNX84YQJZaVxPj1eDU4docc/Kv9F5Kgt3kR27+d3LZ1LygDEHx8RtjIMaSUWny
+H/hksPlPGLPlgJrvQXPtYPqglYjLuW4WHsRIcDbj7N+/N3u2UjYebs8JdSBiKdz+
+nwghLLYOpb8M0cPAG5UJo42PbwAGmHwAPI8AcPmdM14gGUHPLqXQ+fcQkybNVUcf
+APU25CxGTUBkd7KnotxQdMtQon7BhY3Yeu6hfw8kWMtUfWI/PTZaBtyD7X2JuD/n
+pnvAV1XJeuCXsjDTln7r
+=jPA5
+-END PGP SIGNATURE-

Propchange: dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.asc
--
svn:executable = *

Added: dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.md5
==
--- dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.md5 (added)
+++ dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.md5 Wed Mar  1 
04:24:49 2017
@@ -0,0 +1 @@
+5966d2f710abf67f28a2770faf45ec37
\ No newline at end of file

Propchange: dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.md5
--
svn:executable = *

Added: dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.sha1
==
--- dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.sha1 (added)
+++ dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.sha1 Wed Mar  1 
04:24:49 2017
@@ -0,0 +1 @@
+58f263e006c1b076fbca746734ff46d968c8ee3c
\ No newline at end of file

Propchange: dev/curator/2.12.0/apache-curator-2.12.0-source-release.zip.sha1
--
svn:executable = *




[curator] Git Push Summary

2017-02-28 Thread cammckenzie
Repository: curator
Updated Tags:  refs/tags/apache-curator-2.12.0 [created] 17caa5923


[09/12] curator git commit: removed vestigal Mockito import

2017-02-28 Thread randgalt
removed vestigal Mockito import


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

Branch: refs/heads/CURATOR-3.0
Commit: d5daa4c115a794783e25ab7b1d035f5c2f9167f1
Parents: 952dd6b
Author: randgalt 
Authored: Tue Feb 28 19:47:37 2017 -0300
Committer: randgalt 
Committed: Tue Feb 28 19:47:37 2017 -0300

--
 .../org/apache/curator/framework/imps/TestBlockUntilConnected.java  | 1 -
 1 file changed, 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/d5daa4c1/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
index 3597f95..4cd287a 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
@@ -34,7 +34,6 @@ import org.apache.curator.test.TestingServer;
 import org.apache.curator.test.Timing;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.zookeeper.Watcher;
-import org.mockito.internal.util.reflection.Whitebox;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 import java.util.Timer;



[06/12] curator git commit: Remove mockito dependency from curator-framework tests

2017-02-28 Thread randgalt
Remove mockito dependency from curator-framework tests


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

Branch: refs/heads/CURATOR-3.0
Commit: 952dd6b118ce3d2505a03abe1877b8d3db24d126
Parents: 4a95669
Author: Zoltan Szekeres 
Authored: Tue Feb 7 11:05:47 2017 +0100
Committer: Zoltan Szekeres 
Committed: Tue Feb 7 11:05:47 2017 +0100

--
 curator-framework/pom.xml |  6 --
 .../apache/curator/ConnectionStateAccessor.java   | 18 +++---
 2 files changed, 15 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/952dd6b1/curator-framework/pom.xml
--
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index 251033f..f0ec6ba 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -67,12 +67,6 @@
 slf4j-log4j12
 test
 
-
-
-org.mockito
-mockito-core
-test
-
 
 
 

http://git-wip-us.apache.org/repos/asf/curator/blob/952dd6b1/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
 
b/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
old mode 100755
new mode 100644
index 5b01166..0efa989
--- 
a/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
@@ -20,14 +20,26 @@
 package org.apache.curator;
 
 import org.apache.curator.framework.CuratorFramework;
-import org.mockito.internal.util.reflection.Whitebox;
+
+import java.lang.reflect.Field;
 
 public final class ConnectionStateAccessor
 {
-public static final void setDebugWaitOnExpiredForClient(CuratorFramework 
client)
+public static void setDebugWaitOnExpiredForClient(CuratorFramework client)
 {
 CuratorZookeeperClient zookeeperClient = client.getZookeeperClient();
-ConnectionState state = 
(ConnectionState)Whitebox.getInternalState(zookeeperClient, "state");
+ConnectionState state = 
(ConnectionState)getInternalState(zookeeperClient, "state");
 state.debugWaitOnExpiredEvent = true;
 }
+
+private static Object getInternalState(Object target, String field) {
+Class c = target.getClass();
+try {
+Field f = c.getDeclaredField(field);
+f.setAccessible(true);
+return f.get(target);
+} catch (Exception e) {
+throw new RuntimeException("Unable to get internal state on a 
private field.", e);
+}
+}
 }



[04/12] curator git commit: Use debug flag instead of assertion

2017-02-28 Thread randgalt
Use debug flag instead of assertion


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

Branch: refs/heads/CURATOR-3.0
Commit: 7f53bc179aa738e847c9d097ef4e0ad8b76de4f9
Parents: 7c35e44
Author: Zoltan Szekeres 
Authored: Tue Jan 31 17:29:48 2017 +
Committer: Zoltan Szekeres 
Committed: Tue Jan 31 17:29:48 2017 +

--
 .../org/apache/curator/ConnectionState.java | 25 ---
 .../apache/curator/ConnectionStateAccessor.java | 33 
 .../framework/imps/TestBlockUntilConnected.java |  9 +-
 3 files changed, 55 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/7f53bc17/curator-client/src/main/java/org/apache/curator/ConnectionState.java
--
diff --git 
a/curator-client/src/main/java/org/apache/curator/ConnectionState.java 
b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
index bb4f08e..d7bf6d8 100644
--- a/curator-client/src/main/java/org/apache/curator/ConnectionState.java
+++ b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator;
 
+import com.google.common.annotations.VisibleForTesting;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.drivers.EventTrace;
 import org.apache.curator.drivers.OperationTrace;
@@ -56,6 +57,9 @@ class ConnectionState implements Watcher, Closeable
 private final AtomicLong instanceIndex = new AtomicLong();
 private volatile long connectionStartMs = 0;
 
+@VisibleForTesting
+volatile boolean debugWaitOnExpiredEvent = false;
+
 ConnectionState(ZookeeperFactory zookeeperFactory, EnsembleProvider 
ensembleProvider, int sessionTimeoutMs, int connectionTimeoutMs, Watcher 
parentWatcher, AtomicReference tracer, boolean canBeReadOnly)
 {
 this.ensembleProvider = ensembleProvider;
@@ -163,7 +167,10 @@ class ConnectionState implements Watcher, Closeable
 }
 
 // only wait during tests
-assert waitOnExpiredEvent(event.getState());
+if (debugWaitOnExpiredEvent && event.getState() == 
Event.KeeperState.Expired)
+{
+waitOnExpiredEvent();
+}
 
 for ( Watcher parentWatcher : parentWatchers )
 {
@@ -176,19 +183,15 @@ class ConnectionState implements Watcher, Closeable
 }
 
 // only for testing
-private boolean waitOnExpiredEvent(Event.KeeperState currentState)
+private void waitOnExpiredEvent()
 {
-if (currentState == Event.KeeperState.Expired)
+log.debug("Waiting on Expired event for testing");
+try
 {
-log.debug("Waiting on Expired event for testing");
-try
-{
-Thread.sleep(1000);
-}
-catch(InterruptedException e) {}
-log.debug("Continue processing");
+Thread.sleep(1000);
 }
-return true;
+catch(InterruptedException e) {}
+log.debug("Continue processing");
 }
 
 EnsembleProvider getEnsembleProvider()

http://git-wip-us.apache.org/repos/asf/curator/blob/7f53bc17/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
 
b/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
new file mode 100755
index 000..5b01166
--- /dev/null
+++ 
b/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.curator;
+
+import 

[07/12] curator git commit: Closes #199 - Guava has been shaded into the Curator code so staying in sync with Guava versions is no longer necessary. https://issues.apache.org/jira/browse/CURATOR-200

2017-02-28 Thread randgalt
Closes #199 - Guava has been shaded into the Curator code so staying in sync 
with Guava versions is no longer necessary. 
https://issues.apache.org/jira/browse/CURATOR-200


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

Branch: refs/heads/CURATOR-3.0
Commit: 35d2cc0abbb08d282fcb579c2007707313730294
Parents: 6d8c0be
Author: randgalt 
Authored: Thu Feb 16 12:16:22 2017 -0200
Committer: randgalt 
Committed: Thu Feb 16 12:16:22 2017 -0200

--

--




[01/12] curator git commit: closes #63 - This is now handled by CURATOR-99

2017-02-28 Thread randgalt
Repository: curator
Updated Branches:
  refs/heads/CURATOR-3.0 62f428c04 -> 753142a76


closes #63 - This is now handled by CURATOR-99


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

Branch: refs/heads/CURATOR-3.0
Commit: 6d8c0be868341a0885023976dbd1c9f04395d818
Parents: 467513b
Author: randgalt 
Authored: Mon Jan 23 21:25:41 2017 -0500
Committer: randgalt 
Committed: Mon Jan 23 21:25:41 2017 -0500

--

--




[08/12] curator git commit: Merge branch 'CURATOR-367'

2017-02-28 Thread randgalt
Merge branch 'CURATOR-367'


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

Branch: refs/heads/CURATOR-3.0
Commit: 585e1499d22a995b313bba9d32bd7a605faef5da
Parents: 35d2cc0 952dd6b
Author: randgalt 
Authored: Tue Feb 28 19:33:04 2017 -0300
Committer: randgalt 
Committed: Tue Feb 28 19:33:04 2017 -0300

--
 .../org/apache/curator/ConnectionState.java | 52 +
 .../apache/curator/ConnectionStateAccessor.java | 45 +++
 .../framework/imps/TestBlockUntilConnected.java | 82 
 3 files changed, 165 insertions(+), 14 deletions(-)
--




[11/12] curator git commit: Merge branch 'master' into CURATOR-3.0

2017-02-28 Thread randgalt
Merge branch 'master' into CURATOR-3.0


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

Branch: refs/heads/CURATOR-3.0
Commit: d7a65ad5e90c26cb487fe864146b01277dd8cc1a
Parents: 62f428c e2aef81
Author: randgalt 
Authored: Tue Feb 28 19:55:52 2017 -0300
Committer: randgalt 
Committed: Tue Feb 28 19:55:52 2017 -0300

--
 .../apache/curator/ConnectionStateAccessor.java | 45 
 1 file changed, 45 insertions(+)
--




[03/12] curator git commit: change timeout to 5s in TestBlockUntilConnected

2017-02-28 Thread randgalt
change timeout to 5s in  TestBlockUntilConnected


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

Branch: refs/heads/CURATOR-3.0
Commit: 7c35e441b0a1b636e68c2e0f74cdb8e7fae69cb5
Parents: 651ac59
Author: Zoltan Szekeres 
Authored: Thu Jan 26 11:53:53 2017 -0500
Committer: Zoltan Szekeres 
Committed: Thu Jan 26 11:53:53 2017 -0500

--
 .../org/apache/curator/framework/imps/TestBlockUntilConnected.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/7c35e441/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
index 7ea0849..debf7f9 100644
--- 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
@@ -320,7 +320,7 @@ public class TestBlockUntilConnected extends 
BaseClassForTests
 //Wait until we get expired event
 Assert.assertTrue(timing.awaitLatch(expiredLatch), "Failed to get 
Expired event");
 
-Assert.assertTrue(client.blockUntilConnected(50, 
TimeUnit.SECONDS), "Not connected");
+Assert.assertTrue(client.blockUntilConnected(5, TimeUnit.SECONDS), 
"Not connected");
 }
 catch ( Exception e )
 {



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

2017-02-28 Thread randgalt
Merge branch 'CURATOR-367'


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

Branch: refs/heads/master
Commit: e2aef818200b42bd289f5b1fb84ce45220cc99d4
Parents: 585e149 d5daa4c
Author: randgalt 
Authored: Tue Feb 28 19:47:45 2017 -0300
Committer: randgalt 
Committed: Tue Feb 28 19:47:45 2017 -0300

--
 .../org/apache/curator/framework/imps/TestBlockUntilConnected.java  | 1 -
 1 file changed, 1 deletion(-)
--




[5/6] curator git commit: Remove mockito dependency from curator-framework tests

2017-02-28 Thread randgalt
Remove mockito dependency from curator-framework tests


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

Branch: refs/heads/master
Commit: 952dd6b118ce3d2505a03abe1877b8d3db24d126
Parents: 4a95669
Author: Zoltan Szekeres 
Authored: Tue Feb 7 11:05:47 2017 +0100
Committer: Zoltan Szekeres 
Committed: Tue Feb 7 11:05:47 2017 +0100

--
 curator-framework/pom.xml |  6 --
 .../apache/curator/ConnectionStateAccessor.java   | 18 +++---
 2 files changed, 15 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/952dd6b1/curator-framework/pom.xml
--
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index 251033f..f0ec6ba 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -67,12 +67,6 @@
 slf4j-log4j12
 test
 
-
-
-org.mockito
-mockito-core
-test
-
 
 
 

http://git-wip-us.apache.org/repos/asf/curator/blob/952dd6b1/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
 
b/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
old mode 100755
new mode 100644
index 5b01166..0efa989
--- 
a/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
+++ 
b/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
@@ -20,14 +20,26 @@
 package org.apache.curator;
 
 import org.apache.curator.framework.CuratorFramework;
-import org.mockito.internal.util.reflection.Whitebox;
+
+import java.lang.reflect.Field;
 
 public final class ConnectionStateAccessor
 {
-public static final void setDebugWaitOnExpiredForClient(CuratorFramework 
client)
+public static void setDebugWaitOnExpiredForClient(CuratorFramework client)
 {
 CuratorZookeeperClient zookeeperClient = client.getZookeeperClient();
-ConnectionState state = 
(ConnectionState)Whitebox.getInternalState(zookeeperClient, "state");
+ConnectionState state = 
(ConnectionState)getInternalState(zookeeperClient, "state");
 state.debugWaitOnExpiredEvent = true;
 }
+
+private static Object getInternalState(Object target, String field) {
+Class c = target.getClass();
+try {
+Field f = c.getDeclaredField(field);
+f.setAccessible(true);
+return f.get(target);
+} catch (Exception e) {
+throw new RuntimeException("Unable to get internal state on a 
private field.", e);
+}
+}
 }



[4/6] curator git commit: Add test dependency mockito to curator-framework

2017-02-28 Thread randgalt
Add test dependency mockito to curator-framework


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

Branch: refs/heads/master
Commit: 4a95669873604f200c379142d1376055af64a3a6
Parents: 7f53bc1
Author: Zoltan Szekeres 
Authored: Thu Feb 2 11:24:33 2017 +0100
Committer: Zoltan Szekeres 
Committed: Thu Feb 2 11:24:33 2017 +0100

--
 curator-framework/pom.xml | 6 ++
 1 file changed, 6 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/4a956698/curator-framework/pom.xml
--
diff --git a/curator-framework/pom.xml b/curator-framework/pom.xml
index f0ec6ba..251033f 100644
--- a/curator-framework/pom.xml
+++ b/curator-framework/pom.xml
@@ -67,6 +67,12 @@
 slf4j-log4j12
 test
 
+
+
+org.mockito
+mockito-core
+test
+
 
 
 



[1/6] curator git commit: Delay reconnect on session expired

2017-02-28 Thread randgalt
Repository: curator
Updated Branches:
  refs/heads/master 35d2cc0ab -> 585e1499d


Delay reconnect on session expired


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

Branch: refs/heads/master
Commit: 651ac591725567bf85ec830a45b9b062d5dd7474
Parents: 6d8c0be
Author: Zoltan Szekeres 
Authored: Thu Jan 26 09:03:20 2017 -0500
Committer: Zoltan Szekeres 
Committed: Thu Jan 26 09:03:20 2017 -0500

--
 .../org/apache/curator/ConnectionState.java | 49 +
 .../framework/imps/TestBlockUntilConnected.java | 75 
 2 files changed, 110 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/651ac591/curator-client/src/main/java/org/apache/curator/ConnectionState.java
--
diff --git 
a/curator-client/src/main/java/org/apache/curator/ConnectionState.java 
b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
index 7044ddf..bb4f08e 100644
--- a/curator-client/src/main/java/org/apache/curator/ConnectionState.java
+++ b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
@@ -149,7 +149,9 @@ class ConnectionState implements Watcher, Closeable
 log.debug("ConnectState watcher: " + event);
 }
 
-if ( event.getType() == Watcher.Event.EventType.None )
+final boolean eventTypeNone = event.getType() == 
Watcher.Event.EventType.None;
+
+if ( eventTypeNone )
 {
 boolean wasConnected = isConnected.get();
 boolean newIsConnected = checkState(event.getState(), 
wasConnected);
@@ -160,13 +162,33 @@ class ConnectionState implements Watcher, Closeable
 }
 }
 
+// only wait during tests
+assert waitOnExpiredEvent(event.getState());
+
 for ( Watcher parentWatcher : parentWatchers )
 {
-
 OperationTrace trace = new 
OperationTrace("connection-state-parent-process", tracer.get(), getSessionId());
 parentWatcher.process(event);
 trace.commit();
 }
+
+if (eventTypeNone) handleState(event.getState());
+}
+
+// only for testing
+private boolean waitOnExpiredEvent(Event.KeeperState currentState)
+{
+if (currentState == Event.KeeperState.Expired)
+{
+log.debug("Waiting on Expired event for testing");
+try
+{
+Thread.sleep(1000);
+}
+catch(InterruptedException e) {}
+log.debug("Continue processing");
+}
+return true;
 }
 
 EnsembleProvider getEnsembleProvider()
@@ -240,11 +262,11 @@ class ConnectionState implements Watcher, Closeable
 private boolean checkState(Event.KeeperState state, boolean wasConnected)
 {
 boolean isConnected = wasConnected;
-boolean checkNewConnectionString = true;
 switch ( state )
 {
 default:
 case Disconnected:
+case Expired:
 {
 isConnected = false;
 break;
@@ -264,14 +286,6 @@ class ConnectionState implements Watcher, Closeable
 break;
 }
 
-case Expired:
-{
-isConnected = false;
-checkNewConnectionString = false;
-handleExpiredSession();
-break;
-}
-
 case SaslAuthenticated:
 {
 // NOP
@@ -283,12 +297,19 @@ class ConnectionState implements Watcher, Closeable
 new EventTrace(state.toString(), tracer.get(), 
getSessionId()).commit();
 }
 
-if ( checkNewConnectionString && zooKeeper.hasNewConnectionString() )
+return isConnected;
+}
+
+private void handleState(Event.KeeperState state)
+{
+if (state == Event.KeeperState.Expired)
+{
+handleExpiredSession();
+}
+else if (zooKeeper.hasNewConnectionString())
 {
 handleNewConnectionString();
 }
-
-return isConnected;
 }
 
 private void handleNewConnectionString()

http://git-wip-us.apache.org/repos/asf/curator/blob/651ac591/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
 
b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestBlockUntilConnected.java
index a6dc7ab..7ea0849 100644
--- 

[3/6] curator git commit: Use debug flag instead of assertion

2017-02-28 Thread randgalt
Use debug flag instead of assertion


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

Branch: refs/heads/master
Commit: 7f53bc179aa738e847c9d097ef4e0ad8b76de4f9
Parents: 7c35e44
Author: Zoltan Szekeres 
Authored: Tue Jan 31 17:29:48 2017 +
Committer: Zoltan Szekeres 
Committed: Tue Jan 31 17:29:48 2017 +

--
 .../org/apache/curator/ConnectionState.java | 25 ---
 .../apache/curator/ConnectionStateAccessor.java | 33 
 .../framework/imps/TestBlockUntilConnected.java |  9 +-
 3 files changed, 55 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/curator/blob/7f53bc17/curator-client/src/main/java/org/apache/curator/ConnectionState.java
--
diff --git 
a/curator-client/src/main/java/org/apache/curator/ConnectionState.java 
b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
index bb4f08e..d7bf6d8 100644
--- a/curator-client/src/main/java/org/apache/curator/ConnectionState.java
+++ b/curator-client/src/main/java/org/apache/curator/ConnectionState.java
@@ -18,6 +18,7 @@
  */
 package org.apache.curator;
 
+import com.google.common.annotations.VisibleForTesting;
 import org.apache.curator.utils.CloseableUtils;
 import org.apache.curator.drivers.EventTrace;
 import org.apache.curator.drivers.OperationTrace;
@@ -56,6 +57,9 @@ class ConnectionState implements Watcher, Closeable
 private final AtomicLong instanceIndex = new AtomicLong();
 private volatile long connectionStartMs = 0;
 
+@VisibleForTesting
+volatile boolean debugWaitOnExpiredEvent = false;
+
 ConnectionState(ZookeeperFactory zookeeperFactory, EnsembleProvider 
ensembleProvider, int sessionTimeoutMs, int connectionTimeoutMs, Watcher 
parentWatcher, AtomicReference tracer, boolean canBeReadOnly)
 {
 this.ensembleProvider = ensembleProvider;
@@ -163,7 +167,10 @@ class ConnectionState implements Watcher, Closeable
 }
 
 // only wait during tests
-assert waitOnExpiredEvent(event.getState());
+if (debugWaitOnExpiredEvent && event.getState() == 
Event.KeeperState.Expired)
+{
+waitOnExpiredEvent();
+}
 
 for ( Watcher parentWatcher : parentWatchers )
 {
@@ -176,19 +183,15 @@ class ConnectionState implements Watcher, Closeable
 }
 
 // only for testing
-private boolean waitOnExpiredEvent(Event.KeeperState currentState)
+private void waitOnExpiredEvent()
 {
-if (currentState == Event.KeeperState.Expired)
+log.debug("Waiting on Expired event for testing");
+try
 {
-log.debug("Waiting on Expired event for testing");
-try
-{
-Thread.sleep(1000);
-}
-catch(InterruptedException e) {}
-log.debug("Continue processing");
+Thread.sleep(1000);
 }
-return true;
+catch(InterruptedException e) {}
+log.debug("Continue processing");
 }
 
 EnsembleProvider getEnsembleProvider()

http://git-wip-us.apache.org/repos/asf/curator/blob/7f53bc17/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
--
diff --git 
a/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
 
b/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
new file mode 100755
index 000..5b01166
--- /dev/null
+++ 
b/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.curator;
+
+import 

[6/6] curator git commit: Merge branch 'CURATOR-367'

2017-02-28 Thread randgalt
Merge branch 'CURATOR-367'


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

Branch: refs/heads/master
Commit: 585e1499d22a995b313bba9d32bd7a605faef5da
Parents: 35d2cc0 952dd6b
Author: randgalt 
Authored: Tue Feb 28 19:33:04 2017 -0300
Committer: randgalt 
Committed: Tue Feb 28 19:33:04 2017 -0300

--
 .../org/apache/curator/ConnectionState.java | 52 +
 .../apache/curator/ConnectionStateAccessor.java | 45 +++
 .../framework/imps/TestBlockUntilConnected.java | 82 
 3 files changed, 165 insertions(+), 14 deletions(-)
--