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 2017/02/28 22:56:24 UTC
[01/12] curator git commit: closes #63 - This is now handled by
CURATOR-99
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 <ra...@apache.org>
Authored: Mon Jan 23 21:25:41 2017 -0500
Committer: randgalt <ra...@apache.org>
Committed: Mon Jan 23 21:25:41 2017 -0500
----------------------------------------------------------------------
----------------------------------------------------------------------
[09/12] curator git commit: removed vestigal Mockito import
Posted by ra...@apache.org.
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 <ra...@apache.org>
Authored: Tue Feb 28 19:47:37 2017 -0300
Committer: randgalt <ra...@apache.org>
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;
[02/12] curator git commit: Delay reconnect on session expired
Posted by ra...@apache.org.
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/CURATOR-3.0
Commit: 651ac591725567bf85ec830a45b9b062d5dd7474
Parents: 6d8c0be
Author: Zoltan Szekeres <Zo...@morganstanley.com>
Authored: Thu Jan 26 09:03:20 2017 -0500
Committer: Zoltan Szekeres <Zo...@morganstanley.com>
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
--- 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
@@ -21,6 +21,9 @@ package org.apache.curator.framework.imps;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
+import org.apache.curator.framework.api.CuratorEvent;
+import org.apache.curator.framework.api.CuratorEventType;
+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;
@@ -28,6 +31,7 @@ import org.apache.curator.test.BaseClassForTests;
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.testng.Assert;
import org.testng.annotations.Test;
import java.util.Timer;
@@ -256,4 +260,75 @@ public class TestBlockUntilConnected extends BaseClassForTests
}
}
}
+
+ /**
+ * Test that we got disconnected before calling blockUntilConnected and we reconnect we receive a session expired event.
+ */
+ @Test
+ public void testBlockUntilConnectedSessionExpired() throws Exception
+ {
+ Timing timing = new Timing();
+ CuratorFramework client = CuratorFrameworkFactory.builder().
+ connectString(server.getConnectString()).
+ retryPolicy(new RetryOneTime(1)).
+ build();
+
+ final CountDownLatch lostLatch = new CountDownLatch(1);
+ client.getConnectionStateListenable().addListener(new ConnectionStateListener()
+ {
+
+ @Override
+ public void stateChanged(CuratorFramework client, ConnectionState newState)
+ {
+ if ( newState == ConnectionState.LOST )
+ {
+ lostLatch.countDown();
+ }
+ }
+ });
+
+ final CountDownLatch expiredLatch = new CountDownLatch(1);
+ client.getCuratorListenable().addListener(new CuratorListener() {
+ @Override
+ public void eventReceived(CuratorFramework client, CuratorEvent event) throws Exception {
+ if (event.getType() == CuratorEventType.WATCHED && event.getWatchedEvent().getState() == Watcher.Event.KeeperState.Expired)
+ {
+ expiredLatch.countDown();
+ }
+ }
+ });
+
+ try
+ {
+ client.start();
+
+ //Block until we're connected
+ Assert.assertTrue(client.blockUntilConnected(5, TimeUnit.SECONDS), "Failed to connect");
+
+ final long sessionTimeoutMs = client.getZookeeperClient().getConnectionTimeoutMs();
+
+ //Kill the server
+ CloseableUtils.closeQuietly(server);
+
+ //Wait until we hit the lost state
+ Assert.assertTrue(timing.awaitLatch(lostLatch), "Failed to reach LOST state");
+
+ Thread.sleep(sessionTimeoutMs);
+
+ server = new TestingServer(server.getPort(), server.getTempDirectory());
+
+ //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");
+ }
+ catch ( Exception e )
+ {
+ Assert.fail("Unexpected exception " + e);
+ }
+ finally
+ {
+ CloseableUtils.closeQuietly(client);
+ }
+ }
}
[03/12] curator git commit: change timeout to 5s in
TestBlockUntilConnected
Posted by ra...@apache.org.
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 <Zo...@morganstanley.com>
Authored: Thu Jan 26 11:53:53 2017 -0500
Committer: Zoltan Szekeres <Zo...@morganstanley.com>
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 )
{
[08/12] curator git commit: Merge branch 'CURATOR-367'
Posted by ra...@apache.org.
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 <ra...@apache.org>
Authored: Tue Feb 28 19:33:04 2017 -0300
Committer: randgalt <ra...@apache.org>
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
Posted by ra...@apache.org.
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 <ra...@apache.org>
Authored: Tue Feb 28 19:55:52 2017 -0300
Committer: randgalt <ra...@apache.org>
Committed: Tue Feb 28 19:55:52 2017 -0300
----------------------------------------------------------------------
.../apache/curator/ConnectionStateAccessor.java | 45 ++++++++++++++++++++
1 file changed, 45 insertions(+)
----------------------------------------------------------------------
[04/12] curator git commit: Use debug flag instead of assertion
Posted by ra...@apache.org.
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 <Zo...@morganstanley.com>
Authored: Tue Jan 31 17:29:48 2017 +0000
Committer: Zoltan Szekeres <Zo...@morganstanley.com>
Committed: Tue Jan 31 17:29:48 2017 +0000
----------------------------------------------------------------------
.../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<TracerDriver> 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 0000000..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 org.apache.curator.framework.CuratorFramework;
+import org.mockito.internal.util.reflection.Whitebox;
+
+public final class ConnectionStateAccessor
+{
+ public static final void setDebugWaitOnExpiredForClient(CuratorFramework client)
+ {
+ CuratorZookeeperClient zookeeperClient = client.getZookeeperClient();
+ ConnectionState state = (ConnectionState)Whitebox.getInternalState(zookeeperClient, "state");
+ state.debugWaitOnExpiredEvent = true;
+ }
+}
http://git-wip-us.apache.org/repos/asf/curator/blob/7f53bc17/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 debf7f9..3597f95 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
@@ -19,6 +19,8 @@
package org.apache.curator.framework.imps;
+import org.apache.curator.ConnectionStateAccessor;
+import org.apache.curator.CuratorZookeeperClient;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.framework.api.CuratorEvent;
@@ -32,6 +34,7 @@ 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;
@@ -298,6 +301,8 @@ public class TestBlockUntilConnected extends BaseClassForTests
}
});
+ ConnectionStateAccessor.setDebugWaitOnExpiredForClient(client);
+
try
{
client.start();
@@ -320,7 +325,9 @@ 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(5, TimeUnit.SECONDS), "Not connected");
+ final boolean blockUntilConnected5Seconds = client.blockUntilConnected(5, TimeUnit.SECONDS);
+ Assert.assertTrue(client.getZookeeperClient().isConnected(), "ConnectionState.isConnected returned false");
+ Assert.assertTrue(blockUntilConnected5Seconds, "BlockUntilConnected returned false");
}
catch ( Exception e )
{
[06/12] curator git commit: Remove mockito dependency from
curator-framework tests
Posted by ra...@apache.org.
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 <Zo...@morganstanley.com>
Authored: Tue Feb 7 11:05:47 2017 +0100
Committer: Zoltan Szekeres <Zo...@morganstanley.com>
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 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <scope>test</scope>
- </dependency>
</dependencies>
</project>
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);
+ }
+ }
}
[05/12] curator git commit: Add test dependency mockito to
curator-framework
Posted by ra...@apache.org.
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/CURATOR-3.0
Commit: 4a95669873604f200c379142d1376055af64a3a6
Parents: 7f53bc1
Author: Zoltan Szekeres <Zo...@morganstanley.com>
Authored: Thu Feb 2 11:24:33 2017 +0100
Committer: Zoltan Szekeres <Zo...@morganstanley.com>
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 @@
<artifactId>slf4j-log4j12</artifactId>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
[12/12] curator git commit: not needed
Posted by ra...@apache.org.
not needed
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/753142a7
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/753142a7
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/753142a7
Branch: refs/heads/CURATOR-3.0
Commit: 753142a7652401510096b35c516077b9b8fe38e5
Parents: d7a65ad
Author: randgalt <ra...@apache.org>
Authored: Tue Feb 28 19:56:12 2017 -0300
Committer: randgalt <ra...@apache.org>
Committed: Tue Feb 28 19:56:12 2017 -0300
----------------------------------------------------------------------
.../apache/curator/ConnectionStateAccessor.java | 45 --------------------
1 file changed, 45 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/753142a7/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
deleted file mode 100644
index 0efa989..0000000
--- a/curator-framework/src/test/java/org/apache/curator/ConnectionStateAccessor.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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 org.apache.curator.framework.CuratorFramework;
-
-import java.lang.reflect.Field;
-
-public final class ConnectionStateAccessor
-{
- public static void setDebugWaitOnExpiredForClient(CuratorFramework client)
- {
- CuratorZookeeperClient zookeeperClient = client.getZookeeperClient();
- 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);
- }
- }
-}
[10/12] curator git commit: Merge branch 'CURATOR-367'
Posted by ra...@apache.org.
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/CURATOR-3.0
Commit: e2aef818200b42bd289f5b1fb84ce45220cc99d4
Parents: 585e149 d5daa4c
Author: randgalt <ra...@apache.org>
Authored: Tue Feb 28 19:47:45 2017 -0300
Committer: randgalt <ra...@apache.org>
Committed: Tue Feb 28 19:47:45 2017 -0300
----------------------------------------------------------------------
.../org/apache/curator/framework/imps/TestBlockUntilConnected.java | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
[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
Posted by ra...@apache.org.
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 <ra...@apache.org>
Authored: Thu Feb 16 12:16:22 2017 -0200
Committer: randgalt <ra...@apache.org>
Committed: Thu Feb 16 12:16:22 2017 -0200
----------------------------------------------------------------------
----------------------------------------------------------------------