Return-Path: X-Original-To: apmail-curator-dev-archive@minotaur.apache.org Delivered-To: apmail-curator-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A1F6A10889 for ; Fri, 17 Oct 2014 03:55:36 +0000 (UTC) Received: (qmail 84240 invoked by uid 500); 17 Oct 2014 03:55:36 -0000 Delivered-To: apmail-curator-dev-archive@curator.apache.org Received: (qmail 84195 invoked by uid 500); 17 Oct 2014 03:55:36 -0000 Mailing-List: contact dev-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list dev@curator.apache.org Received: (qmail 84176 invoked by uid 99); 17 Oct 2014 03:55:36 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Oct 2014 03:55:36 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B00D49D64D6; Fri, 17 Oct 2014 03:55:35 +0000 (UTC) From: cconroy To: dev@curator.apache.org Reply-To: dev@curator.apache.org References: In-Reply-To: Subject: [GitHub] curator pull request: CURATOR-145: TreeCache should implement maxD... Content-Type: text/plain Message-Id: <20141017035535.B00D49D64D6@tyr.zones.apache.org> Date: Fri, 17 Oct 2014 03:55:35 +0000 (UTC) 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. ---