@Test public void testDeleteThenCreate() throws Exception { client.create().forPath("/test"); client.create().forPath("/test/foo", "one".getBytes()); cache = newTreeCacheWithListeners(client, "/test"); cache.start(); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test"); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo"); assertEvent(TreeCacheEvent.Type.INITIALIZED); client.delete().forPath("/test/foo"); assertEvent(TreeCacheEvent.Type.NODE_REMOVED, "/test/foo", "one".getBytes()); client.create().forPath("/test/foo", "two".getBytes()); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo"); client.delete().forPath("/test/foo"); assertEvent(TreeCacheEvent.Type.NODE_REMOVED, "/test/foo", "two".getBytes()); client.create().forPath("/test/foo", "two".getBytes()); assertEvent(TreeCacheEvent.Type.NODE_ADDED, "/test/foo"); assertNoMoreEvents(); }
public TreeCache start() throws Exception { Preconditions.checkState(treeState.compareAndSet(TreeState.LATENT, TreeState.STARTED), "already started"); if ( createParentNodes ) { client.createContainers(root.path); } client.getConnectionStateListenable().addListener(connectionStateListener); if ( client.getZookeeperClient().isConnected() ) { root.wasCreated(); } return this; }
TreeCache implements Closeable { public TreeCache start() throws Exception { Preconditions.checkState(treeState.compareAndSet(TreeState.LATENT, TreeState.STARTED), "already started"); if ( createParentNodes ) { client.createContainers(root.path); } client.getConnectionStateListenable().addListener(connectionStateListener); if ( client.getZookeeperClient().isConnected() ) { root.wasCreated(); } return this; } }
TreeCache implements Closeable { public TreeCache start() throws Exception { Preconditions.checkState(treeState.compareAndSet(TreeState.LATENT, TreeState.STARTED), "already started"); if ( createParentNodes ) { client.createContainers(root.path); } client.getConnectionStateListenable().addListener(connectionStateListener); if ( client.getZookeeperClient().isConnected() ) { root.wasCreated(); } return this; } TreeCache(CuratorFramework client, String path);   TreeCache(CuratorFramework client, String path, boolean cacheData, boolean dataIsCompressed, int maxDepth, final ExecutorService executorService, boolean createParentNodes, boolean disableZkWatches, TreeCacheSelector selector); }
TreeCache implements Closeable { public TreeCache start() throws Exception { Preconditions.checkState(treeState.compareAndSet(TreeState.LATENT, TreeState.STARTED), "already started"); if ( createParentNodes ) { client.createContainers(root.path); } client.getConnectionStateListenable().addListener(connectionStateListener); if ( client.getZookeeperClient().isConnected() ) { root.wasCreated(); } return this; } TreeCache(CuratorFramework client, String path);   TreeCache(CuratorFramework client, String path, boolean cacheData, boolean dataIsCompressed, int maxDepth, final ExecutorService executorService, boolean createParentNodes, boolean disableZkWatches, TreeCacheSelector selector); static Builder newBuilder(CuratorFramework client, String path); TreeCache start(); @Override void close(); Listenable<TreeCacheListener> getListenable(); @VisibleForTesting Listenable<UnhandledErrorListener> getUnhandledErrorListenable(); Map<String, ChildData> getCurrentChildren(String fullPath); ChildData getCurrentData(String fullPath); }
TreeCache implements Closeable { public TreeCache start() throws Exception { Preconditions.checkState(treeState.compareAndSet(TreeState.LATENT, TreeState.STARTED), "already started"); if ( createParentNodes ) { client.createContainers(root.path); } client.getConnectionStateListenable().addListener(connectionStateListener); if ( client.getZookeeperClient().isConnected() ) { root.wasCreated(); } return this; } TreeCache(CuratorFramework client, String path);   TreeCache(CuratorFramework client, String path, boolean cacheData, boolean dataIsCompressed, int maxDepth, final ExecutorService executorService, boolean createParentNodes, boolean disableZkWatches, TreeCacheSelector selector); static Builder newBuilder(CuratorFramework client, String path); TreeCache start(); @Override void close(); Listenable<TreeCacheListener> getListenable(); @VisibleForTesting Listenable<UnhandledErrorListener> getUnhandledErrorListenable(); Map<String, ChildData> getCurrentChildren(String fullPath); ChildData getCurrentData(String fullPath);  }