summaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/dcaegen2/services/pmmapper/config/ConfigHandlerTests.java
diff options
context:
space:
mode:
authorTomasz Wrobel <tomasz.wrobel@nokia.com>2022-01-25 11:00:42 +0100
committerTomasz Wrobel <tomasz.wrobel@nokia.com>2022-02-11 12:27:06 +0100
commit9d02ea09cac22c177688622ed50a7eb3f6fd38ce (patch)
tree430c1dfc64d505a24a380d7eeef48d0f1c3d37db /src/test/java/org/onap/dcaegen2/services/pmmapper/config/ConfigHandlerTests.java
parent6fa1dfca682711066189bef2f946433b614239fe (diff)
Fix loading SSL Context when certpaths not exist in configuration1.8.0
- Make cert paths field optional in configuration. - Allow to skip ssl context load. - Make PublisherConfig and SubscriberConfig fields optional. - Remove Auth Header when AAF credentials are empty Issue-ID: DCAEGEN2-3032 Issue-ID: DCAEGEN2-3038 Signed-off-by: Tomasz Wrobel <tomasz.wrobel@nokia.com> Change-Id: I27d44cf8c2887b3a75c5ad16f833439b7b5757ee
Diffstat (limited to 'src/test/java/org/onap/dcaegen2/services/pmmapper/config/ConfigHandlerTests.java')
-rw-r--r--src/test/java/org/onap/dcaegen2/services/pmmapper/config/ConfigHandlerTests.java20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/config/ConfigHandlerTests.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/config/ConfigHandlerTests.java
index a1538ee..d007123 100644
--- a/src/test/java/org/onap/dcaegen2/services/pmmapper/config/ConfigHandlerTests.java
+++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/config/ConfigHandlerTests.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Nordix Foundation.
- * Copyright (C) 2022 Nokia.
+ * Copyright (C) 2022 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.
@@ -20,6 +20,7 @@
*/
package org.onap.dcaegen2.services.pmmapper.config;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
@@ -62,6 +63,8 @@ class ConfigHandlerTests {
private static String validMapperConfigChanged;
private static final Path INVALID_CONFIGS_DIRECTORY = Paths.get("src/test/resources/invalid_configs/");
+ private static final Path MISSING_OPTIONAL_FIELDS_CONFIGS_DIRECTORY =
+ Paths.get("src/test/resources/missing_optional_fields/");
private static final String EXPECTED_ERROR_MESSAGE_IN_LOG = "Error parsing configuration";
private static final String EXPECTED_CHANGED_VALUE = "https://dmaap-dr-node:8443/delete_changed";
@@ -142,6 +145,17 @@ class ConfigHandlerTests {
}
@ParameterizedTest
+ @MethodSource("getConfigsWithMissingOptionalFields")
+ void should_parse_json_with_missing_optional_fields(String mapperConfig) {
+ Mono<JsonObject> just = createMonoJsonObject(mapperConfig);
+
+ when(cbsClient.get(any())).thenReturn(just);
+ ConfigHandler configHandler = new ConfigHandler(cbsClient, cbsRequest);
+
+ assertDoesNotThrow(configHandler::getInitialConfiguration);
+ }
+
+ @ParameterizedTest
@MethodSource("getInvalidConfigs")
void parse_valid_json_bad_values_mapper_config(String mapperConfig) throws Exception {
Mono<JsonObject> just = createMonoJsonObject(mapperConfig);
@@ -169,4 +183,8 @@ class ConfigHandlerTests {
private static List<String> getInvalidConfigs() throws IOException {
return FileUtils.getFilesFromDirectory(INVALID_CONFIGS_DIRECTORY);
}
+
+ private static List<String> getConfigsWithMissingOptionalFields() throws IOException {
+ return FileUtils.getFilesFromDirectory(MISSING_OPTIONAL_FIELDS_CONFIGS_DIRECTORY);
+ }
}