Add a deeper TreeCache test with maxDepth.

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

Branch: refs/heads/master
Commit: 530dd6e17e880db339e157d8f66ec64dbb31a7f2
Parents: b972825
Author: Scott Blum <dragonsi...@apache.org>
Authored: Mon Oct 20 16:05:41 2014 -0400
Committer: Scott Blum <dragonsi...@apache.org>
Committed: Mon Oct 20 16:05:41 2014 -0400

----------------------------------------------------------------------
 .../framework/recipes/cache/TestTreeCache.java  | 21 ++++++++++++++++++++
 1 file changed, 21 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/530dd6e1/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
----------------------------------------------------------------------
diff --git 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
index 497e997..bfd051a 100644
--- 
a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
+++ 
b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
@@ -115,6 +115,27 @@ public class TestTreeCache extends BaseTestTreeCache
     }
 
     @Test
+    public void testDepth1Deeper() throws Exception
+    {
+        client.create().forPath("/test");
+        client.create().forPath("/test/foo");
+        client.create().forPath("/test/foo/bar");
+        client.create().forPath("/test/foo/bar/1", "one".getBytes());
+        client.create().forPath("/test/foo/bar/2", "two".getBytes());
+        client.create().forPath("/test/foo/bar/3", "three".getBytes());
+        client.create().forPath("/test/foo/bar/2/sub", "two-sub".getBytes());
+
+        cache = buildWithListeners(TreeCache.newBuilder(client, 
"/test/foo/bar").setMaxDepth(1));
+        cache.start();
+        assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo/bar");
+        assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo/bar/1", 
"one".getBytes());
+        assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo/bar/2", 
"two".getBytes());
+        assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo/bar/3", 
"three".getBytes());
+        assertEvent(TreeCacheEvent.Type.INITIALIZED);
+        assertNoMoreEvents();
+    }
+
+    @Test
     public void testAsyncInitialPopulation() throws Exception
     {
         client.create().forPath("/test");

Reply via email to