@Test public void returnNoVersion_WhenDataStoreThrowsException_AndCacheIsNotUsed() throws Exception { testee = new ZkNodeCacheWrapper(client, "/test", null); setupZookeeperConnectorThrowsException(new DataSourceConnectorException()); int result = testee.getCurrentDataVersion(); Assert.assertEquals(NO_MODEL_NODE_VERSION, result); }
@Override public int getCurrentDataVersion() { int result = RedirectorConstants.NO_MODEL_NODE_VERSION; if (isCacheUsageAllowed()) { ChildData data = cache.getCurrentData(); if (data != null && data.getStat() != null) { result = data.getStat().getVersion(); } } else { try { if (connector.isPathExists(path)) { result = connector.getNodeVersion(path); } else { log.warn("Node {} does not exist", path); } } catch (DataSourceConnectorException e) { log.error("Failed to get data for zkPath={} {}", path, e); } } return result; }
ZkNodeCacheWrapper extends BaseCacheWrapper implements INodeCacheWrapper { @Override public int getCurrentDataVersion() { int result = RedirectorConstants.NO_MODEL_NODE_VERSION; if (isCacheUsageAllowed()) { ChildData data = cache.getCurrentData(); if (data != null && data.getStat() != null) { result = data.getStat().getVersion(); } } else { try { if (connector.isPathExists(path)) { result = connector.getNodeVersion(path); } else { log.warn("Node {} does not exist", path); } } catch (DataSourceConnectorException e) { log.error("Failed to get data for zkPath={} {}", path, e); } } return result; } }
ZkNodeCacheWrapper extends BaseCacheWrapper implements INodeCacheWrapper { @Override public int getCurrentDataVersion() { int result = RedirectorConstants.NO_MODEL_NODE_VERSION; if (isCacheUsageAllowed()) { ChildData data = cache.getCurrentData(); if (data != null && data.getStat() != null) { result = data.getStat().getVersion(); } } else { try { if (connector.isPathExists(path)) { result = connector.getNodeVersion(path); } else { log.warn("Node {} does not exist", path); } } catch (DataSourceConnectorException e) { log.error("Failed to get data for zkPath={} {}", path, e); } } return result; } ZkNodeCacheWrapper(IDataSourceConnector connector, String path, NodeCache cache);  ZkNodeCacheWrapper(IDataSourceConnector connector, String path, NodeCache cache, boolean dataIsCompressed, boolean useCache, boolean useCacheWhenNotConnectedToDataSource);  ZkNodeCacheWrapper(IDataSourceConnector connector, String path, NodeCache cache, boolean useCache, boolean useCacheWhenNotConnectedToDataSource); }
ZkNodeCacheWrapper extends BaseCacheWrapper implements INodeCacheWrapper { @Override public int getCurrentDataVersion() { int result = RedirectorConstants.NO_MODEL_NODE_VERSION; if (isCacheUsageAllowed()) { ChildData data = cache.getCurrentData(); if (data != null && data.getStat() != null) { result = data.getStat().getVersion(); } } else { try { if (connector.isPathExists(path)) { result = connector.getNodeVersion(path); } else { log.warn("Node {} does not exist", path); } } catch (DataSourceConnectorException e) { log.error("Failed to get data for zkPath={} {}", path, e); } } return result; } ZkNodeCacheWrapper(IDataSourceConnector connector, String path, NodeCache cache);  ZkNodeCacheWrapper(IDataSourceConnector connector, String path, NodeCache cache, boolean dataIsCompressed, boolean useCache, boolean useCacheWhenNotConnectedToDataSource);  ZkNodeCacheWrapper(IDataSourceConnector connector, String path, NodeCache cache, boolean useCache, boolean useCacheWhenNotConnectedToDataSource); @Override void start(final boolean buildInitial); @Override void addListener(NodeCacheListener listener); @Override void rebuild(); @Override void close(); @Override byte[] getCurrentData(); @Override int getCurrentDataVersion(); @Override String getPath(); boolean isUseCache(); }
ZkNodeCacheWrapper extends BaseCacheWrapper implements INodeCacheWrapper { @Override public int getCurrentDataVersion() { int result = RedirectorConstants.NO_MODEL_NODE_VERSION; if (isCacheUsageAllowed()) { ChildData data = cache.getCurrentData(); if (data != null && data.getStat() != null) { result = data.getStat().getVersion(); } } else { try { if (connector.isPathExists(path)) { result = connector.getNodeVersion(path); } else { log.warn("Node {} does not exist", path); } } catch (DataSourceConnectorException e) { log.error("Failed to get data for zkPath={} {}", path, e); } } return result; } ZkNodeCacheWrapper(IDataSourceConnector connector, String path, NodeCache cache);  ZkNodeCacheWrapper(IDataSourceConnector connector, String path, NodeCache cache, boolean dataIsCompressed, boolean useCache, boolean useCacheWhenNotConnectedToDataSource);  ZkNodeCacheWrapper(IDataSourceConnector connector, String path, NodeCache cache, boolean useCache, boolean useCacheWhenNotConnectedToDataSource); @Override void start(final boolean buildInitial); @Override void addListener(NodeCacheListener listener); @Override void rebuild(); @Override void close(); @Override byte[] getCurrentData(); @Override int getCurrentDataVersion(); @Override String getPath(); boolean isUseCache();  }