diff options
author | JoeOLeary <joseph.o.leary@est.tech> | 2019-07-19 10:02:12 +0000 |
---|---|---|
committer | JoeOLeary <joseph.o.leary@est.tech> | 2019-07-19 10:02:12 +0000 |
commit | 2c8ddf3501cfc5106d20b51ef077cc6d07ab65dc (patch) | |
tree | 700976f3c0621acfd7d96e43e71bc1eadda19abd /src/test | |
parent | 0e85c3644ea0141f7761da89926e358ef68acb41 (diff) |
Add DMaaP plugin support
- Update blueprint with DMaaP plugin support.
- Update configuration with new DMaaP plugin format.
- Move Configuration tests to correct package.
- Add latest-staging Docker image tag to pom.
- Change file endings in some files to LF.
- Remove publishing to non authenticated topic.
- Fix some tests which were not executing correctly.
- Fix some Sonar smells.
Issue-ID: DCAEGEN2-1581
Change-Id: I37fbb662419179e3fe9fb8bdf710d6a6e8f0308a
Signed-off-by: JoeOLeary <joseph.o.leary@est.tech>
Diffstat (limited to 'src/test')
34 files changed, 1548 insertions, 601 deletions
diff --git a/src/test/java/org/onap/dcaegen2/pmmapper/config/ConfigHandlerTests.java b/src/test/java/org/onap/dcaegen2/pmmapper/config/ConfigHandlerTests.java deleted file mode 100644 index e2bb4f5..0000000 --- a/src/test/java/org/onap/dcaegen2/pmmapper/config/ConfigHandlerTests.java +++ /dev/null @@ -1,165 +0,0 @@ -/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-package org.onap.dcaegen2.pmmapper.config;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.mockito.Mockito.when;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.UnknownHostException;
-import java.util.HashMap;
-import java.util.Map;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.*;
-
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.onap.dcaegen2.services.pmmapper.config.ConfigHandler;
-import org.onap.dcaegen2.services.pmmapper.exceptions.CBSConfigException;
-import org.onap.dcaegen2.services.pmmapper.exceptions.CBSServerError;
-import org.onap.dcaegen2.services.pmmapper.exceptions.EnvironmentConfigException;
-import org.onap.dcaegen2.services.pmmapper.exceptions.MapperConfigException;
-import org.onap.dcaegen2.services.pmmapper.model.EnvironmentConfig;
-import org.onap.dcaegen2.services.pmmapper.model.MapperConfig;
-import org.onap.dcaegen2.services.pmmapper.utils.RequestSender;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
-import com.google.gson.JsonParser;
-
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.read.ListAppender;
-import utils.LoggingUtils;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(EnvironmentConfig.class)
-public class ConfigHandlerTests {
- private static String validMapperConfig;
- private static String HOSTNAME = "pm-mapper-service-name";
- private static String CBS_HOST = "cbs_host";
- private static int CBS_PORT = 10000;
- private Gson gson = new Gson();
- @Mock
- private RequestSender sender;
-
- @BeforeClass()
- public static void beforeClass() throws Exception {
- validMapperConfig = getFileContents("valid_mapper_config.json");
- }
-
-
- @Before
- public void before() throws Exception {
- PowerMockito.mockStatic(EnvironmentConfig.class);
- PowerMockito.when(EnvironmentConfig.getCBSHostName()).thenReturn(CBS_HOST);
- PowerMockito.when(EnvironmentConfig.getCBSPort()).thenReturn(CBS_PORT);
- PowerMockito.when(EnvironmentConfig.getServiceName()).thenReturn(HOSTNAME);
- }
-
- @Test
- public void getMapperConfig_success() throws Exception {
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ConfigHandler.class);
- String validCbsUrl = "http://" + CBS_HOST + ":" + CBS_PORT +"/service_component/" + HOSTNAME;
- when(sender.send(validCbsUrl)).thenReturn(validMapperConfig);
-
- MapperConfig actualConfig = getMapperConfig();
- MapperConfig expectedConfig = gson.fromJson(validMapperConfig, MapperConfig.class);
-
- assertEquals(expectedConfig, actualConfig);
- assertEquals(logAppender.list.get(0).getMarker().getName(), "ENTRY");
- assertTrue(logAppender.list.get(1).getMessage().contains("Received pm-mapper configuration from ConfigBinding Service"));
- assertEquals(logAppender.list.get(1).getMarker().getName(), "EXIT");
- logAppender.stop();
- }
-
- @Test
- public void configbinding_server_error() throws Exception {
- when(sender.send(anyString())).thenThrow(CBSServerError.class);
- assertThrows(CBSServerError.class, this::getMapperConfig);
- }
-
- @Test
- public void configbinding_server_host_missing() throws Exception {
- PowerMockito.when(EnvironmentConfig.getCBSHostName()).thenThrow(EnvironmentConfigException.class);
- assertThrows(EnvironmentConfigException.class, this::getMapperConfig);
- }
-
- @Test
- public void mapper_parse_invalid_json() throws Exception {
- when(sender.send(anyString())).thenReturn("mapper config with incorrect format");
- assertThrows(MapperConfigException.class, this::getMapperConfig);
- }
-
- @Test
- public void mapper_parse_valid_json_missing_attributes() throws Exception {
- Map<String,String> invalidConfigs = new HashMap<>();
- invalidConfigs.put("streams_subscribes", "{}");
- invalidConfigs.put("streams_publishes", "{}");
- invalidConfigs.put("streams_publishes", null);
- invalidConfigs.remove("streams_publishes");
- invalidConfigs.put("pm-mapper-filter", null);
- invalidConfigs.put("pm-mapper-filter", "{}");
- invalidConfigs.put("pm-mapper-filter", "{ \"filters\": null},");
- invalidConfigs.put("pm-mapper-filter", "{ \"filters\": [{\"pmDefVsn\": \"V9\"}] },");
-
- invalidConfigs.forEach( (k,v) -> {
- try {
- when(sender.send(anyString())).thenReturn( getInvalidConfig(k,v));
- assertThrows(MapperConfigException.class, this::getMapperConfig);
- } catch (Exception e) {
- e.printStackTrace();
- }
- });
- }
-
- private MapperConfig getMapperConfig()
- throws UnknownHostException, EnvironmentConfigException, CBSConfigException, Exception {
- return new ConfigHandler(sender).getMapperConfig();
- }
-
- private static String getFileContents(String fileName) throws IOException {
- ClassLoader classLoader = ConfigHandlerTests.class.getClassLoader();
- String fileAsString = "";
- try (BufferedReader reader = new BufferedReader(
- new InputStreamReader(classLoader.getResourceAsStream(fileName)))) {
- String line;
- while ((line = reader.readLine()) != null) {
- fileAsString += line;
- }
- }
- return fileAsString;
- }
-
- private String getInvalidConfig(String validKey, String invalidValue) {
- JsonObject invalidConfigJson = new JsonParser().parse(validMapperConfig).getAsJsonObject();
- invalidConfigJson.addProperty(validKey, invalidValue);
- return invalidConfigJson.toString();
- }
-
-}
diff --git a/src/test/java/org/onap/dcaegen2/pmmapper/messagerouter/VESPublisherTest.java b/src/test/java/org/onap/dcaegen2/pmmapper/messagerouter/VESPublisherTest.java index 2244d2d..ef508f3 100644 --- a/src/test/java/org/onap/dcaegen2/pmmapper/messagerouter/VESPublisherTest.java +++ b/src/test/java/org/onap/dcaegen2/pmmapper/messagerouter/VESPublisherTest.java @@ -1,90 +1,90 @@ -/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-package org.onap.dcaegen2.pmmapper.messagerouter;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import reactor.test.StepVerifier;
-import java.util.Arrays;
-import java.util.List;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mockito;
-import org.onap.dcaegen2.services.pmmapper.exceptions.MRPublisherException;
-import org.onap.dcaegen2.services.pmmapper.messagerouter.VESPublisher;
-import org.onap.dcaegen2.services.pmmapper.model.EnvironmentConfig;
-import org.onap.dcaegen2.services.pmmapper.model.Event;
-import org.onap.dcaegen2.services.pmmapper.model.MapperConfig;
-import org.onap.dcaegen2.services.pmmapper.utils.RequestSender;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import reactor.core.publisher.Flux;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(EnvironmentConfig.class)
-public class VESPublisherTest {
-
- private static String topicURL = "http://mr/topic";
- private static RequestSender sender;
- private static MapperConfig config;
- private VESPublisher sut;
- private String ves = "{}";
-
- @Before
- public void before() throws Exception {
- config = mock(MapperConfig.class);
- sender = mock(RequestSender.class);
- sut = new VESPublisher(config, sender);
- when(config.getPublisherTopicUrl()).thenReturn(topicURL);
- }
-
- @Test
- public void publish_multiple_success() throws Exception {
- Event event = mock(Event.class);
- List<Event> events = Arrays.asList(event,event,event);
- when(event.getVes()).thenReturn(ves);
-
- Flux<Event> flux = sut.publish(events);
-
- verify(sender, times(3)).send(Mockito.anyString(),Mockito.anyString(), Mockito.anyString(), Mockito.anyString());
- StepVerifier.create(flux)
- .expectNextMatches(event::equals)
- .expectComplete()
- .verify();
- }
-
- @Test
- public void publish_multiple_fail() throws Exception {
- Event event = mock(Event.class);
- List<Event> events = Arrays.asList(event,event,event);
- when(event.getVes()).thenReturn(ves);
- when(sender.send("POST",topicURL,ves,"base64encoded")).thenThrow(Exception.class);
-
- Flux<Event> flux = sut.publish(events);
-
- StepVerifier.create(flux)
- .expectNext(events.get(0))
- .verifyComplete();
- }
-}
+/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.dcaegen2.pmmapper.messagerouter; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import reactor.test.StepVerifier; +import java.util.Arrays; +import java.util.List; + +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mockito; +import org.onap.dcaegen2.services.pmmapper.exceptions.MRPublisherException; +import org.onap.dcaegen2.services.pmmapper.messagerouter.VESPublisher; +import org.onap.dcaegen2.services.pmmapper.utils.EnvironmentConfig; +import org.onap.dcaegen2.services.pmmapper.model.Event; +import org.onap.dcaegen2.services.pmmapper.model.MapperConfig; +import org.onap.dcaegen2.services.pmmapper.utils.RequestSender; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import reactor.core.publisher.Flux; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(EnvironmentConfig.class) +public class VESPublisherTest { + + private static String topicURL = "http://mr/topic"; + private static RequestSender sender; + private static MapperConfig config; + private VESPublisher sut; + private String ves = "{}"; + + @Before + public void before() throws Exception { + config = mock(MapperConfig.class); + sender = mock(RequestSender.class); + sut = new VESPublisher(config, sender); + when(config.getPublisherTopicUrl()).thenReturn(topicURL); + } + + @Test + public void publish_multiple_success() throws Exception { + Event event = mock(Event.class); + List<Event> events = Arrays.asList(event,event,event); + when(event.getVes()).thenReturn(ves); + + Flux<Event> flux = sut.publish(events); + + verify(sender, times(3)).send(Mockito.anyString(),Mockito.anyString(), Mockito.anyString(), Mockito.anyString()); + StepVerifier.create(flux) + .expectNextMatches(event::equals) + .expectComplete() + .verify(); + } + + @Test + public void publish_multiple_fail() throws Exception { + Event event = mock(Event.class); + List<Event> events = Arrays.asList(event,event,event); + when(event.getVes()).thenReturn(ves); + when(sender.send("POST",topicURL,ves,"base64encoded")).thenThrow(Exception.class); + + Flux<Event> flux = sut.publish(events); + + StepVerifier.create(flux) + .expectNext(events.get(0)) + .verifyComplete(); + } +} diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/AppTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/AppTest.java index 2db24b4..11215b3 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/AppTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/AppTest.java @@ -74,8 +74,8 @@ class AppTest { @BeforeAll public static void setup() { - mockServer = startClientAndServer(1080); - client = new MockServerClient("127.0.0.1", 1080); + mockServer = startClientAndServer(35454); + client = new MockServerClient("127.0.0.1", 35454); } @AfterAll @@ -210,7 +210,7 @@ class AppTest { MeasFilterHandler mockFilter = Mockito.mock(MeasFilterHandler.class); MapperConfig mockConfig = Mockito.mock(MapperConfig.class); - Mockito.when(mockConfig.getDmaapDRDeleteEndpoint()).thenReturn("http://127.0.0.1:1080"); + Mockito.when(mockConfig.getDmaapDRDeleteEndpoint()).thenReturn("http://127.0.0.1:35454"); Mockito.when(mockConfig.getSubscriberIdentity()).thenReturn("sid"); Mockito.when(mockEvent.getPublishIdentity()).thenReturn("pid"); Mockito.when(mockFilter.filterByMeasType(mockEvent)).thenThrow(RuntimeException.class); 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 new file mode 100644 index 0000000..92d2c93 --- /dev/null +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/config/ConfigHandlerTests.java @@ -0,0 +1,140 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.dcaegen2.services.pmmapper.config; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.Mockito.anyString; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.IOException; +import java.net.UnknownHostException; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.onap.dcaegen2.services.pmmapper.exceptions.CBSConfigException; +import org.onap.dcaegen2.services.pmmapper.exceptions.CBSServerError; +import org.onap.dcaegen2.services.pmmapper.exceptions.EnvironmentConfigException; +import org.onap.dcaegen2.services.pmmapper.exceptions.MapperConfigException; +import org.onap.dcaegen2.services.pmmapper.utils.EnvironmentConfig; +import org.onap.dcaegen2.services.pmmapper.model.MapperConfig; +import org.onap.dcaegen2.services.pmmapper.utils.RequestSender; + + +import com.google.gson.Gson; +import com.google.gson.JsonObject; + +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.read.ListAppender; +import utils.FileUtils; +import utils.LoggingUtils; + +@ExtendWith(MockitoExtension.class) +class ConfigHandlerTests { + private static String validMapperConfig; + private static String HOSTNAME = "pm-mapper-service-name"; + private static String CBS_HOST = "cbs_host"; + private static int CBS_PORT = 10000; + private static Path invalidConfigsDirectory = Paths.get("src/test/resources/invalid_configs/"); + + private Gson gson = new Gson(); + + @Mock + private RequestSender sender; + + @Mock + private static EnvironmentConfig config; + + @BeforeAll + static void beforeAll() throws Exception { + validMapperConfig = FileUtils.getFileContents("valid_mapper_config.json"); + config = mock(EnvironmentConfig.class); + when(config.getServiceName()).thenReturn(HOSTNAME); + when(config.getCBSPort()).thenReturn(CBS_PORT); + } + + @BeforeEach + void setup() throws Exception { + when(config.getCBSHostName()).thenReturn(CBS_HOST); + } + + @Test + void getMapperConfig_success() throws Exception { + when(config.getCBSHostName()).thenReturn(CBS_HOST); + when(config.getServiceName()).thenReturn(HOSTNAME); + when(config.getCBSPort()).thenReturn(CBS_PORT); + + ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(ConfigHandler.class); + String validCbsUrlMapperConfig = "http://" + CBS_HOST + ":" + CBS_PORT + "/service_component/" + HOSTNAME; + when(sender.send(validCbsUrlMapperConfig)).thenReturn(validMapperConfig); + MapperConfig actualConfig = getMapperConfig(); + JsonObject expectedConfigJson = gson.fromJson(validMapperConfig, JsonObject.class); + MapperConfig expectedConfig = gson.fromJson(expectedConfigJson, MapperConfig.class); + assertEquals(expectedConfig, actualConfig); + assertTrue(logAppender.list.get(1).getMessage().contains("Received pm-mapper configuration from ConfigBinding Service")); + logAppender.stop(); + } + + @Test + void configbinding_server_error() throws Exception { + when(sender.send(anyString())).thenThrow(CBSServerError.class); + assertThrows(CBSServerError.class, this::getMapperConfig); + } + + @Test + void configbinding_server_host_missing() throws Exception { + when(config.getCBSHostName()).thenThrow(EnvironmentConfigException.class); + assertThrows(EnvironmentConfigException.class, this::getMapperConfig); + } + + @Test + void mapper_parse_invalid_json_mapper_config() throws Exception { + when(sender.send(anyString())).thenReturn("mapper config with incorrect format"); + assertThrows(MapperConfigException.class, this::getMapperConfig); + } + + @ParameterizedTest + @MethodSource("getInvalidConfigs") + void parse_valid_json_bad_values_mapper_config(String mapperConfig) throws Exception { + when(sender.send(anyString())).thenReturn(mapperConfig); + assertThrows(MapperConfigException.class, this::getMapperConfig); + } + + private MapperConfig getMapperConfig() + throws UnknownHostException, EnvironmentConfigException, CBSConfigException, Exception { + return new ConfigHandler(sender, config).getMapperConfig(); + } + + private static List<String> getInvalidConfigs() throws IOException { + return FileUtils.getFilesFromDirectory(invalidConfigsDirectory); + } +} diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/config/DynamicConfigurationTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/config/DynamicConfigurationTest.java index c900942..905d18a 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/config/DynamicConfigurationTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/config/DynamicConfigurationTest.java @@ -20,31 +20,27 @@ package org.onap.dcaegen2.services.pmmapper.config; - import com.google.gson.JsonObject; import com.google.gson.JsonParser; import io.undertow.server.HttpServerExchange; import io.undertow.util.StatusCodes; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.invocation.InvocationOnMock; +import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.stubbing.Answer; import org.onap.dcaegen2.services.pmmapper.exceptions.ReconfigurationException; -import org.onap.dcaegen2.services.pmmapper.model.EnvironmentConfig; +import org.onap.dcaegen2.services.pmmapper.utils.EnvironmentConfig; import org.onap.dcaegen2.services.pmmapper.model.MapperConfig; import org.onap.dcaegen2.services.pmmapper.utils.RequestSender; -import org.powermock.api.mockito.PowerMockito; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; +import utils.ConfigUtils; import java.util.ArrayList; +import utils.FileUtils; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.RETURNS_DEEP_STUBS; @@ -55,62 +51,55 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -@RunWith(PowerMockRunner.class) -@PrepareForTest({DynamicConfiguration.class, EnvironmentConfig.class}) -public class DynamicConfigurationTest { - private static Path VALID_CONFIG_PATH = Paths.get("src/test/resources/valid_mapper_config.json"); +@ExtendWith(MockitoExtension.class) +class DynamicConfigurationTest { + private static final String VALID_MAPPER_CONFIG_FILE = "valid_mapper_config.json"; private static ArrayList<Configurable> configurables; private DynamicConfiguration objUnderTest; - private static String config; + private static String mapperConfig; private MapperConfig originalMapperConfig; + private static ConfigHandler configHandler; + + @Mock + private static RequestSender sender; @Mock - private RequestSender sender; + private static EnvironmentConfig config; - @BeforeClass() - public static void setupBeforeClass() throws Exception { - config = new String(Files.readAllBytes(VALID_CONFIG_PATH)); + @BeforeAll + static void setupBeforeAll() throws Exception { + mapperConfig = FileUtils.getFileContents(VALID_MAPPER_CONFIG_FILE); } - @Before - public void setup() throws Exception { + @BeforeEach + void setup() throws Exception { + configHandler = new ConfigHandler(sender, config); + when(sender.send(any())).thenReturn(mapperConfig); + originalMapperConfig = ConfigUtils.getMapperConfigFromFile(VALID_MAPPER_CONFIG_FILE); configurables = new ArrayList<>(); - PowerMockito.mockStatic(EnvironmentConfig.class); - PowerMockito.when(EnvironmentConfig.getCBSHostName()).thenReturn(""); - PowerMockito.when(EnvironmentConfig.getCBSPort()).thenReturn(1); - PowerMockito.when(EnvironmentConfig.getServiceName()).thenReturn(""); - - when(sender.send(any())).thenReturn(config); - ConfigHandler configHandler = new ConfigHandler(sender); - originalMapperConfig = configHandler.getMapperConfig(); objUnderTest = new DynamicConfiguration(configurables, originalMapperConfig); } @Test - public void testNoChangeResponse() throws Exception { - ConfigHandler configHandler = new ConfigHandler(sender); + void testNoChangeResponse() throws Exception { originalMapperConfig = configHandler.getMapperConfig(); objUnderTest.setConfigHandler(configHandler); - HttpServerExchange httpServerExchange = mock(HttpServerExchange.class, RETURNS_DEEP_STUBS); objUnderTest.handleRequest(httpServerExchange); - assertEquals(originalMapperConfig, objUnderTest.getOriginalConfig()); verify(httpServerExchange, times(1)).setStatusCode(StatusCodes.OK); + assertEquals(originalMapperConfig, objUnderTest.getOriginalConfig()); } @Test - public void testApplyOriginalUponFailure() throws Exception { - ConfigHandler configHandler = new ConfigHandler(sender); + void testApplyOriginalUponFailure() throws Exception { Configurable configurable = mock(Configurable.class); configurables.add(configurable); - JsonObject modifiedConfig = new JsonParser().parse(config).getAsJsonObject(); + JsonObject modifiedConfig = new JsonParser().parse(mapperConfig).getAsJsonObject(); modifiedConfig.addProperty("dmaap_dr_delete_endpoint","http://modified-delete-endpoint/1"); when(sender.send(any())).thenReturn(modifiedConfig.toString()); MapperConfig modifiedMapperConfig = configHandler.getMapperConfig(); - objUnderTest.setConfigHandler(configHandler); - doAnswer(new Answer() { boolean failFirstReconfigure = true; @Override @@ -132,14 +121,14 @@ public class DynamicConfigurationTest { } @Test - public void testSuccessfulReconfiguration() throws Exception { - ConfigHandler configHandler = new ConfigHandler(sender); + void testSuccessfulReconfiguration() throws Exception { Configurable configurable = mock(Configurable.class); configurables.add(configurable); - JsonObject modifiedConfig = new JsonParser().parse(config).getAsJsonObject(); + JsonObject modifiedConfig = new JsonParser().parse(mapperConfig).getAsJsonObject(); modifiedConfig.addProperty("dmaap_dr_delete_endpoint","http://modified-delete-endpoint/1"); - when(sender.send(any())).thenReturn(modifiedConfig.toString()); + when(sender.send(any())) + .thenReturn(modifiedConfig.toString()); MapperConfig modifiedMapperConfig = configHandler.getMapperConfig(); objUnderTest.setConfigHandler(configHandler); @@ -152,18 +141,21 @@ public class DynamicConfigurationTest { } @Test - public void testMapperConfigReconfiguration() throws Exception { - ConfigHandler configHandler = new ConfigHandler(sender); - JsonObject modifiedConfigJson = new JsonParser().parse(config).getAsJsonObject(); + void testMapperConfigReconfiguration() throws Exception { + JsonObject modifiedConfigJson = new JsonParser().parse(mapperConfig).getAsJsonObject(); modifiedConfigJson.addProperty("dmaap_dr_delete_endpoint","http://modified-delete-endpoint/1"); - String newConfig = modifiedConfigJson.toString(); - - when(sender.send(any())).thenReturn(config,newConfig); - - MapperConfig originalConfig = configHandler.getMapperConfig(); + when(sender.send(any())) + .thenReturn(modifiedConfigJson.toString()); MapperConfig modifiedConfig = configHandler.getMapperConfig(); + originalMapperConfig.reconfigure(modifiedConfig); + assertEquals(originalMapperConfig, modifiedConfig); + } - originalConfig.reconfigure(modifiedConfig); - assertEquals(originalConfig, modifiedConfig); + @Test + void testMapperConfigReconfigurationNoChange() throws Exception { + when(sender.send(any())).thenReturn(mapperConfig); + MapperConfig inboundConfig = configHandler.getMapperConfig(); + originalMapperConfig.reconfigure(inboundConfig); + assertEquals(originalMapperConfig, inboundConfig); } } diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/datarouter/DeliveryHandlerTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/datarouter/DeliveryHandlerTest.java index 94a2c7d..9b7bc4d 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/datarouter/DeliveryHandlerTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/datarouter/DeliveryHandlerTest.java @@ -44,20 +44,17 @@ import io.undertow.util.StatusCodes; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.stubbing.Answer; -import org.onap.dcaegen2.services.pmmapper.model.EnvironmentConfig; import org.onap.dcaegen2.services.pmmapper.model.Event; -import org.powermock.core.classloader.annotations.PrepareForTest; -import org.powermock.modules.junit4.PowerMockRunner; import utils.LoggingUtils; -@RunWith(PowerMockRunner.class) -@PrepareForTest({DeliveryHandler.class, EnvironmentConfig.class}) -public class DeliveryHandlerTest { +@ExtendWith(MockitoExtension.class) +class DeliveryHandlerTest { private Path VALID_METADATA_PATH = Paths.get("src/test/resources/valid_metadata.json"); private Path INVALID_METADATA_PATH = Paths.get("src/test/resources/invalid_metadata.json"); @@ -67,13 +64,13 @@ public class DeliveryHandlerTest { private DeliveryHandler objUnderTest; - @Before - public void setUp() { + @BeforeEach + void setUp() { objUnderTest = new DeliveryHandler(eventReceiver); } @Test - public void testRequestInboundInvalidMetadata() throws Exception { + void testRequestInboundInvalidMetadata() throws Exception { HttpServerExchange httpServerExchange = mock(HttpServerExchange.class, RETURNS_DEEP_STUBS); JsonObject metadata = new JsonParser().parse(new String(Files .readAllBytes(INVALID_METADATA_PATH))).getAsJsonObject(); @@ -87,7 +84,7 @@ public class DeliveryHandlerTest { } @Test - public void testRequestInboundNoMetadata() throws Exception { + void testRequestInboundNoMetadata() throws Exception { HttpServerExchange httpServerExchange = mock(HttpServerExchange.class, RETURNS_DEEP_STUBS); Receiver receiver = mock(Receiver.class); HeaderMap headers = mock(HeaderMap.class); @@ -95,17 +92,6 @@ public class DeliveryHandlerTest { when(httpServerExchange.setStatusCode(anyInt())).thenReturn(httpServerExchange); when(httpServerExchange.getRequestHeaders()).thenReturn(headers); when(headers.get(any(String.class))).thenReturn(null); - - doAnswer((Answer<Void>) invocationOnMock -> { - Receiver.FullStringCallback callback = invocationOnMock.getArgument(0); - callback.handle(httpServerExchange, ""); - return null; - }).when(receiver).receiveFullString(any()); - doAnswer((Answer<Void>) invocationOnMock -> { - Runnable runnable = invocationOnMock.getArgument(0); - runnable.run(); - return null; - }).when(httpServerExchange).dispatch(any(Runnable.class)); objUnderTest.handleRequest(httpServerExchange); verify(httpServerExchange, times(1)).setStatusCode(StatusCodes.BAD_REQUEST); verify(httpServerExchange.getResponseSender(), times(1)).send("Missing Metadata."); @@ -113,7 +99,7 @@ public class DeliveryHandlerTest { } @Test - public void testRequestInboundSuccess() throws Exception { + void testRequestInboundSuccess() throws Exception { ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(DeliveryHandler.class); HttpServerExchange httpServerExchange = mock(HttpServerExchange.class, RETURNS_DEEP_STUBS); Receiver receiver = mock(Receiver.class); diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MetadataFilterTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MetadataFilterTest.java index 47c187a..abe1b39 100644 --- a/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MetadataFilterTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/filtering/MetadataFilterTest.java @@ -20,7 +20,6 @@ package org.onap.dcaegen2.services.pmmapper.filtering; -import com.google.gson.Gson; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.params.ParameterizedTest; @@ -29,10 +28,10 @@ import org.mockito.junit.jupiter.MockitoExtension; import org.onap.dcaegen2.services.pmmapper.model.Event; import org.onap.dcaegen2.services.pmmapper.model.MapperConfig; import org.powermock.core.classloader.annotations.PrepareForTest; +import utils.ConfigUtils; import utils.EventUtils; import java.io.IOException; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.List; @@ -44,41 +43,26 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @PrepareForTest(MapperConfig.class) public class MetadataFilterTest { - private MetadataFilter metadataFilter; + private static final String VALID_MAPPER_CONFIG_FILE = "valid_mapper_config.json"; + private static final String NO_FILTER_CONFIG_FILE = "no_filter_mapper_config.json"; + private static final String MULTIPLE_FILTER_CONFIG_FILE = "multiple_filter_mapper_config.json"; + private static final Path DATA_DIRECTORY = Paths.get("src/test/resources/xml_validator_test/test_data/"); + private static final Path VALID_METADATA = Paths.get("src/test/resources/valid_metadata.json"); + private static final Path INCORRECT_METADATA = Paths.get("src/test/resources/incorrect_metadata.json"); + private MetadataFilter metadataFilter; private static MapperConfig validConfig; private static MapperConfig noFilterConfig; private static MapperConfig multipleFilterConfig; - private static String validConfigFileContents; - private static String noFilterConfigFileContents; - private static String multipleFilterConfigFileContents; - - private static final Path validMetadata = Paths.get("src/test/resources/valid_metadata.json"); - private static final Path incorrectMetadata = Paths.get("src/test/resources/incorrect_metadata.json"); - - private static final Path validConfigPath = Paths.get("src/test/resources/valid_mapper_config.json"); - private static final Path noFilterConfigPath = Paths.get("src/test/resources/no_filter_mapper_config.json"); - private static final Path multipleFilterConfigPath = Paths.get("src/test/resources/multiple_filter_mapper_config.json"); - - private static final Path dataDirectory = Paths.get("src/test/resources/xml_validator_test/test_data/"); - - @BeforeEach void setup() throws Exception { - validConfigFileContents = new String(Files.readAllBytes(validConfigPath)); - noFilterConfigFileContents = new String(Files.readAllBytes(noFilterConfigPath)); - multipleFilterConfigFileContents = new String(Files.readAllBytes(multipleFilterConfigPath)); - - validConfig = new Gson().fromJson(validConfigFileContents, MapperConfig.class); - noFilterConfig = new Gson().fromJson(noFilterConfigFileContents, MapperConfig.class); - multipleFilterConfig = new Gson().fromJson(multipleFilterConfigFileContents, MapperConfig.class); - - - metadataFilter = new MetadataFilter(this.validConfig); + validConfig = ConfigUtils.getMapperConfigFromFile(VALID_MAPPER_CONFIG_FILE); + noFilterConfig = ConfigUtils.getMapperConfigFromFile(NO_FILTER_CONFIG_FILE); + multipleFilterConfig = ConfigUtils.getMapperConfigFromFile(MULTIPLE_FILTER_CONFIG_FILE); + metadataFilter = new MetadataFilter(validConfig); } - @ParameterizedTest @MethodSource("getEventsWithValidMetadata") void testValidMetadataPass(Event testEvent) { @@ -105,15 +89,13 @@ public class MetadataFilterTest { assertFalse(metadataFilter.filter(testEvent)); } - - private static List<Event> getEventsWithValidMetadata() throws IOException { - Path validDataDirectory = Paths.get(dataDirectory.toString() + "/valid/"); - return EventUtils.eventsFromDirectory(validDataDirectory, validMetadata); + Path validDataDirectory = Paths.get(DATA_DIRECTORY.toString() + "/valid/"); + return EventUtils.eventsFromDirectory(validDataDirectory, VALID_METADATA); } private static List<Event> getEventsWithInvalidMetadata() throws IOException { - Path validDataDirectory = Paths.get(dataDirectory.toString() + "/valid/"); - return EventUtils.eventsFromDirectory(validDataDirectory, incorrectMetadata); + Path validDataDirectory = Paths.get(DATA_DIRECTORY.toString() + "/valid/"); + return EventUtils.eventsFromDirectory(validDataDirectory, INCORRECT_METADATA); } }
\ No newline at end of file diff --git a/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/DMaaPAdapterTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/DMaaPAdapterTest.java new file mode 100644 index 0000000..9b22b95 --- /dev/null +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/DMaaPAdapterTest.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package org.onap.dcaegen2.services.pmmapper.utils; + +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.google.gson.JsonParseException; +import com.google.gson.stream.JsonReader; +import java.io.IOException; +import java.io.StringReader; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; +import org.onap.dcaegen2.services.pmmapper.model.PublisherConfig; +import org.onap.dcaegen2.services.pmmapper.model.SubscriberConfig; + +@ExtendWith(MockitoExtension.class) +class DMaaPAdapterTest { + private DMaaPAdapter objUnderTest; + + @BeforeEach + void beforeEach() { + objUnderTest = new DMaaPAdapter(); + } + + @Test + void testSuccessfulPublisher() throws IOException { + String dmaapPublisher = "{\"dmaap_publisher\": {\"dmaap_info\": {" + + "\"topic_url\": \"https://message-router:3905/events/org.onap.dmaap.mr.VES_PM\"," + + "\"client_role\": \"org.onap.dcae.pmPublisher\"," + + "\"location\": \"san-francisco\"," + + "\"client_id\": \"1562763644939\"" + "}," + + "\"something\":\"completely different\"}}"; + JsonReader reader = new JsonReader(new StringReader(dmaapPublisher)); + assertTrue(objUnderTest.read(reader) instanceof PublisherConfig); + } + + @Test + void testSuccessfulSubscriber() throws IOException { + String dmaapSubscriber = "{\"dmaap_subscriber\": {\"dmaap_info\": {" + + "\"username\": \"username\"," + + "\"password\": \"password\"," + + "\"location\": \"san-francisco\"," + + "\"delivery_url\": \"http://dcae-pm-mapper:8443/delivery\"," + + "\"subscriber_id\": 1" + "}}}"; + JsonReader reader = new JsonReader(new StringReader(dmaapSubscriber)); + assertTrue(objUnderTest.read(reader) instanceof SubscriberConfig); + } + + @Test + void testFailedAdaption() { + JsonReader reader = new JsonReader(new StringReader("{\"dmaap_subscriber\": {\"dmaap_info\": \"nope\"}")); + assertThrows(JsonParseException.class, () -> objUnderTest.read(reader)); + } + + @Test + void testNoAdaptionAttempt() { + JsonReader reader = new JsonReader(new StringReader("{\"dmaap_subscriber\": {}")); + assertThrows(JsonParseException.class, () -> objUnderTest.read(reader)); + } + + @Test + void testInvalidAdaptionTarget() { + JsonReader reader = new JsonReader(new StringReader("{\"A scratch? \": \"Your arm's off!\" }")); + assertThrows(IllegalArgumentException.class, () -> objUnderTest.read(reader)); + } + + @Test + void testFailWriting() { + assertThrows(UnsupportedOperationException.class, () -> objUnderTest.write(null, null)); + } +} diff --git a/src/test/java/org/onap/dcaegen2/pmmapper/config/EnvironmentConfigTest.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/EnvironmentConfigTest.java index 95a51f7..e3c32c8 100644 --- a/src/test/java/org/onap/dcaegen2/pmmapper/config/EnvironmentConfigTest.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/EnvironmentConfigTest.java @@ -17,14 +17,14 @@ * SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
-package org.onap.dcaegen2.pmmapper.config;
+
+package org.onap.dcaegen2.services.pmmapper.utils;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.dcaegen2.services.pmmapper.exceptions.EnvironmentConfigException;
-import org.onap.dcaegen2.services.pmmapper.model.EnvironmentConfig;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
@@ -32,40 +32,54 @@ import org.powermock.modules.junit4.PowerMockRunner; @RunWith(PowerMockRunner.class)
@PrepareForTest(EnvironmentConfig.class)
public class EnvironmentConfigTest {
+ private EnvironmentConfig objUnderTest;
@Before
public void before() throws Exception {
PowerMockito.mockStatic(System.class);
+ objUnderTest = new EnvironmentConfig();
}
@Test
public void environmentConfig_is_present_success() throws EnvironmentConfigException {
String CBS_HOST = "cbs_host";
PowerMockito.when(System.getenv(EnvironmentConfig.ENV_CBS_HOST_KEY)).thenReturn(CBS_HOST);
- assertEquals(CBS_HOST,EnvironmentConfig.getCBSHostName() );
+ assertEquals(CBS_HOST, objUnderTest.getCBSHostName());
}
@Test
public void environmentConfig_host_not_present() throws EnvironmentConfigException {
- PowerMockito.when(System.getenv(EnvironmentConfig.ENV_CBS_HOST_KEY)).thenCallRealMethod();
- assertThrows(EnvironmentConfigException.class,EnvironmentConfig::getCBSHostName);
+ PowerMockito.when(System.getenv(EnvironmentConfig.ENV_CBS_HOST_KEY)).thenReturn(null);
+ assertThrows(EnvironmentConfigException.class, objUnderTest::getCBSHostName);
}
@Test
public void environmentConfig_hostname_present() throws EnvironmentConfigException {
PowerMockito.when(System.getenv(EnvironmentConfig.ENV_SERVICE_NAME_KEY)).thenCallRealMethod();
- assertThrows(EnvironmentConfigException.class,EnvironmentConfig::getCBSHostName);
+ assertThrows(EnvironmentConfigException.class, objUnderTest::getCBSHostName);
}
@Test
public void environmentConfig_default_port_is_used() throws EnvironmentConfigException {
PowerMockito.when(System.getenv(EnvironmentConfig.ENV_CBS_PORT_KEY)).thenReturn(null);
- assertEquals(Integer.valueOf(EnvironmentConfig.DEFAULT_CBS_PORT),EnvironmentConfig.getCBSPort());
+ assertEquals(Integer.valueOf(EnvironmentConfig.DEFAULT_CBS_PORT), objUnderTest.getCBSPort());
}
@Test
public void environmentConfig_port_invalid() throws EnvironmentConfigException {
PowerMockito.when(System.getenv(EnvironmentConfig.ENV_CBS_PORT_KEY)).thenReturn("Invalid_port number");
- assertThrows(EnvironmentConfigException.class,EnvironmentConfig::getCBSHostName);
+ assertThrows(EnvironmentConfigException.class, objUnderTest::getCBSHostName);
+ }
+
+ @Test
+ public void environmentConfig_service_name_missing() {
+ PowerMockito.when(System.getenv(EnvironmentConfig.ENV_SERVICE_NAME_KEY)).thenReturn(null);
+ assertThrows(EnvironmentConfigException.class, objUnderTest::getServiceName);
+ }
+ @Test
+ public void environmentConfig_service_name_success() throws EnvironmentConfigException {
+ String serviceName = "we the best service";
+ PowerMockito.when(System.getenv(EnvironmentConfig.ENV_SERVICE_NAME_KEY)).thenReturn(serviceName);
+ assertEquals(serviceName, objUnderTest.getServiceName());
}
}
diff --git a/src/test/java/org/onap/dcaegen2/pmmapper/config/util/RequestSenderTests.java b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSenderTests.java index b349b80..34a2277 100644 --- a/src/test/java/org/onap/dcaegen2/pmmapper/config/util/RequestSenderTests.java +++ b/src/test/java/org/onap/dcaegen2/services/pmmapper/utils/RequestSenderTests.java @@ -1,124 +1,124 @@ -/*-
- * ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
- * ================================================================================
- * 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.
- *
- * SPDX-License-Identifier: Apache-2.0
- * ============LICENSE_END=========================================================
- */
-package org.onap.dcaegen2.pmmapper.config.util;
-
-import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
-import static org.mockserver.integration.ClientAndServer.startClientAndServer;
-import static org.mockserver.model.HttpRequest.request;
-import static org.mockserver.model.HttpResponse.response;
-
-import java.net.URL;
-import java.net.UnknownHostException;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockserver.client.server.MockServerClient;
-import org.mockserver.integration.ClientAndServer;
-import org.mockserver.model.HttpRequest;
-import org.mockserver.model.HttpStatusCode;
-import org.mockserver.verify.VerificationTimes;
-import org.onap.dcaegen2.services.pmmapper.utils.RequestSender;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.powermock.api.mockito.PowerMockito;
-import org.powermock.core.classloader.annotations.PrepareForTest;
-import org.powermock.modules.junit4.PowerMockRunner;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.read.ListAppender;
-import utils.LoggingUtils;
-
-@RunWith(PowerMockRunner.class)
-@PrepareForTest(RequestSender.class)
-
-public class RequestSenderTests {
- private static ClientAndServer mockServer;
- private MockServerClient client = mockClient();
-
- @BeforeClass
- public static void setup() {
- mockServer = startClientAndServer(1080);
- }
-
- @AfterClass
- public static void teardown() {
- mockServer.stop();
- }
-
- @Test
- public void send_success() throws Exception {
- String url = "http://127.0.0.1:1080/once";
- String uuidRegex = "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$";
- ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(RequestSender.class);
- HttpRequest req = HttpRequest.request();
-
- client.when(req
- .withHeader(ONAPLogConstants.Headers.REQUEST_ID, uuidRegex)
- .withHeader(ONAPLogConstants.Headers.INVOCATION_ID, uuidRegex))
- .respond(response()
- .withStatusCode(HttpStatusCode.OK_200.code())
- .withBody("ResponseBody"));
- String result = new RequestSender().send(url);
-
- client.verify(req, VerificationTimes.atLeast(1));
- assertEquals(result, "ResponseBody");
- assertTrue(logAppender.list.get(1).getMessage().contains("Sending"));
- assertTrue(logAppender.list.get(2).getMessage().contains("Received"));
- logAppender.stop();
- client.clear(req);
- }
-
- @Test
- public void host_unavailable_retry_mechanism() throws Exception {
- PowerMockito.mockStatic(Thread.class);
-
- client.when(request())
- .respond(response().withStatusCode(HttpStatusCode.SERVICE_UNAVAILABLE_503.code()));
-
- assertThrows(Exception.class, () -> {
- new RequestSender().send("http://127.0.0.1:1080/anypath");
- });
-
- client.verify(request(), VerificationTimes.exactly(5));
- client.clear(request());
- }
-
- @Test
- public void host_unknown() throws Exception {
- PowerMockito.mockStatic(Thread.class);
- String unknownHostUrl = "http://unknown-host:1080/host-is-unknown";
- PowerMockito.whenNew(URL.class).withArguments(unknownHostUrl)
- .thenThrow(UnknownHostException.class);
-
- assertThrows(Exception.class, () -> {
- new RequestSender().send(unknownHostUrl);
- });
-
- client.verify(request(), VerificationTimes.exactly(0));
- client.clear(request());
- }
-
- private MockServerClient mockClient() {
- return new MockServerClient("127.0.0.1", 1080);
- }
-
+/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ +package org.onap.dcaegen2.services.pmmapper.utils; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockserver.integration.ClientAndServer.startClientAndServer; +import static org.mockserver.model.HttpRequest.request; +import static org.mockserver.model.HttpResponse.response; + +import java.net.URL; +import java.net.UnknownHostException; + +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockserver.client.server.MockServerClient; +import org.mockserver.integration.ClientAndServer; +import org.mockserver.model.HttpRequest; +import org.mockserver.model.HttpStatusCode; +import org.mockserver.verify.VerificationTimes; +import org.onap.dcaegen2.services.pmmapper.utils.RequestSender; +import org.onap.logging.ref.slf4j.ONAPLogConstants; +import org.powermock.api.mockito.PowerMockito; +import org.powermock.core.classloader.annotations.PrepareForTest; +import org.powermock.modules.junit4.PowerMockRunner; +import ch.qos.logback.classic.spi.ILoggingEvent; +import ch.qos.logback.core.read.ListAppender; +import utils.LoggingUtils; + +@RunWith(PowerMockRunner.class) +@PrepareForTest(RequestSender.class) + +public class RequestSenderTests { + private static ClientAndServer mockServer; + private MockServerClient client = mockClient(); + + @BeforeClass + public static void setup() { + mockServer = startClientAndServer(35454); + } + + @AfterClass + public static void teardown() { + mockServer.stop(); + } + + @Test + public void send_success() throws Exception { + String url = "http://127.0.0.1:35454/once"; + String uuidRegex = "^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$"; + ListAppender<ILoggingEvent> logAppender = LoggingUtils.getLogListAppender(RequestSender.class); + HttpRequest req = HttpRequest.request(); + + client.when(req + .withHeader(ONAPLogConstants.Headers.REQUEST_ID, uuidRegex) + .withHeader(ONAPLogConstants.Headers.INVOCATION_ID, uuidRegex)) + .respond(response() + .withStatusCode(HttpStatusCode.OK_200.code()) + .withBody("ResponseBody")); + String result = new RequestSender().send(url); + + client.verify(req, VerificationTimes.atLeast(1)); + assertEquals(result, "ResponseBody"); + assertTrue(logAppender.list.get(1).getMessage().contains("Sending")); + assertTrue(logAppender.list.get(2).getMessage().contains("Received")); + logAppender.stop(); + client.clear(req); + } + + @Test + public void host_unavailable_retry_mechanism() throws Exception { + PowerMockito.mockStatic(Thread.class); + + client.when(request()) + .respond(response().withStatusCode(HttpStatusCode.SERVICE_UNAVAILABLE_503.code())); + + assertThrows(Exception.class, () -> { + new RequestSender().send("http://127.0.0.1:35454/anypath"); + }); + + client.verify(request(), VerificationTimes.exactly(5)); + client.clear(request()); + } + + @Test + public void host_unknown() throws Exception { + PowerMockito.mockStatic(Thread.class); + String unknownHostUrl = "http://unknown-host:35454/host-is-unknown"; + PowerMockito.whenNew(URL.class).withArguments(unknownHostUrl) + .thenThrow(UnknownHostException.class); + + assertThrows(Exception.class, () -> { + new RequestSender().send(unknownHostUrl); + }); + + client.verify(request(), VerificationTimes.exactly(0)); + client.clear(request()); + } + + private MockServerClient mockClient() { + return new MockServerClient("127.0.0.1", 35454); + } + }
\ No newline at end of file diff --git a/src/test/java/utils/ConfigUtils.java b/src/test/java/utils/ConfigUtils.java new file mode 100644 index 0000000..8cf6d87 --- /dev/null +++ b/src/test/java/utils/ConfigUtils.java @@ -0,0 +1,38 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package utils; + +import com.google.gson.Gson; +import org.onap.dcaegen2.services.pmmapper.model.MapperConfig; + + +public class ConfigUtils { + + /** + * Returns A MapperConfig Object Created from a file. + * Fails test in the event of failure to read file. + * @param mapperConfigFile Filename for the mapper config + * @return A Mapper Config Object + */ + public static MapperConfig getMapperConfigFromFile(String mapperConfigFile) { + return new Gson().fromJson(FileUtils.getFileContents(mapperConfigFile), MapperConfig.class); + } +} diff --git a/src/test/java/utils/EventUtils.java b/src/test/java/utils/EventUtils.java index eae050d..f14e080 100644 --- a/src/test/java/utils/EventUtils.java +++ b/src/test/java/utils/EventUtils.java @@ -51,13 +51,10 @@ public class EventUtils { */ public static List<Event> eventsFromDirectory(Path eventBodyDirectory, Path metadataPath) throws IOException { EventMetadata eventMetadata = new Gson().fromJson(fileContentsToString(metadataPath), EventMetadata.class); - try (Stream<Path> eventFileStream = Files.walk(eventBodyDirectory)) { - return eventFileStream.filter(Files::isRegularFile) - .filter(Files::isReadable) - .map(EventUtils::fileContentsToString) - .map(body -> EventUtils.makeMockEvent(body, eventMetadata)) - .collect(Collectors.toList()); - } + List<String> eventFiles = FileUtils.getFilesFromDirectory(eventBodyDirectory); + return eventFiles.stream() + .map(contents -> EventUtils.makeMockEvent(contents, eventMetadata)) + .collect(Collectors.toList()); } /** diff --git a/src/test/java/utils/FileUtils.java b/src/test/java/utils/FileUtils.java new file mode 100644 index 0000000..8b58618 --- /dev/null +++ b/src/test/java/utils/FileUtils.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2019 Nordix Foundation. + * ================================================================================ + * 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. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +package utils; + +import static org.junit.jupiter.api.Assertions.fail; + +import java.io.IOException; +import java.net.URISyntaxException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +public class FileUtils { + + /** + * Reads contents of files inside the eventBodyDirectory, combines contents with metadata to make an Event Object. + * Fails test in the event of failure to read a file. + * @param targetDirectory Path to directory with files. + * @return List of Strings containing the body as acquired from files inside targetDirectory. + * @throws IOException in the event it fails to read from the files. + */ + public static List<String> getFilesFromDirectory(Path targetDirectory ) throws IOException { + try (Stream<Path> eventFileStream = Files.walk(targetDirectory)) { + return eventFileStream.filter(Files::isRegularFile) + .filter(Files::isReadable) + .map(FileUtils::getFileContents) + .collect(Collectors.toList()); + } + } + + /** + * reads contents of file into a string. + * fails a tests in the event failure occurs. + * @param path path to file. + * @return string containing files contents + */ + public static String getFileContents(Path path) { + try { + return new String(Files.readAllBytes(path)); + } catch (IOException exception) { + fail("IOException occurred while reading file."); + } + return null; + } + + /** + * Reads contents of resource. + * fails a test in the event failure occurs. + * @param fileName of file in resources to be read. + * @return contents of file + */ + public static String getFileContents(String fileName) { + try { + Path path = Paths.get(ClassLoader.getSystemResource(fileName).toURI()); + return getFileContents(path); + } catch (URISyntaxException exception) { + fail("Exception occurred, failed to acquire resource URI."); + } + return null; + } +} diff --git a/src/test/resources/invalid_configs/empty_filter_object.json b/src/test/resources/invalid_configs/empty_filter_object.json new file mode 100644 index 0000000..8c72b83 --- /dev/null +++ b/src/test/resources/invalid_configs/empty_filter_object.json @@ -0,0 +1,35 @@ +{ + "pm-mapper-filter": {}, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/invalid_filter_object.json b/src/test/resources/invalid_configs/invalid_filter_object.json new file mode 100644 index 0000000..1b7b0e3 --- /dev/null +++ b/src/test/resources/invalid_configs/invalid_filter_object.json @@ -0,0 +1,41 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9" + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_aaf_identity.json b/src/test/resources/invalid_configs/null_aaf_identity.json new file mode 100644 index 0000000..8f9c7ef --- /dev/null +++ b/src/test/resources/invalid_configs/null_aaf_identity.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": null, + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_aaf_password.json b/src/test/resources/invalid_configs/null_aaf_password.json new file mode 100644 index 0000000..d54d825 --- /dev/null +++ b/src/test/resources/invalid_configs/null_aaf_password.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": null, + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_client_role.json b/src/test/resources/invalid_configs/null_client_role.json new file mode 100644 index 0000000..40471de --- /dev/null +++ b/src/test/resources/invalid_configs/null_client_role.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": null, + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_dmaap_dr_delete_endpoint.json b/src/test/resources/invalid_configs/null_dmaap_dr_delete_endpoint.json new file mode 100644 index 0000000..d86de5e --- /dev/null +++ b/src/test/resources/invalid_configs/null_dmaap_dr_delete_endpoint.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": null, + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_dr_location.json b/src/test/resources/invalid_configs/null_dr_location.json new file mode 100644 index 0000000..79bd05d --- /dev/null +++ b/src/test/resources/invalid_configs/null_dr_location.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": null, + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_dr_password.json b/src/test/resources/invalid_configs/null_dr_password.json new file mode 100644 index 0000000..365b328 --- /dev/null +++ b/src/test/resources/invalid_configs/null_dr_password.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": null, + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_dr_subscriber_id.json b/src/test/resources/invalid_configs/null_dr_subscriber_id.json new file mode 100644 index 0000000..c6c2a45 --- /dev/null +++ b/src/test/resources/invalid_configs/null_dr_subscriber_id.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": null + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_dr_username.json b/src/test/resources/invalid_configs/null_dr_username.json new file mode 100644 index 0000000..511dd35 --- /dev/null +++ b/src/test/resources/invalid_configs/null_dr_username.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": null, + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_filter.json b/src/test/resources/invalid_configs/null_filter.json new file mode 100644 index 0000000..7eb6af0 --- /dev/null +++ b/src/test/resources/invalid_configs/null_filter.json @@ -0,0 +1,35 @@ +{ + "pm-mapper-filter": null, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_filter_array.json b/src/test/resources/invalid_configs/null_filter_array.json new file mode 100644 index 0000000..3d2df14 --- /dev/null +++ b/src/test/resources/invalid_configs/null_filter_array.json @@ -0,0 +1,37 @@ +{ + "pm-mapper-filter": { + "filters": null + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_key_store_pass_path.json b/src/test/resources/invalid_configs/null_key_store_pass_path.json new file mode 100644 index 0000000..2145e01 --- /dev/null +++ b/src/test/resources/invalid_configs/null_key_store_pass_path.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": null, + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_key_store_path.json b/src/test/resources/invalid_configs/null_key_store_path.json new file mode 100644 index 0000000..8f6f831 --- /dev/null +++ b/src/test/resources/invalid_configs/null_key_store_path.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": null, + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_location.json b/src/test/resources/invalid_configs/null_location.json new file mode 100644 index 0000000..b7d9266 --- /dev/null +++ b/src/test/resources/invalid_configs/null_location.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": null, + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_topic_url.json b/src/test/resources/invalid_configs/null_topic_url.json new file mode 100644 index 0000000..faea169 --- /dev/null +++ b/src/test/resources/invalid_configs/null_topic_url.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": null, + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_trust_store_pass_path.json b/src/test/resources/invalid_configs/null_trust_store_pass_path.json new file mode 100644 index 0000000..c98274e --- /dev/null +++ b/src/test/resources/invalid_configs/null_trust_store_pass_path.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": "src/test/resources/testkeystore.jks.b64", + "trust_store_pass_path": null, + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/invalid_configs/null_trust_store_path.json b/src/test/resources/invalid_configs/null_trust_store_path.json new file mode 100644 index 0000000..2673fb9 --- /dev/null +++ b/src/test/resources/invalid_configs/null_trust_store_path.json @@ -0,0 +1,47 @@ +{ + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] + }, + "key_store_path": "src/test/resources/testkeystore.jks.b64", + "key_store_pass_path": "src/test/resources/password", + "trust_store_path": null, + "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", + "enable_http": false, + "streams_publishes": { + "dmaap_publisher": { + "type": "message_router", + "dmaap_info": { + "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM", + "client_role": "org.onap.dcae.pmPublisher", + "location": "san-francisco", + "client_id": "1562763644939" + } + } + }, + "streams_subscribes": { + "dmaap_subscriber": { + "type": "data_router", + "dmaap_info": { + "username": "username", + "password": "password", + "location": "san-francisco", + "delivery_url": "https://dcae-pm-mapper:8443/delivery", + "subscriber_id": 1 + } + } + } +}
\ No newline at end of file diff --git a/src/test/resources/multiple_filter_mapper_config.json b/src/test/resources/multiple_filter_mapper_config.json index 251beb2..72aa1f0 100644 --- a/src/test/resources/multiple_filter_mapper_config.json +++ b/src/test/resources/multiple_filter_mapper_config.json @@ -1,37 +1,33 @@ { - "pm-mapper-filter": {"filters":[{"pmDefVsn": "V8","nfType": "LTE","vendor": "Ericsson","measTypes": [ "A", "B" ]},{"pmDefVsn": "V9","nfType": "NrRadio","vendor": "Ericsson","measTypes": [ "A", "B" ]}]}, - "streams_subscribes": { - "dmaap_subscriber": { - "type": "data_router", - "aaf_username": null, - "aaf_password": null, - "dmaap_info": { - "location": "location", - "delivery_url": "delivery_url", - "username": "username", - "password": "password", - "subscriber_id": "subscriber_id" - } - } - }, - "streams_publishes": { - "dmaap_publisher": { - "type": "message_router", - "aaf_password": null, - "dmaap_info": { - "topic_url": "https://message-router.onap.svc.cluster.local:3904/events/some-topic", - "client_role": null, - "location": null, - "client_id": null + "pm-mapper-filter": { + "filters": [ + { + "pmDefVsn": "V8", + "nfType": "LTE", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] }, - "aaf_username": null - } + { + "pmDefVsn": "V9", + "nfType": "NrRadio", + "vendor": "Ericsson", + "measTypes": [ + "A", + "B" + ] + } + ] }, - "dmaap_dr_delete_endpoint": "http://dmaap-dr-node.onap.svc.cluster.local:8443/delete", - "services_calls": {}, "key_store_path": "src/test/resources/testkeystore.jks.b64", "key_store_pass_path": "src/test/resources/password", "trust_store_path": "src/test/resources/testkeystore.jks.b64", "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", "enable_http": false }
\ No newline at end of file diff --git a/src/test/resources/no_filter_mapper_config.json b/src/test/resources/no_filter_mapper_config.json index 87fc021..0f24f90 100644 --- a/src/test/resources/no_filter_mapper_config.json +++ b/src/test/resources/no_filter_mapper_config.json @@ -1,37 +1,14 @@ { - "pm-mapper-filter": {"filters":[]}, - "streams_subscribes": { - "dmaap_subscriber": { - "type": "data_router", - "aaf_username": null, - "aaf_password": null, - "dmaap_info": { - "location": "location", - "delivery_url": "delivery_url", - "username": "username", - "password": "password", - "subscriber_id": "subscriber_id" - } - } + "pm-mapper-filter": { + "filters": [] }, - "streams_publishes": { - "dmaap_publisher": { - "type": "message_router", - "aaf_password": null, - "dmaap_info": { - "topic_url": "https://message-router.onap.svc.cluster.local:3904/events/some-topic", - "client_role": null, - "location": null, - "client_id": null - }, - "aaf_username": null - } - }, - "dmaap_dr_delete_endpoint": "http://dmaap-dr-node.onap.svc.cluster.local:8443/delete", - "services_calls": {}, "key_store_path": "src/test/resources/testkeystore.jks.b64", "key_store_pass_path": "src/test/resources/password", "trust_store_path": "src/test/resources/testkeystore.jks.b64", "trust_store_pass_path": "src/test/resources/password", + "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete", + "dmaap_dr_feed_name": "bulk_pm_feed", + "aaf_identity": "dcae@dcae.onap.org", + "aaf_password": "iheartrainbows44", "enable_http": false }
\ No newline at end of file diff --git a/src/test/resources/valid_mapper_config.json b/src/test/resources/valid_mapper_config.json index 3d9d707..39d4ee6 100644 --- a/src/test/resources/valid_mapper_config.json +++ b/src/test/resources/valid_mapper_config.json @@ -1,37 +1,47 @@ {
- "pm-mapper-filter": {"filters":[{"pmDefVsn": "V9","nfType": "NrRadio","vendor": "Ericsson","measTypes": [ "A", "B" ]}]},
- "streams_subscribes": {
- "dmaap_subscriber": {
- "type": "data_router",
- "aaf_username": null,
- "aaf_password": null,
- "dmaap_info": {
- "location": "location",
- "delivery_url": "delivery_url",
- "username": "username",
- "password": "password",
- "subscriber_id": "subscriber_id"
- }
- }
- },
- "streams_publishes": {
- "dmaap_publisher": {
- "type": "message_router",
- "aaf_password": null,
- "dmaap_info": {
- "topic_url": "https://message-router.onap.svc.cluster.local:3904/events/some-topic",
- "client_role": null,
- "location": null,
- "client_id": null
- },
- "aaf_username": null
- }
- },
- "dmaap_dr_delete_endpoint": "http://dmaap-dr-node.onap.svc.cluster.local:8443/delete",
- "services_calls": {},
- "key_store_path": "src/test/resources/testkeystore.jks.b64",
- "key_store_pass_path": "src/test/resources/password",
- "trust_store_path": "src/test/resources/testkeystore.jks.b64",
- "trust_store_pass_path": "src/test/resources/password",
- "enable_http": false
+ "pm-mapper-filter": {
+ "filters": [
+ {
+ "pmDefVsn": "V9",
+ "nfType": "NrRadio",
+ "vendor": "Ericsson",
+ "measTypes": [
+ "A",
+ "B"
+ ]
+ }
+ ]
+ },
+ "key_store_path": "src/test/resources/testkeystore.jks.b64",
+ "key_store_pass_path": "src/test/resources/password",
+ "trust_store_path": "src/test/resources/testkeystore.jks.b64",
+ "trust_store_pass_path": "src/test/resources/password",
+ "dmaap_dr_delete_endpoint": "https://dmaap-dr-node:8443/delete",
+ "dmaap_dr_feed_name": "bulk_pm_feed",
+ "aaf_identity": "dcae@dcae.onap.org",
+ "aaf_password": "iheartrainbows44",
+ "enable_http": false,
+ "streams_publishes": {
+ "dmaap_publisher": {
+ "type": "message_router",
+ "dmaap_info": {
+ "topic_url": "https://message-router:3905/events/org.onap.dmaap.mr.VES_PM",
+ "client_role": "org.onap.dcae.pmPublisher",
+ "location": "san-francisco",
+ "client_id": "1562763644939"
+ }
+ }
+ },
+ "streams_subscribes": {
+ "dmaap_subscriber": {
+ "type": "data_router",
+ "dmaap_info": {
+ "username": "username",
+ "password": "password",
+ "location": "san-francisco",
+ "delivery_url": "https://dcae-pm-mapper:8443/delivery",
+ "subscriber_id": 1
+ }
+ }
+ }
}
\ No newline at end of file |