curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dragonsinth <...@git.apache.org>
Subject [GitHub] curator pull request: CURATOR-145: TreeCache should implement maxD...
Date Mon, 20 Oct 2014 20:04:48 GMT
Github user dragonsinth commented on a diff in the pull request:

    https://github.com/apache/curator/pull/42#discussion_r19109606
  
    --- Diff: curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCache.java
---
    @@ -68,6 +68,53 @@ public void testStartEmpty() throws Exception
         }
     
         @Test
    +    public void testDepth0() throws Exception
    +    {
    +        client.create().forPath("/test");
    +        client.create().forPath("/test/1", "one".getBytes());
    +        client.create().forPath("/test/2", "two".getBytes());
    +        client.create().forPath("/test/3", "three".getBytes());
    +        client.create().forPath("/test/2/sub", "two-sub".getBytes());
    +
    +        cache = buildWithListeners(TreeCache.newBuilder(client, "/test").setMaxDepth(0));
    +        cache.start();
    +        assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test");
    +        assertEvent(TreeCacheEvent.Type.INITIALIZED);
    +        assertNoMoreEvents();
    +
    +        Assert.assertEquals(cache.getCurrentChildren("/test").keySet(), ImmutableSet.of());
    +        Assert.assertNull(cache.getCurrentData("/test/1"));
    +        Assert.assertNull(cache.getCurrentChildren("/test/1"));
    +        Assert.assertNull(cache.getCurrentData("/test/non_exist"));
    +    }
    +
    +    @Test
    +    public void testDepth1() throws Exception
    +    {
    +        client.create().forPath("/test");
    +        client.create().forPath("/test/1", "one".getBytes());
    +        client.create().forPath("/test/2", "two".getBytes());
    +        client.create().forPath("/test/3", "three".getBytes());
    +        client.create().forPath("/test/2/sub", "two-sub".getBytes());
    +
    +        cache = buildWithListeners(TreeCache.newBuilder(client, "/test").setMaxDepth(1));
    --- End diff --
    
    added


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message