@Test public void testGetService() { final DiscoveryConfig discoveryConfig = Services.newDiscoverConfig(); final String serviceId = discoveryConfig.getServiceId(); final Service service = _serviceRepository.getService(discoveryConfig); Assert.assertEquals(serviceId, service.getServiceId()); Assert.assertTrue(_serviceRepository.containsService(serviceId)); }
public Service getService(final DiscoveryConfig discoveryConfig) { if (discoveryConfig == null) { return new Service(); } final String serviceId = StringValues.toLowerCase(discoveryConfig.getServiceId()); if (StringValues.isNullOrWhitespace(serviceId)) return new Service(); if (!containsService(serviceId)) registerService(discoveryConfig); return services.get(serviceId).newService(); }
ServiceRepository { public Service getService(final DiscoveryConfig discoveryConfig) { if (discoveryConfig == null) { return new Service(); } final String serviceId = StringValues.toLowerCase(discoveryConfig.getServiceId()); if (StringValues.isNullOrWhitespace(serviceId)) return new Service(); if (!containsService(serviceId)) registerService(discoveryConfig); return services.get(serviceId).newService(); } }
ServiceRepository { public Service getService(final DiscoveryConfig discoveryConfig) { if (discoveryConfig == null) { return new Service(); } final String serviceId = StringValues.toLowerCase(discoveryConfig.getServiceId()); if (StringValues.isNullOrWhitespace(serviceId)) return new Service(); if (!containsService(serviceId)) registerService(discoveryConfig); return services.get(serviceId).newService(); } ServiceRepository(final ArtemisClientConfig config); protected  ServiceRepository(final ArtemisClientConfig config, ServiceDiscovery serviceDiscovery); }
ServiceRepository { public Service getService(final DiscoveryConfig discoveryConfig) { if (discoveryConfig == null) { return new Service(); } final String serviceId = StringValues.toLowerCase(discoveryConfig.getServiceId()); if (StringValues.isNullOrWhitespace(serviceId)) return new Service(); if (!containsService(serviceId)) registerService(discoveryConfig); return services.get(serviceId).newService(); } ServiceRepository(final ArtemisClientConfig config); protected  ServiceRepository(final ArtemisClientConfig config, ServiceDiscovery serviceDiscovery); boolean containsService(final String serviceId); List<DiscoveryConfig> getDiscoveryConfigs(); DiscoveryConfig getDiscoveryConfig(final String serviceId); List<ServiceContext> getServices(); Service getService(final DiscoveryConfig discoveryConfig); void registerServiceChangeListener(final DiscoveryConfig discoveryConfig, final ServiceChangeListener listener); }
ServiceRepository { public Service getService(final DiscoveryConfig discoveryConfig) { if (discoveryConfig == null) { return new Service(); } final String serviceId = StringValues.toLowerCase(discoveryConfig.getServiceId()); if (StringValues.isNullOrWhitespace(serviceId)) return new Service(); if (!containsService(serviceId)) registerService(discoveryConfig); return services.get(serviceId).newService(); } ServiceRepository(final ArtemisClientConfig config); protected  ServiceRepository(final ArtemisClientConfig config, ServiceDiscovery serviceDiscovery); boolean containsService(final String serviceId); List<DiscoveryConfig> getDiscoveryConfigs(); DiscoveryConfig getDiscoveryConfig(final String serviceId); List<ServiceContext> getServices(); Service getService(final DiscoveryConfig discoveryConfig); void registerServiceChangeListener(final DiscoveryConfig discoveryConfig, final ServiceChangeListener listener);  }