diff options
author | mharazin <mateusz.harazin@nokia.com> | 2019-12-17 15:08:19 +0100 |
---|---|---|
committer | mharazin <mateusz.harazin@nokia.com> | 2019-12-17 16:47:01 +0100 |
commit | bab2a8e1cfcd575d4e049ae811ab4795b2112a7c (patch) | |
tree | b19bb14d616ded3cfc97f70cdcf5806379f20ac5 /rest-services | |
parent | 709414c63b6f95e0d63a06c4a535d6871f8576db (diff) |
Fix CbsClientConfiguration fromEnviroment
Logic returning correct with previous conditions
Issue-ID: DCAEGEN2-2003
Signed-off-by: Mateusz Harazin <mateusz.harazin@nokia.com>
Change-Id: Idb214e95b3f857d26f3065f80e9bc2e1f2700f23
Diffstat (limited to 'rest-services')
2 files changed, 1 insertions, 5 deletions
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/CbsClientConfiguration.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/CbsClientConfiguration.java index 2fb07501..36555c2b 100644 --- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/CbsClientConfiguration.java +++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/model/CbsClientConfiguration.java @@ -141,7 +141,7 @@ public interface CbsClientConfiguration { .appName(getEnv(ENV_APP_NAME)); return Optional.ofNullable(pathToCaCert).filter(certPath -> !"".equals(certPath)) .map(certPath -> createSslHttpConfig(configBuilder, certPath)) - .orElse(createPlainHttpConfig(configBuilder)); + .orElseGet(() -> createPlainHttpConfig(configBuilder)); } static CbsClientConfiguration createPlainHttpConfig(ImmutableCbsClientConfiguration.Builder configBuilder) { diff --git a/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientConfigurationTest.java b/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientConfigurationTest.java index d0df0b6c..107c2d32 100644 --- a/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientConfigurationTest.java +++ b/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/CbsClientConfigurationTest.java @@ -65,7 +65,6 @@ class CbsClientConfigurationTest { // given envs.set("DCAE_CA_CERTPATH", preparePathToCertFile()); envs.set("CONFIG_BINDING_SERVICE", "config-binding-service"); - envs.set("CONFIG_BINDING_SERVICE_PORT_10443_TCP_PORT", "10443"); envs.set("HOSTNAME", "dcae-prh"); envs.set("CONSUL_HOST", "consul-server.onap"); @@ -83,7 +82,6 @@ class CbsClientConfigurationTest { envs.set("DCAE_CA_CERTPATH", null); envs.set("CONFIG_BINDING_SERVICE_SERVICE_PORT", "9090"); envs.set("CONFIG_BINDING_SERVICE", "config-binding-service"); - envs.set("CONFIG_BINDING_SERVICE_PORT_10443_TCP_PORT", "10443"); envs.set("HOSTNAME", "dcae-prh"); envs.set("CONSUL_HOST", "consul-server.onap"); @@ -107,7 +105,6 @@ class CbsClientConfigurationTest { envs.set("DCAE_CA_CERTPATH", "/home/cacert.pem"); envs.set("HOSTNAME", "dcae-prh"); envs.set("CONFIG_BINDING_SERVICE", "config-binding-service"); - envs.set("CONFIG_BINDING_SERVICE_PORT_10443_TCP_PORT", "10443"); envs.set("CONSUL_HOST", "consul-server.onap"); // then @@ -122,7 +119,6 @@ class CbsClientConfigurationTest { envs.set("HOSTNAME", ""); envs.set("DCAE_CA_CERTPATH", preparePathToCertFile()); envs.set("CONFIG_BINDING_SERVICE", "config-binding-service"); - envs.set("CONFIG_BINDING_SERVICE_PORT_10443_TCP_PORT", "10443"); envs.set("CONSUL_HOST", "consul-server.onap"); // then |