summaryrefslogtreecommitdiffstats
path: root/prh-app-server/src/main
diff options
context:
space:
mode:
authorwasala <przemyslaw.wasala@nokia.com>2018-03-27 13:02:10 +0200
committerwasala <przemyslaw.wasala@nokia.com>2018-03-28 13:52:17 +0200
commit961af3e21239edd4714e7e586ed5db902bd85d53 (patch)
treed28687a6ca73199be3a7687b389ea34415193a84 /prh-app-server/src/main
parentb80bcb81356fc9953e85196d8cbf6ada2ebbc143 (diff)
Added U&IT tests in prh module
We have already added tests in our Module. In addition some dependencies were added too. Clean up in pom.xml files Change-Id: I4217d585293f48f2f00870d147807bb1d5b2b33f Issue-ID: DCAEGEN2-407 Signed-off-by: wasala <przemyslaw.wasala@nokia.com>
Diffstat (limited to 'prh-app-server/src/main')
-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/tasks/DmaapConsumerTask.java15
-rw-r--r--prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTask.java9
-rw-r--r--prh-app-server/src/main/resources/scheduled-context.xml16
4 files changed, 35 insertions, 6 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 ebdf1bb4..b66af993 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
@@ -33,7 +33,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@ComponentScan
@EnableScheduling
public class MainApp {
-
public static void main(String[] args) {
SpringApplication.run(MainApp.class, args);
}
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 0d7ec225..91ed6024 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
@@ -39,7 +39,20 @@ public class DmaapConsumerTask implements DmaapTask {
logger.info("Start task DmaapConsumerTask::execute() :: Execution Time - {}", dateTimeFormatter.format(
LocalDateTime.now()));
//TODO: ADD implementation for executing request to consume topic from dmaap
-
+ //DmappConsumerRunner dmappConsumerRunner = consumer.play()
+ //if(dmappConsumerRunner != null){
+ //AAIProcess aaiProcess = new AAiPRocess(dmappConsumerRunner)
+ /*
+ try{
+ aaiProcess.Execute()
+ }
+ catch(Exception e(){
+ Log
+ return
+ }
+ DmaapConsumerPost post;
+ */
+ //}
logger.info("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 006d44ea..5ed3c8c0 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
@@ -34,25 +34,26 @@ import org.springframework.stereotype.Component;
@Component
public class ScheduledTask {
- private static final int FIXED_DELAY = 1000;
+ private static final int SCHEDULING_DELAY = 1000;
private static final Logger logger = LoggerFactory.getLogger(ScheduledTask.class);
private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
private final DmaapTask dmaapConsumerTask;
@Autowired
- public ScheduledTask(DmaapConsumerTask dmaapConsumerTask) {
+ public ScheduledTask(DmaapTask dmaapConsumerTask) {
this.dmaapConsumerTask = dmaapConsumerTask;
}
- @Scheduled(fixedDelay = FIXED_DELAY)
+ @Scheduled(fixedDelay = SCHEDULING_DELAY)
public void scheduledTaskAskingDMaaPOfConsumeEvent() {
logger.info("Task scheduledTaskAskingDMaaPOfConsumeEvent() :: Execution Time - {}", dateTimeFormatter.format(
LocalDateTime.now()));
try {
dmaapConsumerTask.execute();
- } catch (AAINotFoundException e) {
+
+ } catch (AAINotFoundException | RuntimeException e) {
logger.warn("Task scheduledTaskAskingDMaaPOfConsumeEvent()::AAINotFoundException :: Execution Time - {}:{}",
dateTimeFormatter.format(
LocalDateTime.now()), e.getMessage());
diff --git a/prh-app-server/src/main/resources/scheduled-context.xml b/prh-app-server/src/main/resources/scheduled-context.xml
new file mode 100644
index 00000000..1c60df8b
--- /dev/null
+++ b/prh-app-server/src/main/resources/scheduled-context.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:task="http://www.springframework.org/schema/task"
+ xmlns:context="http://www.springframework.org/schema/context"
+ 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">
+
+ <context:component-scan
+ base-package="org.onap.dcaegen2.services.prh"/>
+ <task:scheduled-tasks>
+ <task:scheduled ref="scheduledTask" method="scheduledTaskAskingDMaaPOfConsumeEvent"
+ fixed-rate="1000"/>
+ </task:scheduled-tasks>
+</beans>