@Test public void verifyNodesRemovedWhilePathChildrenCacheIsDownAreDetected() throws Exception { final String foo1 = "/foos/foo1"; final String foo2 = "/foos/foo2"; final Set<String> paths = ImmutableSet.of(foo1, foo2); for (final String path : paths) { ensure(path, new DataPojo(path)); } Polling.await(5, MINUTES, new Callable<Object>() { @Override public Object call() throws Exception { return cache.getNodes().keySet().equals(paths) ? true : null; } }); verify(listener, atLeastOnce()).nodesChanged(cache); stopCache(); try { zk.curatorWithSuperAuth().delete().forPath(foo1); } catch (NoNodeException ignore) { } startCache(); final Set<String> postDeletePaths = ImmutableSet.of(foo2); Polling.await(5, MINUTES, new Callable<Object>() { @Override public Object call() throws Exception { return cache.getNodes().keySet().equals(postDeletePaths) ? true : null; } }); verify(listener, atLeastOnce()).nodesChanged(cache); }
public Map<String, T> getNodes() { return snapshot.get(); }
PersistentPathChildrenCache extends AbstractIdleService { public Map<String, T> getNodes() { return snapshot.get(); } }
PersistentPathChildrenCache extends AbstractIdleService { public Map<String, T> getNodes() { return snapshot.get(); } PersistentPathChildrenCache(final CuratorFramework curator, final String path,
                                     final String clusterId, final Path snapshotFile,
                                     final JavaType valueType); }
PersistentPathChildrenCache extends AbstractIdleService { public Map<String, T> getNodes() { return snapshot.get(); } PersistentPathChildrenCache(final CuratorFramework curator, final String path,
                                     final String clusterId, final Path snapshotFile,
                                     final JavaType valueType); void addListener(final Listener listener); void removeListener(final Listener listener); Map<String, T> getNodes(); }
PersistentPathChildrenCache extends AbstractIdleService { public Map<String, T> getNodes() { return snapshot.get(); } PersistentPathChildrenCache(final CuratorFramework curator, final String path,
                                     final String clusterId, final Path snapshotFile,
                                     final JavaType valueType); void addListener(final Listener listener); void removeListener(final Listener listener); Map<String, T> getNodes();  }