Add to Java CBS-Client ability to resolve evns in app-config.yaml loaded from ConfigMap 26/121126/14
authorTomasz Pietruszkiewicz <tomasz.pietruszkiewicz@nokia.com>
Thu, 6 May 2021 08:27:19 +0000 (10:27 +0200)
committerTomasz Pietruszkiewicz <tomasz.pietruszkiewicz@nokia.com>
Tue, 18 May 2021 07:23:13 +0000 (09:23 +0200)
Change-Id: Ic85c1511133594500bdf31b9d491cc70d34ff5d5
Issue-ID: DCAEGEN2-2716
Signed-off-by: Tomasz Pietruszkiewicz <tomasz.pietruszkiewicz@nokia.com>
38 files changed:
Changelog.md
pom.xml
rest-services/cbs-client/pom.xml
rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/exceptions/EnvironmentParsingException.java [new file with mode: 0644]
rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMap.java
rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientEnvironmentParsing.java [new file with mode: 0644]
rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientRest.java
rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMapTest.java
rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientEnvironmentParsingTest.java [new file with mode: 0644]
rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientImplIT.java
rest-services/cbs-client/src/test/resources/application_config.yaml
rest-services/cbs-client/src/test/resources/sample_expected_service_config.json [new file with mode: 0644]
rest-services/cbs-client/src/test/resources/sample_service_config.json
rest-services/dmaap-client/pom.xml
rest-services/http-client/pom.xml
rest-services/model/pom.xml
rest-services/pom.xml
security/crypt-password/pom.xml
security/pom.xml
security/ssl/pom.xml
services/common/pom.xml
services/external-schema-manager/pom.xml
services/hv-ves-client/pom.xml
services/hv-ves-client/producer/api/pom.xml
services/hv-ves-client/producer/ct/pom.xml
services/hv-ves-client/producer/impl/pom.xml
services/hv-ves-client/producer/pom.xml
services/hv-ves-client/protobuf/pom.xml
services/pom.xml
standardization/api-custom-header/pom.xml
standardization/moher-api/healthstate/pom.xml
standardization/moher-api/metrics/pom.xml
standardization/moher-api/pom.xml
standardization/moher-api/server-adapters/pom.xml
standardization/moher-api/server-adapters/reactor-netty/pom.xml
standardization/moher-api/server-adapters/spring-webflux/pom.xml
standardization/pom.xml
version.properties

