From 13bb744669580623fd779f287ca9ce647d6182b6 Mon Sep 17 00:00:00 2001 From: Kai Date: Sat, 9 May 2020 15:19:14 +0800 Subject: Enable TCAgen2 to policy flow Issue-ID: DCAEGEN2-2198 Signed-off-by: Kai Lu Change-Id: I35abe1efd996b9ab9b177f9be1733aaf0b6aaa64 --- .../model/configbindingservice/ConfigBindingServiceConstants.java | 2 +- .../web/spring/ConfigBindingServiceEnvironmentPostProcessor.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceConstants.java b/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceConstants.java index 173293d..2693a68 100644 --- a/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceConstants.java +++ b/dcae-analytics/dcae-analytics-model/src/main/java/org/onap/dcae/analytics/model/configbindingservice/ConfigBindingServiceConstants.java @@ -39,7 +39,7 @@ public abstract class ConfigBindingServiceConstants { public static final String SERVICE_NAME_ENV_VARIABLE_VALUE = System.getenv(SERVICE_NAME_ENV_VARIABLE_KEY); public static final String ENV_CBS_PORT = "CONFIG_BINDING_SERVICE_SERVICE_PORT"; public static final String CONFIG_BINDING_SERVICE_PROPERTIES_KEY = "config-binding-service"; - + public static final String SPRING_CONFIG_BINDING_SERVICE_PROPERTIES_KEY = "config-binding-service.config"; public static final String CONFIG_SERVICE_MESSAGE_ROUTER_VALUE = "message_router"; // CONVERT JSON TO MAP public static final String KEY_SEPARATOR = "."; diff --git a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java index c41e416..d286d10 100644 --- a/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java +++ b/dcae-analytics/dcae-analytics-web/src/main/java/org/onap/dcae/analytics/web/spring/ConfigBindingServiceEnvironmentPostProcessor.java @@ -81,6 +81,9 @@ public class ConfigBindingServiceEnvironmentPostProcessor implements Environment private String configServicePropertiesKey = ConfigBindingServiceConstants.CONFIG_BINDING_SERVICE_PROPERTIES_KEY; + private String springConfigServicePropertiesKey = + ConfigBindingServiceConstants.SPRING_CONFIG_BINDING_SERVICE_PROPERTIES_KEY; + @Override public void postProcessEnvironment(final ConfigurableEnvironment environment, final SpringApplication application) { @@ -247,13 +250,13 @@ public class ConfigBindingServiceEnvironmentPostProcessor implements Environment final Set springKeyPrefixes = ConfigBindingServiceConstants.getSpringReservedPropertiesKeyPrefixes(); final Set springKeys = springKeyPrefixes.stream() - .map(springKeyPrefix -> configServicePropertiesKey + "." + springKeyPrefix) + .map(springKeyPrefix -> springConfigServicePropertiesKey + "." + springKeyPrefix) .collect(Collectors.toSet()); filterKeyMap = configPropertiesMap.entrySet().stream() .collect(Collectors.toMap((Map.Entry e) -> springKeys.stream() .anyMatch(springKey -> e.getKey().startsWith(springKey)) - ? e.getKey().substring(configServicePropertiesKey.toCharArray().length + 1) + ? e.getKey().substring(springConfigServicePropertiesKey.toCharArray().length + 1) : e.getKey(), Map.Entry::getValue)); -- cgit 1.2.3-korg