aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Pietruszkiewicz <tomasz.pietruszkiewicz@nokia.com>2021-05-06 10:27:19 +0200
committerTomasz Pietruszkiewicz <tomasz.pietruszkiewicz@nokia.com>2021-05-18 09:23:13 +0200
commit9779ca13ed180fc69cdad5336b30a26edfd7d0fa (patch)
tree76bde46fd31315a1728d91670743552d3121e332
parent100e06241c0bce987b53ebe03b103eb19d282a81 (diff)
Add to Java CBS-Client ability to resolve evns in app-config.yaml loaded from ConfigMap
Change-Id: Ic85c1511133594500bdf31b9d491cc70d34ff5d5 Issue-ID: DCAEGEN2-2716 Signed-off-by: Tomasz Pietruszkiewicz <tomasz.pietruszkiewicz@nokia.com>
-rw-r--r--Changelog.md4
-rw-r--r--pom.xml2
-rw-r--r--rest-services/cbs-client/pom.xml2
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/exceptions/EnvironmentParsingException.java28
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMap.java4
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientEnvironmentParsing.java103
-rw-r--r--rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientRest.java1
-rw-r--r--rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMapTest.java23
-rw-r--r--rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientEnvironmentParsingTest.java57
-rw-r--r--rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientImplIT.java45
-rw-r--r--rest-services/cbs-client/src/test/resources/application_config.yaml36
-rw-r--r--rest-services/cbs-client/src/test/resources/sample_expected_service_config.json53
-rw-r--r--rest-services/cbs-client/src/test/resources/sample_service_config.json16
-rw-r--r--rest-services/dmaap-client/pom.xml2
-rw-r--r--rest-services/http-client/pom.xml2
-rw-r--r--rest-services/model/pom.xml2
-rw-r--r--rest-services/pom.xml2
-rw-r--r--security/crypt-password/pom.xml2
-rw-r--r--security/pom.xml2
-rw-r--r--security/ssl/pom.xml2
-rw-r--r--services/common/pom.xml2
-rw-r--r--services/external-schema-manager/pom.xml2
-rw-r--r--services/hv-ves-client/pom.xml2
-rw-r--r--services/hv-ves-client/producer/api/pom.xml2
-rw-r--r--services/hv-ves-client/producer/ct/pom.xml2
-rw-r--r--services/hv-ves-client/producer/impl/pom.xml2
-rw-r--r--services/hv-ves-client/producer/pom.xml2
-rw-r--r--services/hv-ves-client/protobuf/pom.xml2
-rw-r--r--services/pom.xml2
-rw-r--r--standardization/api-custom-header/pom.xml2
-rw-r--r--standardization/moher-api/healthstate/pom.xml2
-rw-r--r--standardization/moher-api/metrics/pom.xml2
-rw-r--r--standardization/moher-api/pom.xml2
-rw-r--r--standardization/moher-api/server-adapters/pom.xml2
-rw-r--r--standardization/moher-api/server-adapters/reactor-netty/pom.xml2
-rw-r--r--standardization/moher-api/server-adapters/spring-webflux/pom.xml2
-rw-r--r--standardization/pom.xml2
-rw-r--r--version.properties2
38 files changed, 382 insertions, 42 deletions
diff --git a/Changelog.md b/Changelog.md
index 81b5d026..8c256593 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -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 dbe1f758..a56558be 100644
--- 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>
diff --git a/rest-services/cbs-client/pom.xml b/rest-services/cbs-client/pom.xml
index 1fdc9046..02bfb75e 100644
--- a/rest-services/cbs-client/pom.xml
+++ b/rest-services/cbs-client/pom.xml
@@ -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
index 00000000..0113000d
--- /dev/null
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/api/exceptions/EnvironmentParsingException.java
@@ -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);
+ }
+}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMap.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMap.java
index 875e20ed..42f53616 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMap.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMap.java
@@ -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
index 00000000..17144f1a
--- /dev/null
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientEnvironmentParsing.java
@@ -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;
+ }
+}
diff --git a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientRest.java b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientRest.java
index 4559a902..3eda6d8a 100644
--- a/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientRest.java
+++ b/rest-services/cbs-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientRest.java
@@ -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);
}
diff --git a/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMapTest.java b/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMapTest.java
index 07b44e9e..a9d8407b 100644
--- a/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMapTest.java
+++ b/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientConfigMapTest.java
@@ -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
index 00000000..41d757fd
--- /dev/null
+++ b/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientEnvironmentParsingTest.java
@@ -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);
+ }
+}
diff --git a/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientImplIT.java b/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientImplIT.java
index 83743a6c..db881a2e 100644
--- a/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientImplIT.java
+++ b/rest-services/cbs-client/src/test/java/org/onap/dcaegen2/services/sdk/rest/services/cbs/client/impl/CbsClientImplIT.java
@@ -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);
@@ -143,8 +155,29 @@ class CbsClientImplIT {
}
@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());
diff --git a/rest-services/cbs-client/src/test/resources/application_config.yaml b/rest-services/cbs-client/src/test/resources/application_config.yaml
index c43b9733..a2466802 100644
--- a/rest-services/cbs-client/src/test/resources/application_config.yaml
+++ b/rest-services/cbs-client/src/test/resources/application_config.yaml
@@ -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
index 00000000..2ceda99a
--- /dev/null
+++ b/rest-services/cbs-client/src/test/resources/sample_expected_service_config.json
@@ -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"
+ }
+ }
+ }
+}
diff --git a/rest-services/cbs-client/src/test/resources/sample_service_config.json b/rest-services/cbs-client/src/test/resources/sample_service_config.json
index 266326f4..e5798597 100644
--- a/rest-services/cbs-client/src/test/resources/sample_service_config.json
+++ b/rest-services/cbs-client/src/test/resources/sample_service_config.json
@@ -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",
@@ -9,12 +17,20 @@
}
},
"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",
diff --git a/rest-services/dmaap-client/pom.xml b/rest-services/dmaap-client/pom.xml
index bb8953ec..cb1d811f 100644
--- a/rest-services/dmaap-client/pom.xml
+++ b/rest-services/dmaap-client/pom.xml
@@ -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/http-client/pom.xml b/rest-services/http-client/pom.xml
index 5df35e12..ffb93b3c 100644
--- a/rest-services/http-client/pom.xml
+++ b/rest-services/http-client/pom.xml
@@ -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>
diff --git a/rest-services/model/pom.xml b/rest-services/model/pom.xml
index 6810c3e1..0c009030 100644
--- a/rest-services/model/pom.xml
+++ b/rest-services/model/pom.xml
@@ -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>
diff --git a/rest-services/pom.xml b/rest-services/pom.xml
index 8a64cd35..ddc6c25e 100644
--- a/rest-services/pom.xml
+++ b/rest-services/pom.xml
@@ -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>
diff --git a/security/crypt-password/pom.xml b/security/crypt-password/pom.xml
index b377baa2..d5fbb3b1 100644
--- a/security/crypt-password/pom.xml
+++ b/security/crypt-password/pom.xml
@@ -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>
diff --git a/security/pom.xml b/security/pom.xml
index 72385a93..f2c92c1c 100644
--- a/security/pom.xml
+++ b/security/pom.xml
@@ -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>
diff --git a/security/ssl/pom.xml b/security/ssl/pom.xml
index 020edb8a..ff6f61b1 100644
--- a/security/ssl/pom.xml
+++ b/security/ssl/pom.xml
@@ -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>
diff --git a/services/common/pom.xml b/services/common/pom.xml
index cc25fcb6..10b0358c 100644
--- a/services/common/pom.xml
+++ b/services/common/pom.xml
@@ -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>
diff --git a/services/external-schema-manager/pom.xml b/services/external-schema-manager/pom.xml
index e8185ac1..5cec95d7 100644
--- a/services/external-schema-manager/pom.xml
+++ b/services/external-schema-manager/pom.xml
@@ -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>
diff --git a/services/hv-ves-client/pom.xml b/services/hv-ves-client/pom.xml
index f6217997..a7dbae89 100644
--- a/services/hv-ves-client/pom.xml
+++ b/services/hv-ves-client/pom.xml
@@ -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>
diff --git a/services/hv-ves-client/producer/api/pom.xml b/services/hv-ves-client/producer/api/pom.xml
index 3bbb9d85..1d49ff8b 100644
--- a/services/hv-ves-client/producer/api/pom.xml
+++ b/services/hv-ves-client/producer/api/pom.xml
@@ -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>
diff --git a/services/hv-ves-client/producer/ct/pom.xml b/services/hv-ves-client/producer/ct/pom.xml
index ded0d9a5..cccd3c35 100644
--- a/services/hv-ves-client/producer/ct/pom.xml
+++ b/services/hv-ves-client/producer/ct/pom.xml
@@ -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>
diff --git a/services/hv-ves-client/producer/impl/pom.xml b/services/hv-ves-client/producer/impl/pom.xml
index 38741ca4..daa8fa18 100644
--- a/services/hv-ves-client/producer/impl/pom.xml
+++ b/services/hv-ves-client/producer/impl/pom.xml
@@ -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>
diff --git a/services/hv-ves-client/producer/pom.xml b/services/hv-ves-client/producer/pom.xml
index fbf2ffe8..f82f5491 100644
--- a/services/hv-ves-client/producer/pom.xml
+++ b/services/hv-ves-client/producer/pom.xml
@@ -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>
diff --git a/services/hv-ves-client/protobuf/pom.xml b/services/hv-ves-client/protobuf/pom.xml
index aa43b363..6cffdba9 100644
--- a/services/hv-ves-client/protobuf/pom.xml
+++ b/services/hv-ves-client/protobuf/pom.xml
@@ -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>
diff --git a/services/pom.xml b/services/pom.xml
index d1ca1901..43376c95 100644
--- a/services/pom.xml
+++ b/services/pom.xml
@@ -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>
diff --git a/standardization/api-custom-header/pom.xml b/standardization/api-custom-header/pom.xml
index 678ce678..733796fa 100644
--- a/standardization/api-custom-header/pom.xml
+++ b/standardization/api-custom-header/pom.xml
@@ -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>
diff --git a/standardization/moher-api/healthstate/pom.xml b/standardization/moher-api/healthstate/pom.xml
index e67a5011..e0707749 100644
--- a/standardization/moher-api/healthstate/pom.xml
+++ b/standardization/moher-api/healthstate/pom.xml
@@ -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>
diff --git a/standardization/moher-api/metrics/pom.xml b/standardization/moher-api/metrics/pom.xml
index 0dc12e58..90ca0ace 100644
--- a/standardization/moher-api/metrics/pom.xml
+++ b/standardization/moher-api/metrics/pom.xml
@@ -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>
diff --git a/standardization/moher-api/pom.xml b/standardization/moher-api/pom.xml
index a6c602db..93728f5d 100644
--- a/standardization/moher-api/pom.xml
+++ b/standardization/moher-api/pom.xml
@@ -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>
diff --git a/standardization/moher-api/server-adapters/pom.xml b/standardization/moher-api/server-adapters/pom.xml
index da1b2a6e..23f7fe50 100644
--- a/standardization/moher-api/server-adapters/pom.xml
+++ b/standardization/moher-api/server-adapters/pom.xml
@@ -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>
diff --git a/standardization/moher-api/server-adapters/reactor-netty/pom.xml b/standardization/moher-api/server-adapters/reactor-netty/pom.xml
index cd08bddf..65b92fdb 100644
--- a/standardization/moher-api/server-adapters/reactor-netty/pom.xml
+++ b/standardization/moher-api/server-adapters/reactor-netty/pom.xml
@@ -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>
diff --git a/standardization/moher-api/server-adapters/spring-webflux/pom.xml b/standardization/moher-api/server-adapters/spring-webflux/pom.xml
index f297b906..05bc402d 100644
--- a/standardization/moher-api/server-adapters/spring-webflux/pom.xml
+++ b/standardization/moher-api/server-adapters/spring-webflux/pom.xml
@@ -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>
diff --git a/standardization/pom.xml b/standardization/pom.xml
index 1673690f..de0f2b7e 100644
--- a/standardization/pom.xml
+++ b/standardization/pom.xml
@@ -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>
diff --git a/version.properties b/version.properties
index eb090668..7014c959 100644
--- a/version.properties
+++ b/version.properties
@@ -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