@Test public void testNonEmptyMap() { Map<String, String> endPoints = ImmutableMap.of("id", "payload"); HostDiscoverySource source = new ConfiguredFixedHostDiscoverySource<String>(endPoints); assertNotNull(source.forService("service")); }
@Override public HostDiscovery forService(String serviceName) { if (_endPoints.isEmpty()) { return null; } List<ServiceEndPoint> endPoints = Lists.newArrayListWithCapacity(_endPoints.size()); for (Map.Entry<String, Payload> entry : _endPoints.entrySet()) { String id = entry.getKey(); Payload payload = entry.getValue(); endPoints.add(new ServiceEndPointBuilder() .withServiceName(serviceName) .withId(id) .withPayload(serialize(serviceName, id, payload)) .build()); } return new FixedHostDiscovery(endPoints); }
ConfiguredFixedHostDiscoverySource implements HostDiscoverySource { @Override public HostDiscovery forService(String serviceName) { if (_endPoints.isEmpty()) { return null; } List<ServiceEndPoint> endPoints = Lists.newArrayListWithCapacity(_endPoints.size()); for (Map.Entry<String, Payload> entry : _endPoints.entrySet()) { String id = entry.getKey(); Payload payload = entry.getValue(); endPoints.add(new ServiceEndPointBuilder() .withServiceName(serviceName) .withId(id) .withPayload(serialize(serviceName, id, payload)) .build()); } return new FixedHostDiscovery(endPoints); } }
ConfiguredFixedHostDiscoverySource implements HostDiscoverySource { @Override public HostDiscovery forService(String serviceName) { if (_endPoints.isEmpty()) { return null; } List<ServiceEndPoint> endPoints = Lists.newArrayListWithCapacity(_endPoints.size()); for (Map.Entry<String, Payload> entry : _endPoints.entrySet()) { String id = entry.getKey(); Payload payload = entry.getValue(); endPoints.add(new ServiceEndPointBuilder() .withServiceName(serviceName) .withId(id) .withPayload(serialize(serviceName, id, payload)) .build()); } return new FixedHostDiscovery(endPoints); } ConfiguredFixedHostDiscoverySource();  ConfiguredFixedHostDiscoverySource(Map<String, Payload> endPoints); }
ConfiguredFixedHostDiscoverySource implements HostDiscoverySource { @Override public HostDiscovery forService(String serviceName) { if (_endPoints.isEmpty()) { return null; } List<ServiceEndPoint> endPoints = Lists.newArrayListWithCapacity(_endPoints.size()); for (Map.Entry<String, Payload> entry : _endPoints.entrySet()) { String id = entry.getKey(); Payload payload = entry.getValue(); endPoints.add(new ServiceEndPointBuilder() .withServiceName(serviceName) .withId(id) .withPayload(serialize(serviceName, id, payload)) .build()); } return new FixedHostDiscovery(endPoints); } ConfiguredFixedHostDiscoverySource();  ConfiguredFixedHostDiscoverySource(Map<String, Payload> endPoints); @Override HostDiscovery forService(String serviceName); @Override String toString(); }
ConfiguredFixedHostDiscoverySource implements HostDiscoverySource { @Override public HostDiscovery forService(String serviceName) { if (_endPoints.isEmpty()) { return null; } List<ServiceEndPoint> endPoints = Lists.newArrayListWithCapacity(_endPoints.size()); for (Map.Entry<String, Payload> entry : _endPoints.entrySet()) { String id = entry.getKey(); Payload payload = entry.getValue(); endPoints.add(new ServiceEndPointBuilder() .withServiceName(serviceName) .withId(id) .withPayload(serialize(serviceName, id, payload)) .build()); } return new FixedHostDiscovery(endPoints); } ConfiguredFixedHostDiscoverySource();  ConfiguredFixedHostDiscoverySource(Map<String, Payload> endPoints); @Override HostDiscovery forService(String serviceName); @Override String toString();  }