curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-145) TreeCache should implement maxDepth
Date Mon, 20 Oct 2014 20:05:33 GMT

    [ https://issues.apache.org/jira/browse/CURATOR-145?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14177405#comment-14177405
] 

ASF GitHub Bot commented on CURATOR-145:
----------------------------------------

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


> TreeCache should implement maxDepth
> -----------------------------------
>
>                 Key: CURATOR-145
>                 URL: https://issues.apache.org/jira/browse/CURATOR-145
>             Project: Apache Curator
>          Issue Type: Improvement
>          Components: Recipes
>            Reporter: Scott Blum
>   Original Estimate: 48h
>  Remaining Estimate: 48h
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message