@Test public void testGetServices() { final String serviceId = Services.newServiceId(); final List<String> serviceIds = Lists.newArrayList(serviceId, ArtemisClientConstants.RegistryService.Net.serviceKey); final List<DiscoveryConfig> discoveryConfigs = Lists.newArrayList(new DiscoveryConfig(serviceId), new DiscoveryConfig(ArtemisClientConstants.RegistryService.Net.serviceKey)); final List<Service> services = _client.getServices(discoveryConfigs); Assert.assertEquals(discoveryConfigs.size(), services.size()); for (final Service service : services) { Assert.assertTrue(serviceIds.contains(service.getServiceId())); if (ArtemisClientConstants.RegistryService.Net.serviceKey .equals(service.getServiceId())) { Assert.assertTrue(service.getInstances().size() > 0); } else { Assert.assertTrue((service.getInstances() == null) || (service.getInstances().size() == 0)); } } }
public List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs) { Preconditions.checkArgument(!CollectionUtils.isEmpty(discoveryConfigs), "discoveryConfigs should not be null or empty"); final LookupRequest request = new LookupRequest(discoveryConfigs, DeploymentConfig.regionId(), DeploymentConfig.zoneId()); final LookupResponse response = this.request(RestPaths.DISCOVERY_LOOKUP_FULL_PATH, request, LookupResponse.class); ResponseStatus status = response.getResponseStatus(); logEvent(status, "discovery", "lookup"); if (ResponseStatusUtil.isSuccess(status)) return response.getServices(); throw new RuntimeException("lookup services failed. " + status); }
ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs) { Preconditions.checkArgument(!CollectionUtils.isEmpty(discoveryConfigs), "discoveryConfigs should not be null or empty"); final LookupRequest request = new LookupRequest(discoveryConfigs, DeploymentConfig.regionId(), DeploymentConfig.zoneId()); final LookupResponse response = this.request(RestPaths.DISCOVERY_LOOKUP_FULL_PATH, request, LookupResponse.class); ResponseStatus status = response.getResponseStatus(); logEvent(status, "discovery", "lookup"); if (ResponseStatusUtil.isSuccess(status)) return response.getServices(); throw new RuntimeException("lookup services failed. " + status); } }
ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs) { Preconditions.checkArgument(!CollectionUtils.isEmpty(discoveryConfigs), "discoveryConfigs should not be null or empty"); final LookupRequest request = new LookupRequest(discoveryConfigs, DeploymentConfig.regionId(), DeploymentConfig.zoneId()); final LookupResponse response = this.request(RestPaths.DISCOVERY_LOOKUP_FULL_PATH, request, LookupResponse.class); ResponseStatus status = response.getResponseStatus(); logEvent(status, "discovery", "lookup"); if (ResponseStatusUtil.isSuccess(status)) return response.getServices(); throw new RuntimeException("lookup services failed. " + status); } ArtemisDiscoveryHttpClient(final ArtemisClientConfig config); }
ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs) { Preconditions.checkArgument(!CollectionUtils.isEmpty(discoveryConfigs), "discoveryConfigs should not be null or empty"); final LookupRequest request = new LookupRequest(discoveryConfigs, DeploymentConfig.regionId(), DeploymentConfig.zoneId()); final LookupResponse response = this.request(RestPaths.DISCOVERY_LOOKUP_FULL_PATH, request, LookupResponse.class); ResponseStatus status = response.getResponseStatus(); logEvent(status, "discovery", "lookup"); if (ResponseStatusUtil.isSuccess(status)) return response.getServices(); throw new RuntimeException("lookup services failed. " + status); } ArtemisDiscoveryHttpClient(final ArtemisClientConfig config); Service getService(final DiscoveryConfig discoveryConfig); List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs); }
ArtemisDiscoveryHttpClient extends ArtemisHttpClient { public List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs) { Preconditions.checkArgument(!CollectionUtils.isEmpty(discoveryConfigs), "discoveryConfigs should not be null or empty"); final LookupRequest request = new LookupRequest(discoveryConfigs, DeploymentConfig.regionId(), DeploymentConfig.zoneId()); final LookupResponse response = this.request(RestPaths.DISCOVERY_LOOKUP_FULL_PATH, request, LookupResponse.class); ResponseStatus status = response.getResponseStatus(); logEvent(status, "discovery", "lookup"); if (ResponseStatusUtil.isSuccess(status)) return response.getServices(); throw new RuntimeException("lookup services failed. " + status); } ArtemisDiscoveryHttpClient(final ArtemisClientConfig config); Service getService(final DiscoveryConfig discoveryConfig); List<Service> getServices(final List<DiscoveryConfig> discoveryConfigs);  }