@Test public void testInitialUpdateWithKeys() throws Exception { List<String> children = Arrays.asList("1", "5"); AuthenticationKey key1 = new AuthenticationKey(1, 0L, 10000L, keyGen.generateKey()), key2 = new AuthenticationKey(5, key1.getExpirationDate(), 20000L, keyGen.generateKey()); expect(zk.exists(baseNode, keyWatcher)).andReturn(true); expect(zk.getChildren(baseNode, keyWatcher)).andReturn(children); expect(zk.getData(baseNode + "/" + key1.getKeyId(), keyWatcher, null)) .andReturn(serialize(key1)); expect(zk.getData(baseNode + "/" + key2.getKeyId(), keyWatcher, null)) .andReturn(serialize(key2)); replay(zk); keyWatcher.updateAuthKeys(); verify(zk); assertEquals(2, secretManager.getKeys().size()); assertEquals(key1, secretManager.getKeys().get(key1.getKeyId())); assertEquals(key2, secretManager.getKeys().get(key2.getKeyId())); }
public void updateAuthKeys() throws KeeperException, InterruptedException { if (zk.exists(baseNode, this)) { log.info("Added {} existing AuthenticationKeys to local cache from ZooKeeper", updateAuthKeys(baseNode)); } }
ZooAuthenticationKeyWatcher implements Watcher { public void updateAuthKeys() throws KeeperException, InterruptedException { if (zk.exists(baseNode, this)) { log.info("Added {} existing AuthenticationKeys to local cache from ZooKeeper", updateAuthKeys(baseNode)); } } }
ZooAuthenticationKeyWatcher implements Watcher { public void updateAuthKeys() throws KeeperException, InterruptedException { if (zk.exists(baseNode, this)) { log.info("Added {} existing AuthenticationKeys to local cache from ZooKeeper", updateAuthKeys(baseNode)); } } ZooAuthenticationKeyWatcher(AuthenticationTokenSecretManager secretManager, ZooReader zk,
      String baseNode); }
ZooAuthenticationKeyWatcher implements Watcher { public void updateAuthKeys() throws KeeperException, InterruptedException { if (zk.exists(baseNode, this)) { log.info("Added {} existing AuthenticationKeys to local cache from ZooKeeper", updateAuthKeys(baseNode)); } } ZooAuthenticationKeyWatcher(AuthenticationTokenSecretManager secretManager, ZooReader zk,
      String baseNode); @Override void process(WatchedEvent event); void updateAuthKeys(); }
ZooAuthenticationKeyWatcher implements Watcher { public void updateAuthKeys() throws KeeperException, InterruptedException { if (zk.exists(baseNode, this)) { log.info("Added {} existing AuthenticationKeys to local cache from ZooKeeper", updateAuthKeys(baseNode)); } } ZooAuthenticationKeyWatcher(AuthenticationTokenSecretManager secretManager, ZooReader zk,
      String baseNode); @Override void process(WatchedEvent event); void updateAuthKeys();  }