curator-dev mailing list archives

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

    https://github.com/apache/curator/pull/42#discussion_r19000667
  
    --- 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 --
    
    i'd like to see a test that exercises max depth from a starting point deeper than the
root or first node in the tree to ensure the null parent logic plays correctly there.


---
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