aboutsummaryrefslogtreecommitdiffstats
path: root/prh-app-server/src
diff options
context:
space:
mode:
Diffstat (limited to 'prh-app-server/src')
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java37
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java147
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java6
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java2
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java (renamed from prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduledXmlContextITest.java)14
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java150
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskSpy.java7
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java1
-rw-r--r--prh-app-server/src/test/resources/prh_endpoints.json38
10 files changed, 398 insertions, 5 deletions
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java
index 9a1fec28..2671669a 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/MainApp.java
@@ -41,7 +41,6 @@ public class MainApp {
SpringApplication.run(MainApp.class, args);
}
-
@Bean
TaskScheduler taskScheduler() {
return new ConcurrentTaskScheduler();
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
new file mode 100644
index 00000000..59cf40da
--- /dev/null
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/AppConfig.java
@@ -0,0 +1,37 @@
+/*
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 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.onap.dcaegen2.services.config.AAIHttpClientConfiguration;
+import org.onap.dcaegen2.services.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.config.DmaapProducerConfiguration;
+
+/**
+ * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/9/18
+ */
+public interface AppConfig {
+
+ DmaapConsumerConfiguration getDmaapConsumerConfiguration() throws Exception;
+
+ AAIHttpClientConfiguration getAAIHttpClientConfiguration() throws Exception;
+
+ DmaapProducerConfiguration getDmaapProducerConfiguration() throws Exception;
+
+}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
new file mode 100644
index 00000000..57335eff
--- /dev/null
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java
@@ -0,0 +1,147 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 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 com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.NullNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.Optional;
+import javax.validation.constraints.NotEmpty;
+import org.onap.dcaegen2.services.config.AAIHttpClientConfiguration;
+import org.onap.dcaegen2.services.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.config.DmaapProducerConfiguration;
+import org.onap.dcaegen2.services.config.ImmutableAAIHttpClientConfiguration;
+import org.onap.dcaegen2.services.config.ImmutableDmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.config.ImmutableDmaapProducerConfiguration;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.EnableConfigurationProperties;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 4/9/18
+ */
+@Configuration
+@EnableConfigurationProperties
+@ConfigurationProperties("app")
+public class PrhAppConfig implements AppConfig {
+
+ private static final String CONFIG = "configs";
+ private static final String AAI = "aai";
+ private static final String DMAAP = "dmaap";
+ private static final String AAI_CONFIG = "aaiHttpClientConfiguration";
+ private static final String DMAAP_PRODUCER = "dmaapProducerConfiguration";
+ private static final String DMAAP_CONSUMER = "dmaapConsumerConfiguration";
+
+ private static final Logger logger = LoggerFactory.getLogger(PrhAppConfig.class);
+ private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
+
+ private ImmutableAAIHttpClientConfiguration immutableAAIHttpClientConfiguration;
+
+ private ImmutableDmaapConsumerConfiguration immutableDmaapConsumerConfiguration;
+
+ private ImmutableDmaapProducerConfiguration immutableDmaapProducerConfiguration;
+
+ @NotEmpty
+ private String filepath;
+
+ public void initFileStreamReader() {
+
+ ObjectMapper jsonObjectMapper = new ObjectMapper().registerModule(new Jdk8Module());
+ JsonNode jsonNode;
+ try (InputStream inputStream = getInputStream(filepath)) {
+ ObjectNode root = (ObjectNode) jsonObjectMapper.readTree(inputStream);
+ jsonNode = Optional.ofNullable(root.get(CONFIG).get(AAI).get(AAI_CONFIG)).orElse(NullNode.getInstance());
+ immutableAAIHttpClientConfiguration = jsonObjectMapper
+ .treeToValue(jsonNode, ImmutableAAIHttpClientConfiguration.class);
+ jsonNode = Optional.ofNullable(root.get(CONFIG).get(DMAAP).get(DMAAP_CONSUMER))
+ .orElse(NullNode.getInstance());
+ immutableDmaapConsumerConfiguration = jsonObjectMapper
+ .treeToValue(jsonNode, ImmutableDmaapConsumerConfiguration.class);
+ jsonNode = Optional.ofNullable(root.get(CONFIG).get(DMAAP).get(DMAAP_PRODUCER))
+ .orElse(NullNode.getInstance());
+ immutableDmaapProducerConfiguration = jsonObjectMapper
+ .treeToValue(jsonNode, ImmutableDmaapProducerConfiguration.class);
+ } catch (FileNotFoundException e) {
+ logger
+ .error(
+ "Configuration PrhAppConfig initFileStreamReader()::FileNotFoundException :: Execution Time - {}:{}",
+ dateTimeFormatter.format(
+ LocalDateTime.now()), e);
+ } catch (JsonParseException e) {
+ logger
+ .error(
+ "Configuration PrhAppConfig initFileStreamReader()::JsonParseException :: Execution Time - {}:{}",
+ dateTimeFormatter.format(
+ LocalDateTime.now()), e);
+ } catch (JsonMappingException e) {
+ logger
+ .error(
+ "Configuration PrhAppConfig initFileStreamReader()::JsonMappingException :: Execution Time - {}:{}",
+ dateTimeFormatter.format(
+ LocalDateTime.now()), e);
+ } catch (IOException e) {
+ logger
+ .error(
+ "Configuration PrhAppConfig initFileStreamReader()::IOException :: Execution Time - {}:{}",
+ dateTimeFormatter.format(
+ LocalDateTime.now()), e);
+ }
+ }
+
+ InputStream getInputStream(String filepath) throws FileNotFoundException {
+ return new BufferedInputStream(new FileInputStream(filepath));
+ }
+
+ String getFilepath() {
+ return this.filepath;
+ }
+
+ public void setFilepath(String filepath) {
+ this.filepath = filepath;
+ }
+
+ @Override
+ public DmaapConsumerConfiguration getDmaapConsumerConfiguration() {
+ return immutableDmaapConsumerConfiguration;
+ }
+
+ @Override
+ public AAIHttpClientConfiguration getAAIHttpClientConfiguration() {
+ return immutableAAIHttpClientConfiguration;
+ }
+
+ @Override
+ public DmaapProducerConfiguration getDmaapProducerConfiguration() {
+ return immutableDmaapProducerConfiguration;
+ }
+} \ No newline at end of file
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
index 812f920c..2dc9b730 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTask.java
@@ -21,8 +21,10 @@ package org.onap.dcaegen2.services.prh.tasks;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
+import org.onap.dcaegen2.services.prh.configuration.AppConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
@@ -35,11 +37,15 @@ public class DmaapConsumerTask implements DmaapTask {
private static final Logger logger = LoggerFactory.getLogger(DmaapConsumerTask.class);
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
+ @Autowired
+ public AppConfig prhAppConfig;
+
@Override
public void execute() {
logger.debug("Start task DmaapConsumerTask::execute() :: Execution Time - {}", dateTimeFormatter.format(
LocalDateTime.now()));
+
logger.debug("End task DmaapConsumerTask::execute() :: Execution Time - {}",
dateTimeFormatter.format(LocalDateTime.now()));
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java
index a8a0f0be..09bd5d8e 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java
@@ -52,7 +52,7 @@ public class ScheduledTask {
dmaapConsumerTask.execute();
} catch (AAINotFoundException e) {
logger
- .warn("Task scheduledTaskAskingDMaaPOfConsumeEvent()::AAINotFoundException :: Execution Time - {}:{}",
+ .error("Task scheduledTaskAskingDMaaPOfConsumeEvent()::AAINotFoundException :: Execution Time - {}:{}",
dateTimeFormatter.format(
LocalDateTime.now()), e);
}
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduledXmlContextITest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java
index ed80a0a1..9cc1793a 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduledXmlContextITest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/IT/ScheduledXmlContextITest.java
@@ -17,9 +17,10 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.onap.dcaegen2.services.prh.tasks;
+package org.onap.dcaegen2.services.prh.IT;
import static org.mockito.Mockito.atLeast;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import java.util.concurrent.Executors;
@@ -28,7 +29,10 @@ import java.util.concurrent.TimeUnit;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.dcaegen2.services.prh.IT.junit5.mockito.MockitoExtension;
+import org.onap.dcaegen2.services.prh.configuration.PrhAppConfig;
+import org.onap.dcaegen2.services.prh.tasks.ScheduledTask;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.test.context.ContextConfiguration;
@@ -63,4 +67,12 @@ class ScheduledXmlContextITest extends AbstractTestNGSpringContextTests {
}
+@Configuration
+class ServiceMockProvider {
+ @Bean
+ public PrhAppConfig getPrhAppConfig() {
+ return mock(PrhAppConfig.class);
+ }
+}
+
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
new file mode 100644
index 00000000..a6361cfe
--- /dev/null
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfigTest.java
@@ -0,0 +1,150 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * PNF-REGISTRATION-HANDLER
+ * ================================================================================
+ * Copyright (C) 2018 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 static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
+import java.io.ByteArrayInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Objects;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.ArgumentMatchers;
+import org.onap.dcaegen2.services.prh.IT.junit5.mockito.MockitoExtension;
+import org.springframework.test.context.junit.jupiter.SpringExtension;
+
+/**
+ * @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 PRH_ENDPOINTS = "prh_endpoints.json";
+ private static final String jsonString = "{\"configs\":{\"aai\":{\"aaiHttpClientConfiguration\":{\"aaiHost\":\"\",\"aaiHostPortNumber\":8080,\"aaiIgnoreSSLCertificateErrors\":true,\"aaiProtocol\":\"https\",\"aaiUserName\":\"admin\",\"aaiUserPassword\":\"admin\"}},\"dmaap\":{\"dmaapConsumerConfiguration\":{\"consumerGroup\":\"other\",\"consumerId\":\"1\",\"dmmapContentType\":\"application/json\",\"dmmapHostName\":\"localhost\",\"dmmapPortNumber\":2222,\"dmmapProtocol\":\"http\",\"dmmapTopicName\":\"temp\",\"dmmapUserName\":\"admin\",\"dmmapUserPassword\":\"admin\",\"messageLimit\":1000,\"timeoutMS\":1000},\"dmaapProducerConfiguration\":{\"dmmapContentType\":\"application/json\",\"dmmapHostName\":\"localhost\",\"dmmapPortNumber\":2223,\"dmmapProtocol\":\"http\",\"dmmapTopicName\":\"temp\",\"dmmapUserName\":\"admin\",\"dmmapUserPassword\":\"admin\"}}}}";
+ private static final String incorrectJsonString = "{\"configs\":{\"aai\":{\"aaiHttpClientConfiguration\":{\"aaiHost\":\"\",\"aaiHostPortNumber\":8080,\"aaiIgnoreSSLCertificateErrors\":true,\"aaiProtocol\":\"https\",\"aaiUserName\":\"admin\",\"aaiUserPassword\":\"admin\"}},\"dmaap\":{\"dmaapConsumerConfiguration\":{\"consumerGroup\":\"other\",\"consumerId\":\"1\",\"dmmapContentType\":\"application/json\",\"dmmapHostName\":\"localhost\",\"dmmapPortNumber\":2222,\"dmmapProtocol\":\"http\",\"dmmapTopicName\":\"temp\",\"dmmapUserName\":\"admin\",\"dmmapUserPassword\":\"admin\",\"messageLimit\":1000,\"timeoutMS\":1000},\"dmaapProducerConfiguration\":{\"dmmapContentType\":\"application/json\",\"dmmapHostName\":\"localhost\",\"dmmapPortNumber\":2223,\"dmmapProtocol\":\"http\",\"dmmaptopicName\":\"temp\",\"dmmapuserName\":\"admin\",\"dmmapuserPassword\":\"admin\"}}}}";
+ private static PrhAppConfig prhAppConfig;
+
+ private static String filePath = Objects
+ .requireNonNull(PrhAppConfigTest.class.getClassLoader().getResource(PRH_ENDPOINTS)).getFile();
+
+ @BeforeEach
+ public void setUp() {
+ prhAppConfig = spy(new PrhAppConfig());
+ }
+
+ @Test
+ public void whenApplicationWasStarted_FilePathIsSet() {
+ //
+ // When
+ //
+ prhAppConfig.setFilepath(filePath);
+ //
+ // Then
+ //
+ verify(prhAppConfig, times(1)).setFilepath(anyString());
+ verify(prhAppConfig, times(0)).initFileStreamReader();
+ Assertions.assertEquals(filePath, prhAppConfig.getFilepath());
+ }
+
+ @Test
+ public void whenTheConfigurationFits_GetAaiAndDmaapObjectRepresentationConfiguration()
+ throws FileNotFoundException {
+ //
+ // Given
+ //
+ InputStream inputStream = new ByteArrayInputStream((jsonString.getBytes(
+ StandardCharsets.UTF_8)));
+ //
+ // When
+ //
+ prhAppConfig.setFilepath(filePath);
+ doReturn(inputStream).when(prhAppConfig).getInputStream(any());
+ prhAppConfig.initFileStreamReader();
+ //
+ // Then
+ //
+ verify(prhAppConfig, times(1)).setFilepath(anyString());
+ verify(prhAppConfig, times(1)).initFileStreamReader();
+ Assertions.assertNotNull(prhAppConfig.getAAIHttpClientConfiguration());
+ Assertions.assertNotNull(prhAppConfig.getDmaapConsumerConfiguration());
+ Assertions.assertNotNull(prhAppConfig.getDmaapProducerConfiguration());
+ }
+
+ @Test
+ public void whenFileIsNotExist_ThrowFileNotFoundExcepton() {
+ //
+ // Given
+ //
+ filePath = "/temp.json";
+ prhAppConfig.setFilepath(filePath);
+ //
+ // When
+ //
+ prhAppConfig.initFileStreamReader();
+ //
+ // Then
+ //
+ verify(prhAppConfig, times(1)).setFilepath(anyString());
+ verify(prhAppConfig, times(1)).initFileStreamReader();
+ Assertions.assertNull(prhAppConfig.getAAIHttpClientConfiguration());
+ Assertions.assertNull(prhAppConfig.getDmaapConsumerConfiguration());
+ Assertions.assertNull(prhAppConfig.getDmaapProducerConfiguration());
+
+ }
+
+ @Test
+ public void whenFileIsExistsButJsonIsIncorrect() throws FileNotFoundException {
+ //
+ // Given
+ //
+ InputStream inputStream = new ByteArrayInputStream((incorrectJsonString.getBytes(
+ StandardCharsets.UTF_8)));
+ //
+ // When
+ //
+ prhAppConfig.setFilepath(filePath);
+ doReturn(inputStream).when(prhAppConfig).getInputStream(any());
+ prhAppConfig.initFileStreamReader();
+ //
+ // Then
+ //
+ verify(prhAppConfig, times(1)).setFilepath(anyString());
+ verify(prhAppConfig, times(1)).initFileStreamReader();
+ Assertions.assertNotNull(prhAppConfig.getAAIHttpClientConfiguration());
+ Assertions.assertNotNull(prhAppConfig.getDmaapConsumerConfiguration());
+ Assertions.assertNull(prhAppConfig.getDmaapProducerConfiguration());
+
+ }
+} \ 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 aa5e052e..1f5b858a 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
@@ -1,4 +1,4 @@
-/*-
+/*
* ============LICENSE_START=======================================================
* PROJECT
* ================================================================================
@@ -20,7 +20,12 @@
package org.onap.dcaegen2.services.prh.tasks;
import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+import org.junit.runners.Parameterized.UseParametersRunnerFactory;
+import org.onap.dcaegen2.services.prh.configuration.AppConfig;
+import org.onap.dcaegen2.services.prh.configuration.PrhAppConfig;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java
index a5581767..d4975098 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduleControllerSpy.java
@@ -40,5 +40,4 @@ public class ScheduleControllerSpy {
public ScheduledTask registerSimpleDmaapConsumerTask() {
return spy(new ScheduledTask(dmaapConsumerTaskSpy));
}
-
}
diff --git a/prh-app-server/src/test/resources/prh_endpoints.json b/prh-app-server/src/test/resources/prh_endpoints.json
new file mode 100644
index 00000000..c3e96d65
--- /dev/null
+++ b/prh-app-server/src/test/resources/prh_endpoints.json
@@ -0,0 +1,38 @@
+{
+ "configs": {
+ "aai": {
+ "aaiHttpClientConfiguration": {
+ "aaiHost": "",
+ "aaiHostPortNumber": 8080,
+ "aaiIgnoreSSLCertificateErrors": true,
+ "aaiProtocol": "https",
+ "aaiUserName": "admin",
+ "aaiUserPassword": "admin"
+ }
+ },
+ "dmaap": {
+ "dmaapConsumerConfiguration": {
+ "consumerGroup": "other",
+ "consumerId": "1",
+ "dmmapContentType": "application/json",
+ "dmmapHostName": "localhost",
+ "dmmapPortNumber": 2222,
+ "dmmapProtocol": "http",
+ "dmmapTopicName": "temp",
+ "dmmapUserName": "admin",
+ "dmmapUserPassword": "admin",
+ "messageLimit": 1000,
+ "timeoutMS": 1000
+ },
+ "dmaapProducerConfiguration": {
+ "dmmapContentType": "application/json",
+ "dmmapHostName": "localhost",
+ "dmmapPortNumber": 2223,
+ "dmmapProtocol": "http",
+ "dmmapTopicName": "temp",
+ "dmmapUserName": "admin",
+ "dmmapUserPassword": "admin"
+ }
+ }
+ }
+} \ No newline at end of file