diff options
author | Vijay Venkatesh Kumar <vv770d@att.com> | 2022-10-10 14:31:26 -0400 |
---|---|---|
committer | Vijay Venkatesh Kumar <vv770d@att.com> | 2022-10-27 15:27:22 +0000 |
commit | a4507ff06bdf9d667ce3c91ef984c841d77351b8 (patch) | |
tree | 06d99816067764fa6051465d9813c32c5745e3fd /src | |
parent | 2a642a5a8f5a236b0afa29108a4409ce39465012 (diff) |
Revise SDK version for CBSClient updates
SDK 1.9.x removes CBS/Consul parameters
Change-Id: I527cafdbe5a9b2aca1a15df8edd19f9e03dff5de
Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com>
Issue-ID: DCAEGEN2-3295
Signed-off-by: Vijay Venkatesh Kumar <vv770d@att.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/onap/dcae/configuration/cbs/CbsClientConfigurationProvider.java | 22 | ||||
-rw-r--r-- | src/test/java/org/onap/dcae/configuration/cbs/CbsClientConfigurationProviderTest.java | 7 |
2 files changed, 9 insertions, 20 deletions
diff --git a/src/main/java/org/onap/dcae/configuration/cbs/CbsClientConfigurationProvider.java b/src/main/java/org/onap/dcae/configuration/cbs/CbsClientConfigurationProvider.java index fc88197c..2322f251 100644 --- a/src/main/java/org/onap/dcae/configuration/cbs/CbsClientConfigurationProvider.java +++ b/src/main/java/org/onap/dcae/configuration/cbs/CbsClientConfigurationProvider.java @@ -3,6 +3,7 @@ * org.onap.dcaegen2.collectors.ves * ================================================================================ * Copyright (C) 2020 Nokia. All rights reserved. + * Copyright (C) 2022 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,13 +33,12 @@ public class CbsClientConfigurationProvider { private static final Logger LOGGER = LoggerFactory.getLogger(CbsClientConfigurationProvider.class); - private static final String DEFAULT_PROTOCOL = "http"; - private static final String DEFAULT_HOSTNAME = "config-binding-service"; - private static final int DEFAULT_PORT = 10000; + private static final String DEFAULT_APP_NAME = "dcae-ves-collector"; private static final String DEV_MODE_PROPERTY = "devMode"; private static final String CBS_PORT_PROPERTY = "cbsPort"; - + private static String CBS_CLIENT_CONFIG_PATH = "/app-config/application_config.yaml"; + /** * Returns configuration for CBS client. * @return Production or dev configuration for CBS client, depends on application run arguments. @@ -58,10 +58,8 @@ public class CbsClientConfigurationProvider { @NotNull private ImmutableCbsClientConfiguration getDevConfiguration() { - return createCbsClientConfiguration( - DEFAULT_PROTOCOL, DEFAULT_HOSTNAME, DEFAULT_APP_NAME, - Integer.parseInt(System.getProperty(CBS_PORT_PROPERTY, String.valueOf(DEFAULT_PORT))) - ); + System.setProperty(CBS_CLIENT_CONFIG_PATH,"./etc/ves-application_config.yaml"); + return createCbsClientConfiguration(DEFAULT_APP_NAME); } private boolean isDevModeEnabled() { @@ -70,15 +68,11 @@ public class CbsClientConfigurationProvider { private ImmutableCbsClientConfiguration getFallbackConfiguration() { LOGGER.info("Falling back to use default CBS client configuration"); - return createCbsClientConfiguration(DEFAULT_PROTOCOL, DEFAULT_HOSTNAME, DEFAULT_APP_NAME, DEFAULT_PORT); + return createCbsClientConfiguration(DEFAULT_APP_NAME); } - private ImmutableCbsClientConfiguration createCbsClientConfiguration(String protocol, String hostname, - String appName, Integer port) { + private ImmutableCbsClientConfiguration createCbsClientConfiguration(String appName) { return ImmutableCbsClientConfiguration.builder() - .protocol(protocol) - .hostname(hostname) - .port(port) .appName(appName) .build(); } diff --git a/src/test/java/org/onap/dcae/configuration/cbs/CbsClientConfigurationProviderTest.java b/src/test/java/org/onap/dcae/configuration/cbs/CbsClientConfigurationProviderTest.java index b3c06d9c..9cdd9973 100644 --- a/src/test/java/org/onap/dcae/configuration/cbs/CbsClientConfigurationProviderTest.java +++ b/src/test/java/org/onap/dcae/configuration/cbs/CbsClientConfigurationProviderTest.java @@ -3,6 +3,7 @@ * org.onap.dcaegen2.collectors.ves * ================================================================================ * Copyright (C) 2020 Nokia. All rights reserved. + * Copyright (C) 2022 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +28,6 @@ import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.model.CbsClientCo public class CbsClientConfigurationProviderTest { - private static final String DEFAULT_PROTOCOL = "http"; - private static final String DEFAULT_HOSTNAME = "config-binding-service"; - private static final int DEFAULT_PORT = 10000; private static final String DEFAULT_APP_NAME = "dcae-ves-collector"; @Test @@ -39,9 +37,6 @@ public class CbsClientConfigurationProviderTest { CbsClientConfiguration configuration = new CbsClientConfigurationProvider().get(); // then - assertThat(configuration.protocol()).isEqualTo(DEFAULT_PROTOCOL); - assertThat(configuration.hostname()).isEqualTo(DEFAULT_HOSTNAME); - assertThat(configuration.port()).isEqualTo(DEFAULT_PORT); assertThat(configuration.appName()).isEqualTo(DEFAULT_APP_NAME); } } |