@Test public void testAddListener() throws Exception { ArgumentCaptor<RegistryClient.Entry> args = ArgumentCaptor.forClass(RegistryClient.Entry.class); InetSocketAddress addr = new InetSocketAddress(1234); CountDownLatch latch = new CountDownLatch(1); registryClient.addListener(entry1 -> { if (entry1.gondolaAddress.equals(addr)) { latch.countDown(); } }); String hostId = registryClient.register(SITE_1_HOST_1_CLUSTER, addr, URI.create("https: latch.await(); verify(listener, times(1)).accept(args.capture()); RegistryClient.Entry entry = args.getValue(); assertEquals(entry.hostId, hostId); }
@Override public void addListener(Consumer<Entry> listener) { listeners.add(listener); }
ZookeeperRegistryClient implements RegistryClient { @Override public void addListener(Consumer<Entry> listener) { listeners.add(listener); } }
ZookeeperRegistryClient implements RegistryClient { @Override public void addListener(Consumer<Entry> listener) { listeners.add(listener); } protected  ZookeeperRegistryClient(CuratorFramework curatorFramework, ObjectMapper objectMapper, Config config); }
ZookeeperRegistryClient implements RegistryClient { @Override public void addListener(Consumer<Entry> listener) { listeners.add(listener); } protected  ZookeeperRegistryClient(CuratorFramework curatorFramework, ObjectMapper objectMapper, Config config); @Override String register(String siteId, InetSocketAddress gondolaAddress, URI serviceUri); @Override void addListener(Consumer<Entry> listener); @Override Map<String, Entry> getEntries(); @Override boolean waitForClusterComplete(int timeoutMs); }
ZookeeperRegistryClient implements RegistryClient { @Override public void addListener(Consumer<Entry> listener) { listeners.add(listener); } protected  ZookeeperRegistryClient(CuratorFramework curatorFramework, ObjectMapper objectMapper, Config config); @Override String register(String siteId, InetSocketAddress gondolaAddress, URI serviceUri); @Override void addListener(Consumer<Entry> listener); @Override Map<String, Entry> getEntries(); @Override boolean waitForClusterComplete(int timeoutMs); static final String GONDOLA_HOSTS; }