summaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/test/java
diff options
context:
space:
mode:
authorpwielebs <piotr.wielebski@nokia.com>2019-04-10 14:38:36 +0200
committerpwielebs <piotr.wielebski@nokia.com>2019-04-10 14:58:41 +0200
commit315fbc568d80baa85ad5989b3faae9aa199c3d9c (patch)
tree12268eb5dbf48da3ea7344389fbf7fea25518749 /prh-app-server/src/test/java
parent74d946d67bb3da606ec8e7633f69963ad06cd568 (diff)
use CBS SDK in PRH (II)
-remove unused classes -fix junit tests -use cbs -patch project version updated Change-Id: I5fb63408b33b07632eab579d028070eb3a025865 Issue-ID: DCAEGEN2-1360 Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-app-server/src/test/java')
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java7
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java2
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java104
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java10
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java7
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java21
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java18
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java9
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java8
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java10
10 files changed, 48 insertions, 148 deletions
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java
index b09d039a..9dca398a 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/TestAppConfiguration.java
@@ -28,6 +28,7 @@ import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.Immutabl
public class TestAppConfiguration {
public static ImmutableDmaapConsumerConfiguration createDefaultDmaapConsumerConfiguration() {
return new ImmutableDmaapConsumerConfiguration.Builder()
+ .endpointUrl("http://dmaap-mr:2222/events/unauthenticated.VES_PNFREG_OUTPUT")
.consumerGroup("OpenDCAE-c12")
.consumerId("c12")
.dmaapContentType("application/json")
@@ -49,6 +50,7 @@ public class TestAppConfiguration {
public static ImmutableDmaapPublisherConfiguration createDefaultDmaapPublisherConfiguration() {
return new ImmutableDmaapPublisherConfiguration.Builder()
+ .endpointUrl("http://dmaap-mr:2222/events/unauthenticated.PNF_READY")
.dmaapContentType("application/json")
.dmaapHostName("message-router.onap.svc.cluster.local")
.dmaapPortNumber(3904)
@@ -81,6 +83,11 @@ public class TestAppConfiguration {
.keyStorePath("/opt/app/prh/local/org.onap.prh.p12")
.keyStorePasswordPath("change_it")
.enableAaiCertAuth(false)
+ .putAaiHeaders("X-FromAppId","prh")
+ .putAaiHeaders("X-TransactionId","9999")
+ .putAaiHeaders("Accept","application/json")
+ .putAaiHeaders("Real-Time","true")
+ .putAaiHeaders("Authorization","Basic QUFJOkFBSQ==")
.build();
}
} \ No newline at end of file
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java
index 3c746940..8a2a498f 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/ConsulConfigurationParserTest.java
@@ -47,7 +47,7 @@ class ConsulConfigurationParserTest {
TestAppConfiguration.createDefaultDmaapConsumerConfiguration();
private final ImmutableDmaapPublisherConfiguration correctDmaapPublisherConfig =
TestAppConfiguration.createDefaultDmaapPublisherConfiguration();
- private final ConsulConfigurationParser consulConfigurationParser = new ConsulConfigurationParser(
+ private final CbsContentParser consulConfigurationParser = new CbsContentParser(
new Gson().fromJson(correctJson, JsonObject.class));
ConsulConfigurationParserTest() throws Exception {
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
deleted file mode 100644
index 249fccc3..00000000
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * ============LICENSE_START=======================================================
- * PNF-REGISTRATION-HANDLER
- * ================================================================================
- * Copyright (C) 2018-2019 NOKIA Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.dcaegen2.services.prh.configuration;
-
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.junit.jupiter.api.extension.ExtendWith;
-import org.onap.dcaegen2.services.prh.integration.junit5.mockito.MockitoExtension;
-import org.springframework.core.io.InputStreamResource;
-import org.springframework.core.io.Resource;
-
-import java.io.*;
-import java.nio.file.Paths;
-
-import static java.lang.ClassLoader.getSystemResource;
-import static java.nio.file.Files.readAllBytes;
-import static org.junit.jupiter.api.Assertions.*;
-import static org.mockito.Mockito.*;
-
-/**
- * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/9/18
- */
-@ExtendWith({ MockitoExtension.class })
-class PrhAppConfigTest {
-
- private static final String CORRECT_CONFIG_FILE = "correct_config.json";
- private static final String INCORRECT_CONFIG_FILE = "incorrect_config.json";
- private static final String NOT_JSON_OBJECT_FILE = "not_json_object.json";
- private AppConfig appConfig;
-
- @BeforeEach
- void setUp() {
- appConfig = new AppConfig();
- }
-
- @Test
- void whenTheConfigurationFits() throws Exception {
- InputStream inputStream = createInputStream(CORRECT_CONFIG_FILE);
- appConfig.setPrhEndpoints(new InputStreamResource(inputStream));
- appConfig.initFileStreamReader();
-
- assertNotNull(appConfig.getDmaapConsumerConfiguration());
- assertNotNull(appConfig.getDmaapPublisherConfiguration());
- assertNotNull(appConfig.getAaiClientConfiguration());
- }
-
- @Test
- void whenFileDoesNotExist() throws Exception {
- InputStream inputStream = createInputStream(CORRECT_CONFIG_FILE);
- Resource resource = spy(new InputStreamResource(inputStream));
- when(resource.getInputStream()).thenThrow(new IOException());
- appConfig.setPrhEndpoints(resource);
- appConfig.initFileStreamReader();
-
- assertNull(appConfig.getAaiClientConfiguration());
- assertNull(appConfig.getDmaapConsumerConfiguration());
- assertNull(appConfig.getDmaapPublisherConfiguration());
- }
-
- @Test
- void whenFileExistsButDmaapPublisherJsonConfigurationIsIncorrect() throws Exception {
- InputStream inputStream = createInputStream(INCORRECT_CONFIG_FILE);
- appConfig.setPrhEndpoints(new InputStreamResource(inputStream));
- appConfig.initFileStreamReader();
-
- assertNotNull(appConfig.getAaiClientConfiguration());
- assertNotNull(appConfig.getDmaapConsumerConfiguration());
- assertNull(appConfig.getDmaapPublisherConfiguration());
- }
-
- @Test
- void whenRootElementIsNotAJsonObject() throws Exception {
- InputStream inputStream = createInputStream(NOT_JSON_OBJECT_FILE);
- appConfig.setPrhEndpoints(new InputStreamResource(inputStream));
- appConfig.initFileStreamReader();
-
-
- assertNull(appConfig.getAaiClientConfiguration());
- assertNull(appConfig.getDmaapConsumerConfiguration());
- assertNull(appConfig.getDmaapPublisherConfiguration());
- }
-
- private InputStream createInputStream(String jsonFile) throws Exception {
- return new ByteArrayInputStream(readAllBytes(Paths.get(getSystemResource(jsonFile).toURI())));
- }
-}
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java
index 1160f77e..0077a6a6 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java
@@ -27,7 +27,7 @@ import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
import org.onap.dcaegen2.services.prh.TestAppConfiguration;
-import org.onap.dcaegen2.services.prh.configuration.AppConfig;
+import org.onap.dcaegen2.services.prh.configuration.CbsConfiguration;
import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel;
@@ -51,7 +51,7 @@ class AaiProducerTaskImplTest {
private AaiProducerTaskImpl aaiProducerTask;
private AaiClientConfiguration aaiClientConfiguration;
private AaiHttpPatchClient aaiReactiveHttpPatchClient;
- private AppConfig appConfig;
+ private CbsConfiguration cbsConfiguration;
private HttpResponse clientResponse;
@BeforeEach
@@ -70,14 +70,14 @@ class AaiProducerTaskImplTest {
.swVersion("v4.5.0.1")
.additionalFields(new JsonObject())
.build();
- appConfig = mock(AppConfig.class);
+ cbsConfiguration = mock(CbsConfiguration.class);
}
@Test
void whenPassedObjectDoesntFit_ThrowsPrhTaskException() {
//given/when/
- when(appConfig.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
+ when(cbsConfiguration.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
aaiProducerTask = new AaiProducerTaskImpl(aaiReactiveHttpPatchClient);
Executable executableCode = () -> aaiProducerTask.execute(null);
@@ -117,7 +117,7 @@ class AaiProducerTaskImplTest {
aaiReactiveHttpPatchClient = mock(AaiHttpPatchClient.class);
when(aaiReactiveHttpPatchClient.getAaiResponse(any()))
.thenReturn(clientResponseMono);
- when(appConfig.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
+ when(cbsConfiguration.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
aaiProducerTask = spy(new AaiProducerTaskImpl(aaiReactiveHttpPatchClient));
}
} \ No newline at end of file
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java
index ae770fc6..18e1a27a 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiPublisherTaskSpy.java
@@ -25,7 +25,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import javax.net.ssl.SSLException;
-import org.onap.dcaegen2.services.prh.configuration.AppConfig;
+
+import org.onap.dcaegen2.services.prh.configuration.CbsConfiguration;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.patch.AaiHttpPatchClient;
@@ -49,9 +50,9 @@ public class AaiPublisherTaskSpy {
@Bean
@Primary
public AaiProducerTask registerSimpleAaiPublisherTask() throws SSLException {
- AppConfig appConfig = spy(AppConfig.class);
+ CbsConfiguration cbsConfiguration = spy(CbsConfiguration.class);
ConsumerDmaapModel consumerDmaapModel = spy(ConsumerDmaapModel.class);
- doReturn(mock(AaiClientConfiguration.class)).when(appConfig).getAaiClientConfiguration();
+ doReturn(mock(AaiClientConfiguration.class)).when(cbsConfiguration).getAaiClientConfiguration();
AaiHttpPatchClient aaiReactiveHttpPatchClient = mock(AaiHttpPatchClient.class);
AaiProducerTaskImpl aaiProducerTask = spy(new AaiProducerTaskImpl(aaiReactiveHttpPatchClient));
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java
index 341cb096..5edf15a8 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/BbsActionsTaskTest.java
@@ -40,7 +40,7 @@ import java.io.InputStreamReader;
import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import org.onap.dcaegen2.services.prh.TestAppConfiguration;
-import org.onap.dcaegen2.services.prh.configuration.AppConfig;
+import org.onap.dcaegen2.services.prh.configuration.CbsConfiguration;
import org.onap.dcaegen2.services.prh.exceptions.AaiFailureException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel;
@@ -57,18 +57,19 @@ class BbsActionsTaskTest {
private static final String CORRECT_LOGICAL_LINK_JSON = "bbs_action/correct_logical_link.json";
public static final String AAI_URL = "https://aai.onap.svc.cluster.local:8443/aai/v12/network/logical-links/logical-link/some-link";
+ private CbsConfiguration cbsConfiguration = mock(CbsConfiguration.class);
+
private AaiClientConfiguration aaiClientConfiguration = TestAppConfiguration.createDefaultAaiClientConfiguration();
- private AppConfig appConfig = mock(AppConfig.class);
private RxHttpClient httpClient = mock(RxHttpClient.class);
@Test
void whenPassedObjectDoesntHaveAdditionalFields_ReturnPayloadTransparently() {
// given
- given(appConfig.getAaiClientConfiguration()).willReturn(aaiClientConfiguration);
+ given(cbsConfiguration.getAaiClientConfiguration()).willReturn(aaiClientConfiguration);
ConsumerDmaapModel consumerDmaapModel = buildConsumerDmaapModel(null);
// when
- ConsumerDmaapModel result = new BbsActionsTaskImpl(appConfig, httpClient).execute(consumerDmaapModel).block();
+ ConsumerDmaapModel result = new BbsActionsTaskImpl(cbsConfiguration, httpClient).execute(consumerDmaapModel).block();
// then
verifyZeroInteractions(httpClient);
@@ -78,14 +79,14 @@ class BbsActionsTaskTest {
@Test
void whenPassedObjectHasEmptyLogicalLink_ReturnPayloadTransparently() {
// given
- given(appConfig.getAaiClientConfiguration()).willReturn(aaiClientConfiguration);
+ given(cbsConfiguration.getAaiClientConfiguration()).willReturn(aaiClientConfiguration);
JsonObject additionalFields = new JsonObject();
additionalFields.addProperty("attachmentPoint", "");
ConsumerDmaapModel consumerDmaapModel = buildConsumerDmaapModel(additionalFields);
// when
- ConsumerDmaapModel result = new BbsActionsTaskImpl(appConfig, httpClient).execute(consumerDmaapModel).block();
+ ConsumerDmaapModel result = new BbsActionsTaskImpl(cbsConfiguration, httpClient).execute(consumerDmaapModel).block();
// then
verifyZeroInteractions(httpClient);
@@ -95,7 +96,7 @@ class BbsActionsTaskTest {
@Test
void whenPassedObjectHasLogicalLink_createLogicalLink_and_associateWithPnf_and_ReturnPayloadTransparently() {
// given
- given(appConfig.getAaiClientConfiguration()).willReturn(aaiClientConfiguration);
+ given(cbsConfiguration.getAaiClientConfiguration()).willReturn(aaiClientConfiguration);
JsonObject additionalFields = new JsonObject();
additionalFields.addProperty("attachmentPoint", "some-link");
@@ -104,7 +105,7 @@ class BbsActionsTaskTest {
given(httpClient.call(any())).willReturn(Mono.just(buildAaiResponse(HttpResponseStatus.OK)));
// when
- Mono<ConsumerDmaapModel> response = new BbsActionsTaskImpl(appConfig, httpClient).execute(consumerDmaapModel);
+ Mono<ConsumerDmaapModel> response = new BbsActionsTaskImpl(cbsConfiguration, httpClient).execute(consumerDmaapModel);
// then
assertEquals(consumerDmaapModel, response.block());
@@ -114,7 +115,7 @@ class BbsActionsTaskTest {
@Test
void whenPassedObjectHasLogicalLink_butAaiQueryFails_returnError() {
// given
- given(appConfig.getAaiClientConfiguration()).willReturn(aaiClientConfiguration);
+ given(cbsConfiguration.getAaiClientConfiguration()).willReturn(aaiClientConfiguration);
JsonObject additionalFields = new JsonObject();
additionalFields.addProperty("attachmentPoint", "some-link");
@@ -123,7 +124,7 @@ class BbsActionsTaskTest {
given(httpClient.call(any())).willReturn(Mono.just(buildAaiResponse(HttpResponseStatus.INTERNAL_SERVER_ERROR)));
// when
- Mono<ConsumerDmaapModel> response = new BbsActionsTaskImpl(appConfig, httpClient).execute(consumerDmaapModel);
+ Mono<ConsumerDmaapModel> response = new BbsActionsTaskImpl(cbsConfiguration, httpClient).execute(consumerDmaapModel);
// then
ArgumentCaptor<HttpRequest> captor = ArgumentCaptor.forClass(HttpRequest.class);
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java
index 9b34ef4c..9afa7671 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java
@@ -34,7 +34,7 @@ import com.google.gson.JsonParser;
import java.util.Optional;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.onap.dcaegen2.services.prh.configuration.AppConfig;
+import org.onap.dcaegen2.services.prh.configuration.CbsConfiguration;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.service.DmaapConsumerJsonParser;
@@ -53,13 +53,14 @@ class DmaapConsumerTaskImplTest {
private static ConsumerDmaapModel consumerDmaapModel;
private static DmaapConsumerTaskImpl dmaapConsumerTask;
private static DMaaPConsumerReactiveHttpClient dMaaPConsumerReactiveHttpClient;
- private static AppConfig appConfig;
private static DmaapConsumerConfiguration dmaapConsumerConfiguration;
private static String message;
private static String messageContentEmpty;
private static JsonArray jsonArray;
private static JsonArray jsonArrayWrongContent;
+ private static CbsConfiguration cbsConfiguration;
+
@BeforeAll
static void setUp() {
dmaapConsumerConfiguration = createDefaultDmaapConsumerConfiguration();
@@ -82,7 +83,7 @@ class DmaapConsumerTaskImplTest {
.swVersion("v4.5.0.1")
.additionalFields(jsonObject)
.build();
- appConfig = mock(AppConfig.class);
+ cbsConfiguration = mock(CbsConfiguration.class);
message = "[{\"event\": {"
+ "\"commonEventHeader\": { "
@@ -135,22 +136,15 @@ class DmaapConsumerTaskImplTest {
assertEquals(consumerDmaapModel, response.blockFirst());
}
- @Test
- void whenInitConfigs_initStreamReader() {
- //when
- dmaapConsumerTask.initConfigs();
- //then
- verify(appConfig).initFileStreamReader();
- }
private void prepareMocksForDmaapConsumer(Optional<JsonArray> message) throws Exception {
dMaaPConsumerReactiveHttpClient = mock(DMaaPConsumerReactiveHttpClient.class);
when(dMaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse(Optional.empty()))
.thenReturn(Mono.just(message.get()));
- when(appConfig.getDmaapConsumerConfiguration()).thenReturn(dmaapConsumerConfiguration);
+ when(cbsConfiguration.getDmaapConsumerConfiguration()).thenReturn(dmaapConsumerConfiguration);
ConsumerReactiveHttpClientFactory httpClientFactory = mock(ConsumerReactiveHttpClientFactory.class);
doReturn(dMaaPConsumerReactiveHttpClient).when(httpClientFactory).create(dmaapConsumerConfiguration);
- dmaapConsumerTask = new DmaapConsumerTaskImpl(appConfig, new DmaapConsumerJsonParser(), httpClientFactory);
+ dmaapConsumerTask = new DmaapConsumerTaskImpl(cbsConfiguration, new DmaapConsumerJsonParser(), httpClientFactory);
}
} \ No newline at end of file
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java
index cb31c86b..594575e5 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java
@@ -25,7 +25,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import javax.net.ssl.SSLException;
-import org.onap.dcaegen2.services.prh.configuration.AppConfig;
+
+import org.onap.dcaegen2.services.prh.configuration.CbsConfiguration;
import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapConsumerConfiguration;
import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.consumer.DMaaPConsumerReactiveHttpClient;
import org.springframework.context.annotation.Bean;
@@ -47,9 +48,9 @@ public class DmaapConsumerTaskSpy {
@Bean
@Primary
public DmaapConsumerTask registerSimpleDmaapConsumerTask() throws SSLException {
- AppConfig appConfig = spy(AppConfig.class);
- doReturn(mock(DmaapConsumerConfiguration.class)).when(appConfig).getDmaapConsumerConfiguration();
- DmaapConsumerTaskImpl dmaapConsumerTask = spy(new DmaapConsumerTaskImpl(appConfig));
+ CbsConfiguration cbsConfiguration = spy(CbsConfiguration.class);
+ doReturn(mock(DmaapConsumerConfiguration.class)).when(cbsConfiguration).getDmaapConsumerConfiguration();
+ DmaapConsumerTaskImpl dmaapConsumerTask = spy(new DmaapConsumerTaskImpl(cbsConfiguration));
DMaaPConsumerReactiveHttpClient dmaapConsumerReactiveHttpClient = mock(
DMaaPConsumerReactiveHttpClient.class);
doReturn(dmaapConsumerReactiveHttpClient).when(dmaapConsumerTask).resolveClient();
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java
index 08b10d98..77028a34 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapProducerTaskSpy.java
@@ -25,7 +25,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import javax.net.ssl.SSLException;
-import org.onap.dcaegen2.services.prh.configuration.AppConfig;
+import org.onap.dcaegen2.services.prh.configuration.CbsConfiguration;
import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.producer.DMaaPPublisherReactiveHttpClient;
import org.springframework.context.annotation.Bean;
@@ -48,9 +48,9 @@ public class DmaapProducerTaskSpy {
@Bean
@Primary
public DmaapPublisherTask registerSimpleDmaapPublisherTask() throws SSLException {
- final AppConfig appConfig = spy(AppConfig.class);
- final Supplier<DmaapPublisherConfiguration> configSupplier = () -> appConfig.getDmaapPublisherConfiguration();
- doReturn(mock(DmaapPublisherConfiguration.class)).when(appConfig).getDmaapPublisherConfiguration();
+ final CbsConfiguration cbsConfiguration = spy(CbsConfiguration.class);
+ final Supplier<DmaapPublisherConfiguration> configSupplier = () -> cbsConfiguration.getDmaapPublisherConfiguration();
+ doReturn(mock(DmaapPublisherConfiguration.class)).when(cbsConfiguration).getDmaapPublisherConfiguration();
final DmaapPublisherTaskImpl dmaapPublisherTask = spy(new DmaapPublisherTaskImpl(configSupplier));
final DMaaPPublisherReactiveHttpClient extendedDmaapProducerHttpClient = mock(
DMaaPPublisherReactiveHttpClient.class);
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java
index 6bcf6737..fb4a50ea 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImplTest.java
@@ -24,7 +24,7 @@ import io.netty.handler.codec.http.HttpResponseStatus;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.function.Executable;
-import org.onap.dcaegen2.services.prh.configuration.AppConfig;
+import org.onap.dcaegen2.services.prh.configuration.CbsConfiguration;
import org.onap.dcaegen2.services.prh.exceptions.DmaapNotFoundException;
import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
@@ -54,7 +54,7 @@ class DmaapPublisherTaskImplTest {
private static ConsumerDmaapModel consumerDmaapModel;
private static DmaapPublisherTaskImpl dmaapPublisherTask;
private static DMaaPPublisherReactiveHttpClient dMaaPPublisherReactiveHttpClient;
- private static AppConfig appConfig;
+ private static CbsConfiguration cbsConfiguration;
private static DmaapPublisherConfiguration dmaapPublisherConfiguration;
private Optional<RequestDiagnosticContext> requestDiagnosticContextOptionalMock;
private DmaapModel dmaapModel;
@@ -65,15 +65,15 @@ class DmaapPublisherTaskImplTest {
public void beforeEach() throws SSLException {
dmaapPublisherConfiguration = createDefaultDmaapPublisherConfiguration();
consumerDmaapModel = mock(ConsumerDmaapModel.class);
- appConfig = mock(AppConfig.class);
+ cbsConfiguration = mock(CbsConfiguration.class);
requestDiagnosticContextOptionalMock = Optional.empty();
dmaapModel = mock(DmaapModel.class);
dMaaPPublisherReactiveHttpClient = mock(DMaaPPublisherReactiveHttpClient.class);
publisherReactiveHttpClientFactory = mock(PublisherReactiveHttpClientFactory.class);
- when(appConfig.getDmaapPublisherConfiguration()).thenReturn(dmaapPublisherConfiguration);
+ when(cbsConfiguration.getDmaapPublisherConfiguration()).thenReturn(dmaapPublisherConfiguration);
when(publisherReactiveHttpClientFactory.create(dmaapPublisherConfiguration))
.thenReturn(dMaaPPublisherReactiveHttpClient);
- configSupplier = () -> appConfig.getDmaapPublisherConfiguration();
+ configSupplier = () -> cbsConfiguration.getDmaapPublisherConfiguration();
}
@Test