Repository: curator Updated Branches: refs/heads/CURATOR-33 267492779 -> 74497c0d2
Style tweaks. Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/74497c0d Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/74497c0d Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/74497c0d Branch: refs/heads/CURATOR-33 Commit: 74497c0d23c0eeeadee47dec6b3da116e05480b6 Parents: 2674927 Author: Scott Blum <sco...@squareup.com> Authored: Wed Aug 6 22:03:44 2014 -0400 Committer: Scott Blum <sco...@squareup.com> Committed: Wed Aug 6 22:03:44 2014 -0400 ---------------------------------------------------------------------- .../recipes/cache/BaseTestTreeCache.java | 7 +++---- .../framework/recipes/cache/TestTreeCache.java | 20 +++++++++++++++----- .../recipes/cache/TestTreeCacheRandomTree.java | 5 ++--- 3 files changed, 20 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/74497c0d/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/BaseTestTreeCache.java ---------------------------------------------------------------------- diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/BaseTestTreeCache.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/BaseTestTreeCache.java index f59af30..5842c21 100644 --- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/BaseTestTreeCache.java +++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/BaseTestTreeCache.java @@ -39,7 +39,7 @@ public class BaseTestTreeCache extends BaseClassForTests { private final Timing timing = new Timing(); CuratorFramework client; - TreeCache cache; + MyTreeCache cache; private List<Throwable> exceptions; private BlockingQueue<TreeCacheEvent> events; TreeCacheListener eventListener; @@ -47,10 +47,10 @@ public class BaseTestTreeCache extends BaseClassForTests /** * A TreeCache that records exceptions and automatically adds a listener. */ - class TreeCache extends org.apache.curator.framework.recipes.cache.TreeCache + class MyTreeCache extends TreeCache { - TreeCache(CuratorFramework client, String path, boolean cacheData) + MyTreeCache(CuratorFramework client, String path, boolean cacheData) { super(client, path, cacheData); getListenable().addListener(eventListener); @@ -95,7 +95,6 @@ public class BaseTestTreeCache extends BaseClassForTests exceptions.add(e); } }); - cache = new TreeCache(client, "/test", true); } @Override http://git-wip-us.apache.org/repos/asf/curator/blob/74497c0d/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 f35d24d..33d08b0 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 @@ -39,6 +39,7 @@ public class TestTreeCache extends BaseTestTreeCache client.create().forPath("/test/3", "three".getBytes()); client.create().forPath("/test/2/sub", "two-sub".getBytes()); + cache = new MyTreeCache(client, "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/1", "one".getBytes()); @@ -57,6 +58,7 @@ public class TestTreeCache extends BaseTestTreeCache @Test public void testStartEmpty() throws Exception { + cache = new MyTreeCache(client, "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.INITIALIZED); @@ -71,6 +73,7 @@ public class TestTreeCache extends BaseTestTreeCache client.create().forPath("/test"); client.create().forPath("/test/one", "hey there".getBytes()); + cache = new MyTreeCache(client, "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/one"); @@ -84,7 +87,7 @@ public class TestTreeCache extends BaseTestTreeCache client.create().forPath("/test"); client.create().forPath("/test/one", "hey there".getBytes()); - cache = new TreeCache(client, "/", true); + cache = new MyTreeCache(client, "/", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/"); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); @@ -106,7 +109,7 @@ public class TestTreeCache extends BaseTestTreeCache client.create().forPath("/outer/test"); client.create().forPath("/outer/test/one", "hey there".getBytes()); - cache = new TreeCache(client.usingNamespace("outer"), "/test", true); + cache = new MyTreeCache(client.usingNamespace("outer"), "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/one"); @@ -126,7 +129,7 @@ public class TestTreeCache extends BaseTestTreeCache client.create().forPath("/outer/test"); client.create().forPath("/outer/test/one", "hey there".getBytes()); - cache = new TreeCache(client.usingNamespace("outer"), "/", true); + cache = new MyTreeCache(client.usingNamespace("outer"), "/", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/"); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/foo"); @@ -144,6 +147,7 @@ public class TestTreeCache extends BaseTestTreeCache @Test public void testSyncInitialPopulation() throws Exception { + cache = new MyTreeCache(client, "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.INITIALIZED); @@ -162,6 +166,7 @@ public class TestTreeCache extends BaseTestTreeCache client.create().forPath("/test/2", "2".getBytes()); client.create().forPath("/test/3", "3".getBytes()); + cache = new MyTreeCache(client, "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/1"); @@ -176,7 +181,7 @@ public class TestTreeCache extends BaseTestTreeCache { client.create().forPath("/test"); - cache = new TreeCache(client, "/test", false); + cache = new MyTreeCache(client, "/test", false); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.INITIALIZED); @@ -195,6 +200,7 @@ public class TestTreeCache extends BaseTestTreeCache client.create().forPath("/test"); client.create().forPath("/test/foo", "one".getBytes()); + cache = new MyTreeCache(client, "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo"); @@ -213,6 +219,7 @@ public class TestTreeCache extends BaseTestTreeCache { client.create().forPath("/test"); + cache = new MyTreeCache(client, "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.INITIALIZED); @@ -236,6 +243,7 @@ public class TestTreeCache extends BaseTestTreeCache { client.create().forPath("/test"); + cache = new MyTreeCache(client, "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.INITIALIZED); @@ -261,7 +269,7 @@ public class TestTreeCache extends BaseTestTreeCache @Test public void testBasicsOnTwoCaches() throws Exception { - TreeCache cache2 = new TreeCache(client, "/test", true); + MyTreeCache cache2 = new MyTreeCache(client, "/test", true); cache2.getListenable().removeListener(eventListener); // Don't listen on the second cache. // Just ensures the same event count; enables test flow control on cache2. @@ -279,6 +287,7 @@ public class TestTreeCache extends BaseTestTreeCache { client.create().forPath("/test"); + cache = new MyTreeCache(client, "/test", true); cache.start(); cache2.start(); @@ -318,6 +327,7 @@ public class TestTreeCache extends BaseTestTreeCache { client.create().forPath("/test"); + cache = new MyTreeCache(client, "/test", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.INITIALIZED); http://git-wip-us.apache.org/repos/asf/curator/blob/74497c0d/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCacheRandomTree.java ---------------------------------------------------------------------- diff --git a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCacheRandomTree.java b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCacheRandomTree.java index 368b557..304bfe3 100644 --- a/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCacheRandomTree.java +++ b/curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/TestTreeCacheRandomTree.java @@ -63,8 +63,7 @@ public class TestTreeCacheRandomTree extends BaseTestTreeCache { client.create().forPath("/tree", null); CuratorFramework cl = client.usingNamespace("tree"); - cache = new TreeCache(cl, "/", true); - cache.getListenable().addListener(eventListener); + cache = new MyTreeCache(cl, "/", true); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/"); assertEvent(TreeCacheEvent.Type.INITIALIZED); @@ -170,7 +169,7 @@ public class TestTreeCacheRandomTree extends BaseTestTreeCache /** * Recursively assert that current children equal expected children. */ - private static void assertTreeEquals(TreeCache cache, TestNode expectedNode) + private static void assertTreeEquals(MyTreeCache cache, TestNode expectedNode) { String path = expectedNode.fullPath; Map<String, ChildData> cacheChildren = cache.getCurrentChildren(path);