index 81b5d02..8c25659 100644 (file)
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
 The format is based on [Keep a Changelog](http://keepachangelog.com/)
 and this project adheres to [Semantic Versioning](http://semver.org/).    
 
+## [1.8.4] - 14/05/2021
+### Added
+    - [DCAEGEN2-2716] (https://jira.onap.org/browse/DCAEGEN2-2716) - Add to Java CBS-Client ability to resolve evns in app-config.yaml loaded from ConfigMap
+
 ## [1.8.3] - 29/04/2021
 ### Added
     - [DCAEGEN2-2716] (https://jira.onap.org/browse/DCAEGEN2-2716) - Adapt CBS-CLient to read configuration from a file exposed in a cfgMap
diff --git a/pom.xml b/pom.xml
index dbe1f75..a56558b 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
 
     <groupId>org.onap.dcaegen2.services</groupId>
     <artifactId>sdk</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
 
     <name>dcaegen2-services-sdk</name>
     <description>Common SDK repo for all DCAE Services</description>
index 1fdc904..02bfb75 100644 (file)
@@ -7,7 +7,7 @@
     <parent>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
         <artifactId>dcaegen2-services-sdk-rest-services</artifactId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/exceptions/EnvironmentParsingException.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/exceptions/EnvironmentParsingException.java
new file mode 100644 (file)
index 0000000..0113000
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * ============LICENSE_START====================================
+ * DCAEGEN2-SERVICES-SDK
+ * =========================================================
+ * Copyright (C) 2021 Nokia. 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.
+ * You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================
+ */
+package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.exceptions;
+
+import org.jetbrains.annotations.NotNull;
+
+public class EnvironmentParsingException extends RuntimeException {
+    public EnvironmentParsingException(final @NotNull String message) {
+        super(message);
+    }
+}
index 875e20e..42f5361 100644 (file)
@@ -37,6 +37,7 @@ public class CbsClientConfigMap implements CbsClient {
     private static final Logger LOGGER = LoggerFactory.getLogger(CbsClientConfigMap.class);
     private final String configMapFilePath;
 
+
     public CbsClientConfigMap (String configMapFilePath) {
         this.configMapFilePath = configMapFilePath;
     }
@@ -44,6 +45,7 @@ public class CbsClientConfigMap implements CbsClient {
     @Override
     public @NotNull Mono<JsonObject> get(CbsRequest request) {
         return Mono.just(this.loadConfigMapFile())
+                .map(CbsClientEnvironmentParsing::processEnvironmentVariables)
                 .doOnNext(this::logConfigMapOutput);
     }
 
@@ -67,6 +69,8 @@ public class CbsClientConfigMap implements CbsClient {
         return new Yaml().load(new FileReader(configMapFilePath).getContent());
     }
 
+
+
     private void logConfigMapOutput(JsonObject jsonObject) {
         LOGGER.info("Got successful output from ConfigMap file");
         LOGGER.debug("ConfigMap output: {}", jsonObject);
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientEnvironmentParsing.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientEnvironmentParsing.java
new file mode 100644 (file)
index 0000000..17144f1
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * ============LICENSE_START=======================================================
+ * DCAEGEN2-SERVICES-SDK
+ * ================================================================================
+ * Copyright (C) 2021 Nokia. 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl;
+
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonObject;
+import com.google.gson.JsonPrimitive;
+import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.exceptions.EnvironmentParsingException;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * <p>Config Binding Service client environment variables parsing.</p>
+ *
+ * @since 1.8.4
+ */
+public class CbsClientEnvironmentParsing {
+
+    private static final Pattern shellEnvPattern = Pattern.compile("\\$\\{(.+?)}");
+
+    private CbsClientEnvironmentParsing() {}
+
+    /**
+     * <p>
+     * This method will do a lookup of shell variables in provided jsonObject and replace it with found environment variables.
+     * </p>
+     * <p>
+     * In case of failure during resolving environment variables, EnvironmentParsingException is thrown.
+     * </p>
+     *
+     * @param jsonObject
+     * @return JsonObject
+     * @since 1.8.4
+     */
+    public static JsonObject processEnvironmentVariables(JsonObject jsonObject) {
+        JsonObject jsonObjectCopy = jsonObject.deepCopy();
+        processJsonObject(jsonObjectCopy);
+        return jsonObjectCopy;
+    }
+    private static void processJsonObject(JsonObject jsonObject) {
+        for (Map.Entry<String, JsonElement> entry : jsonObject.entrySet()) {
+            processJsonObjectEntry(jsonObject, entry);
+        }
+    }
+    private static void processJsonObjectEntry(JsonObject jsonObject, Map.Entry<String, JsonElement> entry) {
+        if (entry.getValue().isJsonArray()) {
+            processJsonArray(entry.getValue().getAsJsonArray());
+        } else if (entry.getValue().isJsonObject()) {
+            processJsonObject(entry.getValue().getAsJsonObject());
+        } else {
+            Matcher matcher = getMatcher(entry.getValue().getAsString());
+            if (matcher.find()) {
+                jsonObject.addProperty(entry.getKey(), getValueFromSystemEnv(matcher.group(1)));
+            }
+        }
+    }
+
+    private static void processJsonArray(JsonArray jsonArray) {
+        for (int i = 0; i < jsonArray.size(); i++) {
+            if (jsonArray.get(i).isJsonObject()) {
+                processJsonObject(jsonArray.get(i).getAsJsonObject());
+            } else if (jsonArray.get(i).isJsonArray()) {
+                processJsonArray(jsonArray.get(i).getAsJsonArray());
+            } else {
+                Matcher matcher = getMatcher(jsonArray.get(i).getAsString());
+                if (matcher.find()) {
+                    jsonArray.set(i, new JsonPrimitive(getValueFromSystemEnv(matcher.group(1))));
+                }
+            }
+        }
+    }
+
+    private static Matcher getMatcher(String value) {
+        return shellEnvPattern.matcher(value);
+    }
+
+    private static String getValueFromSystemEnv( String envName) {
+        String envValue = System.getenv(envName);
+        if (envValue == null || "".equals(envValue)) {
+            throw new EnvironmentParsingException("Cannot read " + envName + " from environment.");
+        }
+        return envValue;
+    }
+}
index 4559a90..3eda6d8 100644 (file)
@@ -61,6 +61,7 @@ public class CbsClientRest implements CbsClient {
                 .flatMap(httpClient::call)
                 .doOnNext(HttpResponse::throwIfUnsuccessful)
                 .map(resp -> resp.bodyAsJson(JsonObject.class))
+                .map(CbsClientEnvironmentParsing::processEnvironmentVariables)
                 .doOnNext(this::logCbsResponse);
     }
 
index 07b44e9..a9d8407 100644 (file)
@@ -22,20 +22,28 @@ package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.google.gson.JsonObject;
+import com.google.gson.stream.JsonReader;
+import org.junit.Rule;
+import org.junit.contrib.java.lang.system.EnvironmentVariables;
 import org.junit.jupiter.api.Test;
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.CbsClient;
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.CbsRequests;
 import org.onap.dcaegen2.services.sdk.rest.services.model.logging.RequestDiagnosticContext;
-import org.onap.dcaegen2.services.sdk.services.common.FileReader;
-import org.yaml.snakeyaml.Yaml;
-import java.util.LinkedHashMap;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
 import static org.assertj.core.api.Assertions.assertThat;
 
 public class CbsClientConfigMapTest {
 
+    private static final String SAMPLE_EXPECTED_CONFIG = "src/test/resources/sample_expected_service_config.json";
+    @Rule
+    public final EnvironmentVariables envs = new EnvironmentVariables();
+
     @Test
-    void shouldFetchUsingProperConfigMapFile() {
+    void shouldFetchUsingProperConfigMapFile() throws FileNotFoundException {
         // given
+        envs.set("AAF_USER", "admin");
+        envs.set("AAF_PASSWORD", "admin_secret");
         String configMapFilePath = "src/test/resources/application_config.yaml";
         final CbsClient cut = new CbsClientConfigMap(configMapFilePath);
 
@@ -46,12 +54,11 @@ public class CbsClientConfigMapTest {
 
         // then
         assertThat(result).isNotNull();
-        assertThat(result).isEqualTo(covertYamlToJson(configMapFilePath));
+        assertThat(result).isEqualTo(convertToJson(new JsonReader(new FileReader(SAMPLE_EXPECTED_CONFIG))));
     }
 
-    private JsonObject covertYamlToJson(String configMapFilePath) {
+    private JsonObject convertToJson(JsonReader jsonReader) {
         Gson gson = new GsonBuilder().create();
-        return gson.fromJson(gson.toJson(new Yaml().load(new FileReader(configMapFilePath).getContent()),
-                LinkedHashMap.class), JsonObject.class);
+        return gson.fromJson(jsonReader, JsonObject.class);
     }
 }
diff --git a/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientEnvironmentParsingTest.java b/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientEnvironmentParsingTest.java
new file mode 100644 (file)
index 0000000..41d757f
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * ============LICENSE_START====================================
+ * DCAEGEN2-SERVICES-SDK
+ * =========================================================
+ * Copyright (C) 2021 Nokia. 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.
+ * You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=====================================
+ */
+package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.google.gson.JsonObject;
+import com.google.gson.stream.JsonReader;
+import org.junit.Rule;
+import org.junit.contrib.java.lang.system.EnvironmentVariables;
+import org.junit.jupiter.api.Test;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import static org.assertj.core.api.Assertions.assertThat;
+
+public class CbsClientEnvironmentParsingTest {
+
+    private static final String SAMPLE_CONFIG = "src/test/resources/sample_service_config.json";
+    private static final String SAMPLE_EXPECTED_CONFIG = "src/test/resources/sample_expected_service_config.json";
+    @Rule
+    public final EnvironmentVariables envs = new EnvironmentVariables();
+
+    @Test
+    void shouldProcessEnvironmentVariables() throws FileNotFoundException {
+        //given
+        envs.set("AAF_USER", "admin");
+        envs.set("AAF_PASSWORD", "admin_secret");
+        JsonObject jsonObject = getSampleJsonObject(SAMPLE_CONFIG);
+        //when
+        JsonObject result = CbsClientEnvironmentParsing.processEnvironmentVariables(jsonObject);
+        //then
+        assertThat(result).isEqualTo(getSampleJsonObject(SAMPLE_EXPECTED_CONFIG));
+    }
+
+    private JsonObject getSampleJsonObject(String file) throws FileNotFoundException {
+        Gson gson = new GsonBuilder().create();
+        JsonReader reader = new JsonReader(new FileReader(file));
+        return gson.fromJson(reader, JsonObject.class);
+    }
+}
index 83743a6..db881a2 100644 (file)
@@ -23,6 +23,8 @@ package org.onap.dcaegen2.services.sdk.rest.services.cbs.client.impl;
 import com.google.gson.JsonObject;
 import io.vavr.collection.Stream;
 import org.jetbrains.annotations.NotNull;
+import org.junit.Rule;
+import org.junit.contrib.java.lang.system.EnvironmentVariables;
 import org.junit.jupiter.api.AfterAll;
 import org.junit.jupiter.api.BeforeAll;
 import org.junit.jupiter.api.Test;
@@ -35,6 +37,7 @@ import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.test.DummyHttp
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.CbsClient;
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.CbsClientFactory;
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.CbsRequests;
+import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.exceptions.EnvironmentParsingException;
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.exceptions.StreamParsingException;
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.streams.DataStreams;
 import org.onap.dcaegen2.services.sdk.rest.services.cbs.client.api.streams.StreamFromGsonParser;
@@ -66,12 +69,15 @@ class CbsClientImplIT {
     private static final String SAMPLE_KEY = "/sample_key.json";
     private static final String SAMPLE_CONFIG_KEY = "keystore.path";
     private static final String EXPECTED_CONFIG_VALUE_FROM_CBS = "/var/run/security/keystore.p12";
-    private static final String EXPECTED_CONFIG_VALUE_FROM_FILE = "/var/run/security/keystore_file.p12";
-    private static final String CONFIG_MAP_FILE_PATH = "src/test/resources/sample_local_service_config.json";
+    private static final String CONFIG_MAP_FILE_PATH = "src/test/resources/application_config.yaml";
     private static CbsClientConfiguration sampleConfigurationCbsSource;
     private static CbsClientConfiguration sampleConfigurationFileSource;
     private static DummyHttpServer server;
 
+
+    @Rule
+    public final EnvironmentVariables envs = new EnvironmentVariables();
+
     @BeforeAll
     static void setUp() {
         server = DummyHttpServer.start(routes ->
@@ -92,6 +98,8 @@ class CbsClientImplIT {
     @Test
     void testCbsClientWithSingleCall() {
         // given
+        envs.set("AAF_USER", "admin");
+        envs.set("AAF_PASSWORD", "admin_secret");
         final Mono<CbsClient> sut = CbsClientFactory.createCbsClient(sampleConfigurationCbsSource);
         final CbsRequest request = CbsRequests.getConfiguration(RequestDiagnosticContext.create());
 
@@ -108,6 +116,8 @@ class CbsClientImplIT {
     @Test
     void testCbsClientWithPeriodicCall() {
         // given
+        envs.set("AAF_USER", "admin");
+        envs.set("AAF_PASSWORD", "admin_secret");
         final Mono<CbsClient> sut = CbsClientFactory.createCbsClient(sampleConfigurationCbsSource);
         final CbsRequest request = CbsRequests.getConfiguration(RequestDiagnosticContext.create());
 
@@ -126,6 +136,8 @@ class CbsClientImplIT {
     @Test
     void testCbsClientWithUpdatesCall() {
         // given
+        envs.set("AAF_USER", "admin");
+        envs.set("AAF_PASSWORD", "admin_secret");
         final Mono<CbsClient> sut = CbsClientFactory.createCbsClient(sampleConfigurationCbsSource);
         final CbsRequest request = CbsRequests.getConfiguration(RequestDiagnosticContext.create());
         final Duration period = Duration.ofMillis(10);
@@ -142,9 +154,30 @@ class CbsClientImplIT {
                 .verify(Duration.ofSeconds(5));
     }
 
+    @Test
+    void testCbsClientWithConfigRetrievedFromFileMissingEnv() {
+        // given
+        envs.set("AAF_USER", "");
+        final Mono<CbsClient> sut = CbsClientFactory.createCbsClient(sampleConfigurationFileSource);
+        final CbsRequest request = CbsRequests.getConfiguration(RequestDiagnosticContext.create());
+
+        // when
+        final Mono<JsonObject> result = sut.flatMap(cbsClient -> cbsClient.get(request));
+
+        // then
+        StepVerifier.create(result)
+                .expectErrorSatisfies(ex -> {
+                    assertThat(ex).isInstanceOf(EnvironmentParsingException.class);
+                    assertThat(ex).hasMessageContaining("Cannot read AAF_USER from environment.");
+                })
+                .verify(Duration.ofSeconds(5));
+    }
+
     @Test
     void testCbsClientWithConfigRetrievedFromFile() {
         // given
+        envs.set("AAF_USER", "admin");
+        envs.set("AAF_PASSWORD", "admin_secret");
         final Mono<CbsClient> sut = CbsClientFactory.createCbsClient(sampleConfigurationFileSource);
         final CbsRequest request = CbsRequests.getConfiguration(RequestDiagnosticContext.create());
 
@@ -153,7 +186,7 @@ class CbsClientImplIT {
 
         // then
         StepVerifier.create(result.map(this::sampleConfigValue))
-                .expectNext(EXPECTED_CONFIG_VALUE_FROM_FILE)
+                .expectNext(EXPECTED_CONFIG_VALUE_FROM_CBS)
                 .expectComplete()
                 .verify(Duration.ofSeconds(5));
     }
@@ -161,6 +194,8 @@ class CbsClientImplIT {
     @Test
     void testCbsClientWithStreamsParsing() {
         // given
+        envs.set("AAF_USER", "admin");
+        envs.set("AAF_PASSWORD", "admin_secret");
         final Mono<CbsClient> sut = CbsClientFactory.createCbsClient(sampleConfigurationCbsSource);
         final StreamFromGsonParser<KafkaSink> kafkaSinkParser = StreamFromGsonParsers.kafkaSinkParser();
         final CbsRequest request = CbsRequests.getConfiguration(RequestDiagnosticContext.create());
@@ -185,6 +220,8 @@ class CbsClientImplIT {
     @Test
     void testCbsClientWithStreamsParsingUsingSwitch() {
         // given
+        envs.set("AAF_USER", "admin");
+        envs.set("AAF_PASSWORD", "admin_secret");
         final Mono<CbsClient> sut = CbsClientFactory.createCbsClient(sampleConfigurationCbsSource);
         final CbsRequest request = CbsRequests.getConfiguration(RequestDiagnosticContext.create());
         // TODO: Use these parsers below
@@ -221,6 +258,8 @@ class CbsClientImplIT {
     @Test
     void testCbsClientWithStreamsParsingWhenUsingInvalidParser() {
         // given
+        envs.set("AAF_USER", "admin");
+        envs.set("AAF_PASSWORD", "admin_secret");
         final Mono<CbsClient> sut = CbsClientFactory.createCbsClient(sampleConfigurationCbsSource);
         final StreamFromGsonParser<KafkaSource> kafkaSourceParser = StreamFromGsonParsers.kafkaSourceParser();
         final CbsRequest request = CbsRequests.getConfiguration(RequestDiagnosticContext.create());
index c43b973..a246680 100644 (file)
@@ -1,10 +1,38 @@
 ---
+keystore.path: "/var/run/security/keystore.p12"
 streams_publishes:
   perf3gpp:
+    testArray:
+      - testPrimitiveArray:
+          - "${AAF_USER}"
+          - "${AAF_PASSWORD}"
+          - nestedArray:
+              - "${AAF_USER}"
+        testPrimitive: "${AAF_USER}"
+        aaf_credentials:
+          username: "${AAF_USER}"
+          password: "${AAF_PASSWORD}"
     type: kafka
+    kafka_info:
+      bootstrap_servers: dmaap-mr-kafka:6060
+      topic_name: HVVES_PERF3GPP
+  pnf_ready:
+    aaf_credentials:
+      username: "${AAF_USER}"
+      password: "${AAF_PASSWORD}"
+    type: message_router
+    dmaap_info:
+      topic_url: http://message-router:3904/events/VES_PNF_READY
+  call_trace:
     aaf_credentials:
-      username: admin
-      password: admin_secret
+      username: "${AAF_USER}"
+      password: "${AAF_PASSWORD}"
+    type: kafka
     kafka_info:
-      bootstrap_servers: message-router-kafka-0:9093
-      topic_name: HV_VES_PERF3GPP
+      bootstrap_servers: dmaap-mr-kafka:6060
+      topic_name: HVVES_TRACE
+streams_subscribes:
+  measurements:
+    type: message_router
+    dmaap_info:
+      topic_url: http://message-router:3904/events/VES_MEASUREMENT
diff --git a/rest-services/cbs-client/src/test/resources/sample_expected_service_config.json b/rest-services/cbs-client/src/test/resources/sample_expected_service_config.json
new file mode 100644 (file)
index 0000000..2ceda99
--- /dev/null
@@ -0,0 +1,53 @@
+{
+  "keystore.path": "/var/run/security/keystore.p12",
+  "streams_publishes": {
+    "perf3gpp": {
+      "testArray": [{
+        "testPrimitiveArray": ["admin", "admin_secret", {
+          "nestedArray": ["admin"]
+        }
+        ],
+        "testPrimitive": "admin",
+        "aaf_credentials": {
+          "username": "admin",
+          "password": "admin_secret"
+        }
+      }
+      ],
+      "type": "kafka",
+      "kafka_info": {
+        "bootstrap_servers": "dmaap-mr-kafka:6060",
+        "topic_name": "HVVES_PERF3GPP"
+      }
+    },
+    "pnf_ready": {
+      "aaf_credentials": {
+        "username": "admin",
+        "password": "admin_secret"
+      },
+      "type": "message_router",
+      "dmaap_info": {
+        "topic_url": "http://message-router:3904/events/VES_PNF_READY"
+      }
+    },
+    "call_trace": {
+      "aaf_credentials": {
+        "username": "admin",
+        "password": "admin_secret"
+      },
+      "type": "kafka",
+      "kafka_info": {
+        "bootstrap_servers": "dmaap-mr-kafka:6060",
+        "topic_name": "HVVES_TRACE"
+      }
+    }
+  },
+  "streams_subscribes": {
+    "measurements": {
+      "type": "message_router",
+      "dmaap_info": {
+        "topic_url": "http://message-router:3904/events/VES_MEASUREMENT"
+      }
+    }
+  }
+}
index 266326f..e579859 100644 (file)
@@ -2,6 +2,14 @@
     "keystore.path": "/var/run/security/keystore.p12",
     "streams_publishes": {
         "perf3gpp": {
+            "testArray": [{
+                "testPrimitiveArray": ["${AAF_USER}", "${AAF_PASSWORD}", {"nestedArray": ["${AAF_USER}"]}],
+                "testPrimitive": "${AAF_USER}",
+                "aaf_credentials": {
+                    "username": "${AAF_USER}",
+                    "password": "${AAF_PASSWORD}"
+                }
+            }],
             "type": "kafka",
             "kafka_info": {
                 "bootstrap_servers": "dmaap-mr-kafka:6060",
             }
         },
         "pnf_ready": {
+            "aaf_credentials": {
+                "username": "${AAF_USER}",
+                "password": "${AAF_PASSWORD}"
+            },
             "type": "message_router",
             "dmaap_info": {
                 "topic_url": "http://message-router:3904/events/VES_PNF_READY"
             }
         },
         "call_trace": {
+            "aaf_credentials": {
+                "username": "${AAF_USER}",
+                "password": "${AAF_PASSWORD}"
+            },
             "type": "kafka",
             "kafka_info": {
                 "bootstrap_servers": "dmaap-mr-kafka:6060",
index bb8953e..cb1d811 100644 (file)
@@ -7,7 +7,7 @@
   <parent>
     <groupId>org.onap.dcaegen2.services.sdk</groupId>
     <artifactId>dcaegen2-services-sdk-rest-services</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
   </parent>
 
   <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
index 5df35e1..ffb93b3 100644 (file)
@@ -28,7 +28,7 @@
     <parent>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
         <artifactId>dcaegen2-services-sdk-rest-services</artifactId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
index 6810c3e..0c00903 100644 (file)
@@ -27,7 +27,7 @@
     <parent>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
         <artifactId>dcaegen2-services-sdk-rest-services</artifactId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <groupId>org.onap.dcaegen2.services.sdk.rest.services</groupId>
index 8a64cd3..ddc6c25 100644 (file)
@@ -7,7 +7,7 @@
   <parent>
     <groupId>org.onap.dcaegen2.services</groupId>
     <artifactId>sdk</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
   </parent>
 
   <groupId>org.onap.dcaegen2.services.sdk</groupId>
index b377baa..d5fbb3b 100644 (file)
@@ -6,7 +6,7 @@
     <parent>
         <groupId>org.onap.dcaegen2.services.sdk.security</groupId>
         <artifactId>dcaegen2-services-sdk-security</artifactId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
 
index 72385a9..f2c92c1 100644 (file)
@@ -7,7 +7,7 @@
   <parent>
     <groupId>org.onap.dcaegen2.services</groupId>
     <artifactId>sdk</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
   </parent>
 
   <groupId>org.onap.dcaegen2.services.sdk.security</groupId>
index 020edb8..ff6f61b 100644 (file)
@@ -6,7 +6,7 @@
   <parent>
     <groupId>org.onap.dcaegen2.services.sdk.security</groupId>
     <artifactId>dcaegen2-services-sdk-security</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
   </parent>
 
   <artifactId>ssl</artifactId>
index cc25fcb..10b0358 100644 (file)
@@ -7,7 +7,7 @@
     <parent>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
         <artifactId>dcaegen2-services-sdk-services</artifactId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <artifactId>dcaegen2-services-sdk-services-common</artifactId>
index e8185ac..5cec95d 100644 (file)
@@ -7,7 +7,7 @@
     <parent>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
         <artifactId>dcaegen2-services-sdk-services</artifactId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <artifactId>dcaegen2-services-sdk-services-external-schema-manager</artifactId>
index f621799..a7dbae8 100644 (file)
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.onap.dcaegen2.services.sdk</groupId>
     <artifactId>dcaegen2-services-sdk-services</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
   </parent>
 
   <artifactId>dcaegen2-services-sdk-services-hvvesclient</artifactId>
index 3bbb9d8..1d49ff8 100644 (file)
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
         <artifactId>hvvesclient-producer</artifactId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <artifactId>hvvesclient-producer-api</artifactId>
index ded0d9a..cccd3c3 100644 (file)
@@ -26,7 +26,7 @@
     <parent>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
         <artifactId>hvvesclient-producer</artifactId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <artifactId>hvvesclient-producer-ct</artifactId>
index 38741ca..daa8fa1 100644 (file)
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.onap.dcaegen2.services.sdk</groupId>
     <artifactId>hvvesclient-producer</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
   </parent>
 
   <artifactId>hvvesclient-producer-impl</artifactId>
index fbf2ffe..f82f549 100644 (file)
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.onap.dcaegen2.services.sdk</groupId>
     <artifactId>dcaegen2-services-sdk-services-hvvesclient</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
   </parent>
 
   <artifactId>hvvesclient-producer</artifactId>
index aa43b36..6cffdba 100644 (file)
@@ -26,7 +26,7 @@
     <parent>
         <artifactId>dcaegen2-services-sdk-services-hvvesclient</artifactId>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <name>High Volume VES Collector Client :: Protobuf</name>
index d1ca190..43376c9 100644 (file)
@@ -26,7 +26,7 @@
   <parent>
     <groupId>org.onap.dcaegen2.services</groupId>
     <artifactId>sdk</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
   </parent>
 
   <groupId>org.onap.dcaegen2.services.sdk</groupId>
index 678ce67..733796f 100644 (file)
@@ -7,7 +7,7 @@
   <parent>
     <groupId>org.onap.dcaegen2.services.sdk</groupId>
     <artifactId>dcaegen2-services-sdk-standardization</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
     <relativePath>..</relativePath>
   </parent>
   
index e67a501..e070774 100644 (file)
@@ -25,7 +25,7 @@
     <parent>
         <artifactId>dcaegen2-sdk-moher-api</artifactId>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <name>Monitoring and Healthcheck :: Health state</name>
index 0dc12e5..90ca0ac 100644 (file)
@@ -26,7 +26,7 @@
     <parent>
         <artifactId>dcaegen2-sdk-moher-api</artifactId>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <name>Monitoring and Healthcheck :: Metrics</name>
index a6c602d..93728f5 100644 (file)
@@ -26,7 +26,7 @@
     <parent>
         <artifactId>dcaegen2-services-sdk-standardization</artifactId>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <name>Monitoring and Healthcheck</name>
index da1b2a6..23f7fe5 100644 (file)
@@ -25,7 +25,7 @@
     <parent>
         <artifactId>dcaegen2-sdk-moher-api</artifactId>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <name>Monitoring and Healthcheck :: Server Adapters</name>
index cd08bdd..65b92fd 100644 (file)
@@ -25,7 +25,7 @@
     <parent>
         <artifactId>dcaegen2-sdk-moher-server-adapters</artifactId>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <name>Monitoring and Healthcheck :: Server Adapters :: Reactor Netty</name>
index f297b90..05bc402 100644 (file)
@@ -25,7 +25,7 @@
     <parent>
         <artifactId>dcaegen2-sdk-moher-server-adapters</artifactId>
         <groupId>org.onap.dcaegen2.services.sdk</groupId>
-        <version>1.8.3-SNAPSHOT</version>
+        <version>1.8.4-SNAPSHOT</version>
     </parent>
 
     <name>Monitoring and Healthcheck :: Server Adapters :: Spring Webflux</name>
index 1673690..de0f2b7 100644 (file)
@@ -8,7 +8,7 @@
   <parent>
     <groupId>org.onap.dcaegen2.services</groupId>
     <artifactId>sdk</artifactId>
-    <version>1.8.3-SNAPSHOT</version>
+    <version>1.8.4-SNAPSHOT</version>
     <relativePath>..</relativePath>
   </parent>
 
index eb09066..7014c95 100644 (file)
@@ -1,6 +1,6 @@
 major=1
 minor=8
-patch=3
+patch=4
 base_version=${major}.${minor}.${patch}
 release_version=${base_version}
 snapshot_version=${base_version}-SNAPSHOT