@Test public void testLookup() throws Exception { RegistryService registryService = mock(ConsulRegistryServiceImpl.class); registryService.lookup("test-key"); verify(registryService).lookup("test-key"); }
@Override public List<InetSocketAddress> lookup(String key) throws Exception { final String cluster = getServiceGroup(key); if (null == cluster) { return null; } if (!listenerMap.containsKey(cluster)) { refreshCluster(cluster); subscribe(cluster, services -> { refreshCluster(cluster, services); }); } return clusterAddressMap.get(cluster); }
ConsulRegistryServiceImpl implements RegistryService<ConsulListener> { @Override public List<InetSocketAddress> lookup(String key) throws Exception { final String cluster = getServiceGroup(key); if (null == cluster) { return null; } if (!listenerMap.containsKey(cluster)) { refreshCluster(cluster); subscribe(cluster, services -> { refreshCluster(cluster, services); }); } return clusterAddressMap.get(cluster); } }
ConsulRegistryServiceImpl implements RegistryService<ConsulListener> { @Override public List<InetSocketAddress> lookup(String key) throws Exception { final String cluster = getServiceGroup(key); if (null == cluster) { return null; } if (!listenerMap.containsKey(cluster)) { refreshCluster(cluster); subscribe(cluster, services -> { refreshCluster(cluster, services); }); } return clusterAddressMap.get(cluster); } private  ConsulRegistryServiceImpl(); }
ConsulRegistryServiceImpl implements RegistryService<ConsulListener> { @Override public List<InetSocketAddress> lookup(String key) throws Exception { final String cluster = getServiceGroup(key); if (null == cluster) { return null; } if (!listenerMap.containsKey(cluster)) { refreshCluster(cluster); subscribe(cluster, services -> { refreshCluster(cluster, services); }); } return clusterAddressMap.get(cluster); } private  ConsulRegistryServiceImpl(); @Override void register(InetSocketAddress address); @Override void unregister(InetSocketAddress address); @Override void subscribe(String cluster, ConsulListener listener); @Override void unsubscribe(String cluster, ConsulListener listener); @Override List<InetSocketAddress> lookup(String key); @Override void close(); }
ConsulRegistryServiceImpl implements RegistryService<ConsulListener> { @Override public List<InetSocketAddress> lookup(String key) throws Exception { final String cluster = getServiceGroup(key); if (null == cluster) { return null; } if (!listenerMap.containsKey(cluster)) { refreshCluster(cluster); subscribe(cluster, services -> { refreshCluster(cluster, services); }); } return clusterAddressMap.get(cluster); } private  ConsulRegistryServiceImpl(); @Override void register(InetSocketAddress address); @Override void unregister(InetSocketAddress address); @Override void subscribe(String cluster, ConsulListener listener); @Override void unsubscribe(String cluster, ConsulListener listener); @Override List<InetSocketAddress> lookup(String key); @Override void close();  }