summaryrefslogtreecommitdiffstats
path: root/prh-app-server
diff options
context:
space:
mode:
Diffstat (limited to 'prh-app-server')
-rw-r--r--prh-app-server/config/application.yaml1
-rw-r--r--prh-app-server/config/prh_endpoints.json4
-rw-r--r--prh-app-server/pom.xml4
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java2
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/PrhAppConfig.java14
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java7
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java1
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java2
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java6
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java10
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java5
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java15
-rw-r--r--prh-app-server/src/main/resources/application.properties4
-rw-r--r--prh-app-server/src/main/resources/logback-spring.xml18
-rw-r--r--prh-app-server/src/main/resources/scheduled-context.xml10
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParserTest.java78
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/junit5/mockito/MockitoExtension.java7
-rw-r--r--prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java23
-rw-r--r--prh-app-server/src/test/resources/logback-test.xml4
-rw-r--r--prh-app-server/src/test/resources/prh_endpoints.json2
20 files changed, 133 insertions, 84 deletions
diff --git a/prh-app-server/config/application.yaml b/prh-app-server/config/application.yaml
index ff53a06c..390ea9d2 100644
--- a/prh-app-server/config/application.yaml
+++ b/prh-app-server/config/application.yaml
@@ -15,6 +15,5 @@ logging:
org.springframework: ERROR
org.springframework.data: ERROR
org.onap.dcaegen2.services.prh: INFO
- file: opt/log/application.log
app:
filepath: config/prh_endpoints.json \ No newline at end of file
diff --git a/prh-app-server/config/prh_endpoints.json b/prh-app-server/config/prh_endpoints.json
index e2dd51a3..e5d1c7b8 100644
--- a/prh-app-server/config/prh_endpoints.json
+++ b/prh-app-server/config/prh_endpoints.json
@@ -35,11 +35,9 @@
"aaiBasePath": "/aai/v12",
"aaiPnfPath": "/network/pnfs/pnf",
"aaiHeaders": {
- "X-FromAppId": "prh",
- "X-TransactionId": "9999",
"Accept": "application/json",
"Real-Time": "true",
- "Content-Type":"application/merge-patch+json"
+ "Content-Type": "application/merge-patch+json"
}
}
}
diff --git a/prh-app-server/pom.xml b/prh-app-server/pom.xml
index ed24fdeb..daaa5acb 100644
--- a/prh-app-server/pom.xml
+++ b/prh-app-server/pom.xml
@@ -18,8 +18,8 @@
~ limitations under the License.
~ ============LICENSE_END=========================================================
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>prh</artifactId>
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
index b774f545..bc4bbf80 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/CloudConfiguration.java
@@ -36,10 +36,10 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;
-
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 8/9/18
*/
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
index ad040f6e..2fb61c06 100644
--- 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
@@ -20,29 +20,30 @@
package org.onap.dcaegen2.services.prh.configuration;
+import static org.onap.dcaegen2.services.prh.model.logging.MDCVariables.INVOCATION_ID;
+import static org.onap.dcaegen2.services.prh.model.logging.MDCVariables.REQUEST_ID;
+
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.JsonSyntaxException;
import com.google.gson.TypeAdapterFactory;
-
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
-
import java.nio.charset.StandardCharsets;
import java.util.ServiceLoader;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
-
import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@@ -140,4 +141,11 @@ public abstract class PrhAppConfig implements Config {
this.filepath = filepath;
}
+ public void setXOnapRequestId(String xOnapRequestId) {
+ MDC.put(REQUEST_ID, xOnapRequestId);
+ }
+
+ public void setXInvocationId(String xInvocationId) {
+ MDC.put(INVOCATION_ID, xInvocationId);
+ }
} \ No newline at end of file
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java
index a27feefb..6132a674 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SchedulerConfig.java
@@ -28,6 +28,10 @@ import java.util.List;
import java.util.concurrent.ScheduledFuture;
import javax.annotation.PostConstruct;
import org.onap.dcaegen2.services.prh.tasks.ScheduledTasks;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
@@ -49,6 +53,8 @@ public class SchedulerConfig {
private static final int SCHEDULING_DELAY_FOR_PRH_TASKS = 5;
private static final int SCHEDULING_REQUEST_FOR_CONFIGURATION_DELAY = 5;
private static volatile List<ScheduledFuture> scheduledPrhTaskFutureList = new ArrayList<>();
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+ private final Marker ENTRY = MarkerFactory.getMarker("ENRTY");
private final ConcurrentTaskScheduler taskScheduler;
private final ScheduledTasks scheduledTask;
@@ -88,6 +94,7 @@ public class SchedulerConfig {
@PostConstruct
@ApiOperation(value = "Start task if possible")
public synchronized boolean tryToStartTask() {
+ logger.info(ENTRY,"Start scheduling PRH workflow");
if (scheduledPrhTaskFutureList.isEmpty()) {
scheduledPrhTaskFutureList.add(cloudTaskScheduler
.scheduleAtFixedRate(cloudConfiguration::runTask, Instant.now(),
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java
index 10bf2755..ecd2ef4c 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/configuration/SwaggerConfig.java
@@ -50,6 +50,7 @@ public class SwaggerConfig extends WebMvcConfigurationSupport {
/**
* Swagger configuration function for hosting it next to spring http website.
+ *
* @return Docket
*/
@Bean
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java
index 0135ef76..573724d8 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/controllers/HeartbeatController.java
@@ -54,7 +54,7 @@ public class HeartbeatController {
@ApiResponse(code = 401, message = "You are not authorized to view the resource"),
@ApiResponse(code = 403, message = "Accessing the resource you were trying to reach is forbidden"),
@ApiResponse(code = 404, message = "The resource you were trying to reach is not found")
- }
+ }
)
public Mono<ResponseEntity<String>> heartbeat() {
logger.trace("Receiving heartbeat request");
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java
index 379d10c6..f5b8307b 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImpl.java
@@ -30,6 +30,8 @@ import org.onap.dcaegen2.services.prh.model.utils.HttpUtils;
import org.onap.dcaegen2.services.prh.service.producer.AaiProducerReactiveHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;
@@ -42,6 +44,8 @@ public class AaiProducerTaskImpl extends
AaiProducerTask {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
+ private final Marker INVOKE = MarkerFactory.getMarker("INVOKE");
+
private final Config config;
private AaiProducerReactiveHttpClient aaiProducerReactiveHttpClient;
@@ -80,7 +84,7 @@ public class AaiProducerTaskImpl extends
throw new DmaapNotFoundException("Invoked null object to DMaaP task");
}
aaiProducerReactiveHttpClient = resolveClient();
- logger.trace("Method called with arg {}", consumerDmaapModel);
+ logger.info(INVOKE, "Method called with arg {}", consumerDmaapModel);
return publish(consumerDmaapModel);
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
index bf3acccc..9e1fadf1 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImpl.java
@@ -20,14 +20,19 @@
package org.onap.dcaegen2.services.prh.tasks;
+import java.util.Map;
import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
import org.onap.dcaegen2.services.prh.configuration.AppConfig;
import org.onap.dcaegen2.services.prh.configuration.Config;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
+import org.onap.dcaegen2.services.prh.model.logging.MDCVariables;
import org.onap.dcaegen2.services.prh.service.DmaapConsumerJsonParser;
import org.onap.dcaegen2.services.prh.service.consumer.DMaaPConsumerReactiveHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;
@@ -39,6 +44,7 @@ import reactor.core.publisher.Mono;
public class DmaapConsumerTaskImpl extends DmaapConsumerTask {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
+ private final Marker INVOKE = MarkerFactory.getMarker("INVOKE");
private final Config config;
private DmaapConsumerJsonParser dmaapConsumerJsonParser;
private DMaaPConsumerReactiveHttpClient dmaaPConsumerReactiveHttpClient;
@@ -62,8 +68,8 @@ public class DmaapConsumerTaskImpl extends DmaapConsumerTask {
@Override
public Mono<ConsumerDmaapModel> execute(String object) {
dmaaPConsumerReactiveHttpClient = resolveClient();
- logger.trace("Method called with arg {}", object);
- return consume((dmaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse()));
+ logger.info(INVOKE, "Method called with arg {}", object);
+ return consume(dmaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse());
}
@Override
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java
index d4e1c1e3..73260381 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/DmaapPublisherTaskImpl.java
@@ -27,6 +27,8 @@ import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
import org.onap.dcaegen2.services.prh.service.producer.DMaaPProducerReactiveHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;
@@ -38,6 +40,7 @@ import reactor.core.publisher.Mono;
public class DmaapPublisherTaskImpl extends DmaapPublisherTask {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
+ private final Marker INVOKE = MarkerFactory.getMarker("INVOKE");
private final Config config;
private DMaaPProducerReactiveHttpClient dmaapProducerReactiveHttpClient;
@@ -61,7 +64,7 @@ public class DmaapPublisherTaskImpl extends DmaapPublisherTask {
throw new DmaapNotFoundException("Invoked null object to DMaaP task");
}
dmaapProducerReactiveHttpClient = resolveClient();
- logger.trace("Method called with arg {}", consumerDmaapModel);
+ logger.info(INVOKE, "Method called with arg {}", consumerDmaapModel);
return publish(consumerDmaapModel);
}
diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
index c021abe2..6432a338 100644
--- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
+++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java
@@ -20,12 +20,21 @@
package org.onap.dcaegen2.services.prh.tasks;
+import static org.onap.dcaegen2.services.prh.model.logging.MDCVariables.INSTANCE_UUID;
+import static org.onap.dcaegen2.services.prh.model.logging.MDCVariables.RESPONSE_CODE;
+
+import java.util.Map;
+import java.util.UUID;
import java.util.concurrent.Callable;
import org.onap.dcaegen2.services.prh.exceptions.DmaapEmptyResponseException;
import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException;
import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel;
+import org.onap.dcaegen2.services.prh.model.logging.MDCVariables;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import reactor.core.publisher.Mono;
@@ -38,10 +47,10 @@ import reactor.core.scheduler.Schedulers;
public class ScheduledTasks {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
-
private final DmaapConsumerTask dmaapConsumerTask;
private final DmaapPublisherTask dmaapProducerTask;
private final AaiProducerTask aaiProducerTask;
+ private Map<String, String> contextMap = MDC.getCopyOfContextMap();
/**
* Constructor for tasks registration in PRHWorkflow.
@@ -62,6 +71,7 @@ public class ScheduledTasks {
* Main function for scheduling prhWorkflow.
*/
public void scheduleMainPrhEventTask() {
+ MDCVariables.setMdcContextMap(contextMap);
logger.trace("Execution of tasks was registered");
Mono<String> dmaapProducerResponse = Mono.fromCallable(consumeFromDMaaPMessage())
@@ -78,6 +88,7 @@ public class ScheduledTasks {
}
private void onSuccess(String responseCode) {
+ MDC.put(RESPONSE_CODE, responseCode);
logger.info("Prh consumed tasks. HTTP Response code {}", responseCode);
}
@@ -89,6 +100,8 @@ public class ScheduledTasks {
private Callable<Mono<ConsumerDmaapModel>> consumeFromDMaaPMessage() {
return () -> {
+ MDCVariables.setMdcContextMap(contextMap);
+ MDC.put(INSTANCE_UUID, UUID.randomUUID().toString());
dmaapConsumerTask.initConfigs();
return dmaapConsumerTask.execute("");
};
diff --git a/prh-app-server/src/main/resources/application.properties b/prh-app-server/src/main/resources/application.properties
index fa38d188..ac0192ca 100644
--- a/prh-app-server/src/main/resources/application.properties
+++ b/prh-app-server/src/main/resources/application.properties
@@ -9,4 +9,6 @@ logging.level.root=ERROR
logging.level.org.springframework=ERROR
logging.level.org.springframework.data=ERROR
logging.level.org.onap.dcaegen2.services.prh=INFO
-app.filepath=config/prh_endpoints.json \ No newline at end of file
+app.filepath=config/prh_endpoints.json
+app.xonaprequestid=requestID
+app.xinvocationid=invocationID
diff --git a/prh-app-server/src/main/resources/logback-spring.xml b/prh-app-server/src/main/resources/logback-spring.xml
index 74c386b6..427373fd 100644
--- a/prh-app-server/src/main/resources/logback-spring.xml
+++ b/prh-app-server/src/main/resources/logback-spring.xml
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include resource="org/springframework/boot/logging/logback/defaults.xml"/>
- <property name="LOG_FILE" value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}"/>
+ <property name="LOG_FILE"
+ value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}"/>
<property name="FILE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN}"/>
<Property name="outputFilename" value="prh-app-server_output"/>
<Property name="log-path" value="/var/log/ONAP/prh/prh-app-server"/>
@@ -11,7 +12,7 @@
<property name="totalSizeCap" value="10GB"/>
<springProfile name="dev">
- <appender name="CONSOLE" target="SYSTEM_OUT" class="ch.qos.logback.core.ConsoleAppender">
+ <appender class="ch.qos.logback.core.ConsoleAppender" name="CONSOLE" target="SYSTEM_OUT">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%nopexception%logger
|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}
@@ -21,10 +22,11 @@
|%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}
|%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}
|%thread
- |%n</Pattern>
+ |%n
+ </Pattern>
</encoder>
</appender>
- <appender name="ROLLING-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="ROLLING-FILE">
<encoder>
<pattern>%nopexception%logger
|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}
@@ -34,7 +36,8 @@
|%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}
|%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}
|%thread
- |%n</pattern>
+ |%n
+ </pattern>
</encoder>
<file>${LOG_FILE}</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
@@ -51,7 +54,7 @@
</springProfile>
<springProfile name="prod">
- <appender name="ROLLING-FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="ROLLING-FILE">
<encoder>
<pattern>%nopexception%logger
|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}
@@ -61,7 +64,8 @@
|%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}
|%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}
|%thread
- |%n</pattern>
+ |%n
+ </pattern>
</encoder>
<File>${log-path}/${outputFilename}.log</File>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
diff --git a/prh-app-server/src/main/resources/scheduled-context.xml b/prh-app-server/src/main/resources/scheduled-context.xml
index 91919aa2..82067c17 100644
--- a/prh-app-server/src/main/resources/scheduled-context.xml
+++ b/prh-app-server/src/main/resources/scheduled-context.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<beans xmlns:context="http://www.springframework.org/schema/context"
xmlns:task="http://www.springframework.org/schema/task"
- xmlns:context="http://www.springframework.org/schema/context"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">
@@ -10,7 +10,7 @@
<context:component-scan
base-package="org.onap.dcaegen2.services.prh"/>
<task:scheduled-tasks>
- <task:scheduled ref="scheduleController" method="startTasks"
- fixed-rate="1000"/>
+ <task:scheduled fixed-rate="1000" method="startTasks"
+ ref="scheduleController"/>
</task:scheduled-tasks>
</beans>
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParserTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParserTest.java
index 6d74771d..dd0a3dbd 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParserTest.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/configuration/CloudConfigParserTest.java
@@ -20,12 +20,17 @@
package org.onap.dcaegen2.services.prh.configuration;
+import static org.assertj.core.api.Assertions.assertThat;
+
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import org.junit.jupiter.api.Test;
-import org.onap.dcaegen2.services.prh.config.*;
-
-import static org.assertj.core.api.Assertions.assertThat;
+import org.onap.dcaegen2.services.prh.config.AaiClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
+import org.onap.dcaegen2.services.prh.config.ImmutableAaiClientConfiguration;
+import org.onap.dcaegen2.services.prh.config.ImmutableDmaapConsumerConfiguration;
+import org.onap.dcaegen2.services.prh.config.ImmutableDmaapPublisherConfiguration;
public class CloudConfigParserTest {
@@ -58,47 +63,48 @@ public class CloudConfigParserTest {
private static final ImmutableAaiClientConfiguration correctAaiClientConfig =
new ImmutableAaiClientConfiguration.Builder()
- .aaiHost("aai.onap.svc.cluster.local")
- .aaiPort(8443)
- .aaiUserName("AAI")
- .aaiPnfPath("/network/pnfs/pnf")
- .aaiIgnoreSslCertificateErrors(true)
- .aaiUserPassword("AAI")
- .aaiProtocol("https")
- .aaiBasePath("/aai/v12")
- .build();
+ .aaiHost("aai.onap.svc.cluster.local")
+ .aaiPort(8443)
+ .aaiUserName("AAI")
+ .aaiPnfPath("/network/pnfs/pnf")
+ .aaiIgnoreSslCertificateErrors(true)
+ .aaiUserPassword("AAI")
+ .aaiProtocol("https")
+ .aaiBasePath("/aai/v12")
+ .build();
private static final ImmutableDmaapConsumerConfiguration correctDmaapConsumerConfig =
new ImmutableDmaapConsumerConfiguration.Builder()
- .timeoutMs(-1)
- .dmaapHostName("message-router.onap.svc.cluster.local")
- .dmaapUserName("admin")
- .dmaapUserPassword("admin")
- .dmaapTopicName("/events/unauthenticated.SEC_OTHER_OUTPUT")
- .dmaapPortNumber(3904)
- .dmaapContentType("application/json")
- .messageLimit(-1)
- .dmaapProtocol("http")
- .consumerId("c12")
- .consumerGroup("OpenDCAE-c12")
- .build();
+ .timeoutMs(-1)
+ .dmaapHostName("message-router.onap.svc.cluster.local")
+ .dmaapUserName("admin")
+ .dmaapUserPassword("admin")
+ .dmaapTopicName("/events/unauthenticated.SEC_OTHER_OUTPUT")
+ .dmaapPortNumber(3904)
+ .dmaapContentType("application/json")
+ .messageLimit(-1)
+ .dmaapProtocol("http")
+ .consumerId("c12")
+ .consumerGroup("OpenDCAE-c12")
+ .build();
private static final ImmutableDmaapPublisherConfiguration correctDmaapPublisherConfig =
new ImmutableDmaapPublisherConfiguration.Builder()
- .dmaapTopicName("/events/unauthenticated.PNF_READY")
- .dmaapUserPassword("admin")
- .dmaapPortNumber(3904)
- .dmaapProtocol("http")
- .dmaapContentType("application/json")
- .dmaapHostName("message-router.onap.svc.cluster.local")
- .dmaapUserName("admin")
- .build();
+ .dmaapTopicName("/events/unauthenticated.PNF_READY")
+ .dmaapUserPassword("admin")
+ .dmaapPortNumber(3904)
+ .dmaapProtocol("http")
+ .dmaapContentType("application/json")
+ .dmaapHostName("message-router.onap.svc.cluster.local")
+ .dmaapUserName("admin")
+ .build();
- private CloudConfigParser cloudConfigParser = new CloudConfigParser(new Gson().fromJson(correctJson, JsonObject.class));
+ private CloudConfigParser cloudConfigParser = new CloudConfigParser(
+ new Gson().fromJson(correctJson, JsonObject.class));
@Test
- public void shouldCreateAaiConfigurationCorrectly(){
+ public void shouldCreateAaiConfigurationCorrectly() {
// when
AaiClientConfiguration aaiClientConfig = cloudConfigParser.getAaiClientConfig();
@@ -109,7 +115,7 @@ public class CloudConfigParserTest {
@Test
- public void shouldCreateDmaapConsumerConfigurationCorrectly(){
+ public void shouldCreateDmaapConsumerConfigurationCorrectly() {
// when
DmaapConsumerConfiguration dmaapConsumerConfig = cloudConfigParser.getDmaapConsumerConfig();
@@ -120,7 +126,7 @@ public class CloudConfigParserTest {
@Test
- public void shouldCreateDmaapPublisherConfigurationCorrectly(){
+ public void shouldCreateDmaapPublisherConfigurationCorrectly() {
// when
DmaapPublisherConfiguration dmaapPublisherConfig = cloudConfigParser.getDmaapPublisherConfig();
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/junit5/mockito/MockitoExtension.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/junit5/mockito/MockitoExtension.java
index 5c19186b..9835e9ed 100644
--- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/junit5/mockito/MockitoExtension.java
+++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/integration/junit5/mockito/MockitoExtension.java
@@ -23,7 +23,6 @@ package org.onap.dcaegen2.services.prh.integration.junit5.mockito;
import static org.mockito.Mockito.mock;
import java.lang.reflect.Parameter;
-
import org.junit.jupiter.api.extension.ExtensionContext;
import org.junit.jupiter.api.extension.ExtensionContext.Namespace;
import org.junit.jupiter.api.extension.ExtensionContext.Store;
@@ -36,9 +35,9 @@ import org.mockito.MockitoAnnotations;
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 3/27/18
*
- * {@code MockitoExtension } showcases the {@link TestInstancePostProcessor} and {@link ParameterResolver} extension
- * APIs of JUnit 5 by providing dependency injection support at the field level and at the method parameter level
- * viaMockito 2.x's {@link Mock @Mock} annotation.
+ * {@code MockitoExtension } showcases the {@link TestInstancePostProcessor} and {@link ParameterResolver} extension
+ * APIs of JUnit 5 by providing dependency injection support at the field level and at the method parameter level
+ * viaMockito 2.x's {@link Mock @Mock} annotation.
*/
public class MockitoExtension implements TestInstancePostProcessor, ParameterResolver {
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 4589341e..54259397 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
@@ -81,6 +81,17 @@ class AaiProducerTaskImplTest {
}
+ private static void getAaiProducerTask_whenMockingResponseObject(Integer statusCode) {
+ //given
+ aaiProducerReactiveHttpClient = mock(AaiProducerReactiveHttpClient.class);
+ when(aaiProducerReactiveHttpClient.getAaiProducerResponse(any()))
+ .thenReturn(Mono.just(statusCode));
+ when(appConfig.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
+ aaiProducerTask = spy(new AaiProducerTaskImpl(appConfig));
+ when(aaiProducerTask.resolveConfiguration()).thenReturn(aaiClientConfiguration);
+ doReturn(aaiProducerReactiveHttpClient).when(aaiProducerTask).resolveClient();
+ }
+
@Test
void whenPassedObjectDoesntFit_ThrowsPrhTaskException() {
//given/when/
@@ -106,7 +117,6 @@ class AaiProducerTaskImplTest {
}
-
@Test
void whenPassedObjectFits_butIncorrectResponseReturns() throws PrhTaskException {
//given/when
@@ -117,15 +127,4 @@ class AaiProducerTaskImplTest {
verify(aaiProducerReactiveHttpClient, times(1)).getAaiProducerResponse(any());
verifyNoMoreInteractions(aaiProducerReactiveHttpClient);
}
-
- private static void getAaiProducerTask_whenMockingResponseObject(Integer statusCode) {
- //given
- aaiProducerReactiveHttpClient = mock(AaiProducerReactiveHttpClient.class);
- when(aaiProducerReactiveHttpClient.getAaiProducerResponse(any()))
- .thenReturn(Mono.just(statusCode));
- when(appConfig.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration);
- aaiProducerTask = spy(new AaiProducerTaskImpl(appConfig));
- when(aaiProducerTask.resolveConfiguration()).thenReturn(aaiClientConfiguration);
- doReturn(aaiProducerReactiveHttpClient).when(aaiProducerTask).resolveClient();
- }
} \ No newline at end of file
diff --git a/prh-app-server/src/test/resources/logback-test.xml b/prh-app-server/src/test/resources/logback-test.xml
index 0a53315a..9c161fe3 100644
--- a/prh-app-server/src/test/resources/logback-test.xml
+++ b/prh-app-server/src/test/resources/logback-test.xml
@@ -18,8 +18,8 @@
-->
<configuration debug="false">
<include resource="org/springframework/boot/logging/logback/base.xml"/>
- <logger name="org.onap.dcaegen2.services.prh" level="DEBUG"/>
- <appender name="Console" class="ch.qos.logback.core.ConsoleAppender">
+ <logger level="DEBUG" name="org.onap.dcaegen2.services.prh"/>
+ <appender class="ch.qos.logback.core.ConsoleAppender" name="Console">
<encoder>
<pattern>%d{ISO8601} - %-5p [%t:%C{1}@%L] - %m%n</pattern>
</encoder>
diff --git a/prh-app-server/src/test/resources/prh_endpoints.json b/prh-app-server/src/test/resources/prh_endpoints.json
index e088e2ae..07e87c67 100644
--- a/prh-app-server/src/test/resources/prh_endpoints.json
+++ b/prh-app-server/src/test/resources/prh_endpoints.json
@@ -15,7 +15,7 @@
"X-TransactionId": "9999",
"Accept": "application/json",
"Real-Time": "true",
- "Content-Type":"application/merge-patch+json"
+ "Content-Type": "application/merge-patch+json"
}
}
},