public static void startServices(ServiceHost host) { String remoteAdapterReference = System .getProperty("dcp.management.container.registry.adapter.service.reference"); if (remoteAdapterReference != null && !remoteAdapterReference.isEmpty()) { registryAdapterReference = URI.create(remoteAdapterReference); } else { registryAdapterReference = UriUtils.buildUri(host, RegistryAdapterService.class); ensurePropertyExists(host, RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME, () -> { ensurePropertyExists(host, RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME, () -> { host.startService(Operation.createPost(registryAdapterReference), new RegistryAdapterService()); }); }); } }
HostInitComputeServicesConfig.startServices(host, false); HostInitImageServicesConfig.startServices(host); HostInitRegistryAdapterServiceConfig.startServices(host);
ConfigurationState body = buildConfigurationState(propertyKey, RegistryAdapterService.REGISTRY_PROXY_NULL_VALUE);
/** * Start all services required to support management of infrastructure and applications. */ protected void startManagementServices() throws Throwable { this.log(Level.INFO, "Management service starting ..."); registerForServiceAvailability(CaSigningCertService.startTask(this), true, CaSigningCertService.FACTORY_LINK); HostInitComputeServicesConfig.startServices(this, false); HostInitComputeBackgroundServicesConfig.startServices(this); HostInitRequestServicesConfig.startServices(this); HostInitImageServicesConfig.startServices(this); HostInitUiServicesConfig.startServices(this); HostInitHarborServices.startServices(this, startMockHostAdapterInstance); HostInitDockerAdapterServiceConfig.startServices(this, startMockHostAdapterInstance); HostInitKubernetesAdapterServiceConfig.startServices(this, startMockHostAdapterInstance); HostInitRegistryAdapterServiceConfig.startServices(this); this.log(Level.INFO, "Management services started."); }
@Test public void testInitNoProxyNoList() throws Throwable { HostInitRegistryAdapterServiceConfig.startServices(host); ConfigurationState configurationState = getDocument(ConfigurationState.class, UriUtils.buildUriPath(ConfigurationFactoryService.SELF_LINK, RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME)); assertEquals(RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME + " should be " + RegistryAdapterService.REGISTRY_PROXY_NULL_VALUE, RegistryAdapterService.REGISTRY_PROXY_NULL_VALUE, configurationState.value); configurationState = getDocument(ConfigurationState.class, UriUtils.buildUriPath(ConfigurationFactoryService.SELF_LINK, RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME)); assertEquals(RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME + " should be " + RegistryAdapterService.REGISTRY_PROXY_NULL_VALUE, RegistryAdapterService.REGISTRY_PROXY_NULL_VALUE, configurationState.value); }
@Test public void testInitWithProxyNoList() throws Throwable { setProperty(RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME, proxyAddress); HostInitRegistryAdapterServiceConfig.startServices(host); ConfigurationState configurationState = getDocument(ConfigurationState.class, UriUtils.buildUriPath(ConfigurationFactoryService.SELF_LINK, RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME)); assertEquals(RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME + " should be " + proxyAddress, proxyAddress, configurationState.value); configurationState = getDocument(ConfigurationState.class, UriUtils.buildUriPath(ConfigurationFactoryService.SELF_LINK, RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME)); assertEquals(RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME + " should be " + RegistryAdapterService.REGISTRY_PROXY_NULL_VALUE, RegistryAdapterService.REGISTRY_PROXY_NULL_VALUE, configurationState.value); }
@Test public void testInitNoProxyWithList() throws Throwable { setProperty(RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME, noProxyList); HostInitRegistryAdapterServiceConfig.startServices(host); ConfigurationState configurationState = getDocument(ConfigurationState.class, UriUtils.buildUriPath(ConfigurationFactoryService.SELF_LINK, RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME)); assertEquals(RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME + " should be " + RegistryAdapterService.REGISTRY_PROXY_NULL_VALUE, RegistryAdapterService.REGISTRY_PROXY_NULL_VALUE, configurationState.value); configurationState = getDocument(ConfigurationState.class, UriUtils.buildUriPath(ConfigurationFactoryService.SELF_LINK, RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME)); assertEquals(RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME + " should be " + noProxyList, noProxyList, configurationState.value); }
@Test public void testInitWithProxyWithList() throws Throwable { setProperty(RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME, proxyAddress); setProperty(RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME, noProxyList); HostInitRegistryAdapterServiceConfig.startServices(host); ConfigurationState configurationState = getDocument(ConfigurationState.class, UriUtils.buildUriPath(ConfigurationFactoryService.SELF_LINK, RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME)); assertEquals(RegistryAdapterService.REGISTRY_PROXY_PARAM_NAME + " should be " + proxyAddress, proxyAddress, configurationState.value); configurationState = getDocument(ConfigurationState.class, UriUtils.buildUriPath(ConfigurationFactoryService.SELF_LINK, RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME)); assertEquals(RegistryAdapterService.REGISTRY_NO_PROXY_LIST_PARAM_NAME + " should be " + noProxyList, noProxyList, configurationState.value); }