@Test public void testUpdateServerList() { String serverList = "list: ListNamingService namingService = new ListNamingService(new BrpcURL(serverList)); List<ServiceInstance> instances = namingService.lookup(null); assertThat(instances, hasItems( new ServiceInstance("1.1.1.1", 1111), new ServiceInstance("2.2.2.2", 2222) )); assertThat(instances.size(), is(2)); }
@Override public List<ServiceInstance> lookup(SubscribeInfo subscribeInfo) { for (ServiceInstance instance : instances) { if (subscribeInfo != null && StringUtils.isNoneBlank(subscribeInfo.getServiceId())) { instance.setServiceName(subscribeInfo.getServiceId()); } } return instances; }
ListNamingService implements NamingService { @Override public List<ServiceInstance> lookup(SubscribeInfo subscribeInfo) { for (ServiceInstance instance : instances) { if (subscribeInfo != null && StringUtils.isNoneBlank(subscribeInfo.getServiceId())) { instance.setServiceName(subscribeInfo.getServiceId()); } } return instances; } }
ListNamingService implements NamingService { @Override public List<ServiceInstance> lookup(SubscribeInfo subscribeInfo) { for (ServiceInstance instance : instances) { if (subscribeInfo != null && StringUtils.isNoneBlank(subscribeInfo.getServiceId())) { instance.setServiceName(subscribeInfo.getServiceId()); } } return instances; } ListNamingService(BrpcURL namingUrl); }
ListNamingService implements NamingService { @Override public List<ServiceInstance> lookup(SubscribeInfo subscribeInfo) { for (ServiceInstance instance : instances) { if (subscribeInfo != null && StringUtils.isNoneBlank(subscribeInfo.getServiceId())) { instance.setServiceName(subscribeInfo.getServiceId()); } } return instances; } ListNamingService(BrpcURL namingUrl); @Override List<ServiceInstance> lookup(SubscribeInfo subscribeInfo); @Override void subscribe(SubscribeInfo subscribeInfo, final NotifyListener listener); @Override void unsubscribe(SubscribeInfo subscribeInfo); @Override void register(RegisterInfo registerInfo); @Override void unregister(RegisterInfo registerInfo); @Override void destroy(); }
ListNamingService implements NamingService { @Override public List<ServiceInstance> lookup(SubscribeInfo subscribeInfo) { for (ServiceInstance instance : instances) { if (subscribeInfo != null && StringUtils.isNoneBlank(subscribeInfo.getServiceId())) { instance.setServiceName(subscribeInfo.getServiceId()); } } return instances; } ListNamingService(BrpcURL namingUrl); @Override List<ServiceInstance> lookup(SubscribeInfo subscribeInfo); @Override void subscribe(SubscribeInfo subscribeInfo, final NotifyListener listener); @Override void unsubscribe(SubscribeInfo subscribeInfo); @Override void register(RegisterInfo registerInfo); @Override void unregister(RegisterInfo registerInfo); @Override void destroy();  }