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/22 00:49:59 UTC
curator git commit: more tests
Repository: curator
Updated Branches:
refs/heads/CURATOR-247 c5a49216c -> d31700997
more tests
Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/d3170099
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/d3170099
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/d3170099
Branch: refs/heads/CURATOR-247
Commit: d3170099757c7e17ff8fbee0c37d620aacb60d65
Parents: c5a4921
Author: randgalt <ra...@apache.org>
Authored: Fri Aug 21 17:49:55 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Fri Aug 21 17:49:55 2015 -0500
----------------------------------------------------------------------
.../imps/TestEnabledSessionExpiredState.java | 24 ++++++++++++++++++++
1 file changed, 24 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/curator/blob/d3170099/curator-framework/src/test/java/org/apache/curator/framework/imps/TestEnabledSessionExpiredState.java
----------------------------------------------------------------------
diff --git a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestEnabledSessionExpiredState.java b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestEnabledSessionExpiredState.java
index 4c5ff81..150eb50 100644
--- a/curator-framework/src/test/java/org/apache/curator/framework/imps/TestEnabledSessionExpiredState.java
+++ b/curator-framework/src/test/java/org/apache/curator/framework/imps/TestEnabledSessionExpiredState.java
@@ -109,6 +109,30 @@ public class TestEnabledSessionExpiredState extends BaseClassForTests
Assert.assertEquals(states.poll(timing.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.RECONNECTED);
}
+ @Test
+ public void testSessionExpirationFromTimeout() throws Exception
+ {
+ Assert.assertEquals(states.poll(timing.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.CONNECTED);
+ server.stop();
+ Assert.assertEquals(states.poll(timing.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.SUSPENDED);
+ Assert.assertEquals(states.poll(timing.multiple(2).session(), TimeUnit.MILLISECONDS), ConnectionState.LOST);
+ }
+
+ @Test
+ public void testSessionExpirationFromTimeoutWithRestart() throws Exception
+ {
+ Assert.assertEquals(states.poll(timing.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.CONNECTED);
+ server.stop();
+ Thread.sleep(timing.multiple(1.2).session());
+ Assert.assertEquals(states.poll(timing.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.SUSPENDED);
+ Assert.assertEquals(states.poll(timing.multiple(2).session(), TimeUnit.MILLISECONDS), ConnectionState.LOST);
+ server.restart();
+ client.checkExists().forPath("/");
+ Assert.assertEquals(states.poll(timing.milliseconds(), TimeUnit.MILLISECONDS), ConnectionState.RECONNECTED);
+
+ Assert.assertNull(states.poll(timing.multiple(.5).milliseconds(), TimeUnit.MILLISECONDS)); // there should be no other events
+ }
+
@Override
protected boolean enabledSessionExpiredStateAware()
{