From 0f0892fbf3105c1dfa695bc380fc525b82fa9d86 Mon Sep 17 00:00:00 2001 From: Joanna Jeremicz Date: Mon, 4 Nov 2019 12:14:22 +0100 Subject: Update PNF in AAI PNF is now updated with parameters from VES event whenever PNF_UPDATE case is executed Issue-ID: DCAEGEN2-1911 Change-Id: I262e4fbf52c92f7a187f3730b40f7f5d689d2dc3 Signed-off-by: Joanna Jeremicz --- .../java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasks.java | 4 +--- .../org/onap/dcaegen2/services/prh/tasks/ScheduledTasksRunner.java | 2 ++ .../org/onap/dcaegen2/services/prh/tasks/ScheduledTasksTest.java | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'prh-app-server/src') 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 74c6c426..0d268003 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 @@ -161,9 +161,7 @@ public class ScheduledTasks { private Mono publishToAaiConfiguration(final State state) { try { - return state.activationStatus - ? Mono.just(state) - : aaiProducerTask + return aaiProducerTask .execute(state.dmaapModel) .map(x -> state); } catch (PrhTaskException e) { diff --git a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksRunner.java b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksRunner.java index 25ed262e..9e432546 100644 --- a/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksRunner.java +++ b/prh-app-server/src/main/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksRunner.java @@ -25,6 +25,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.ScheduledFuture; +import javax.annotation.PreDestroy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.slf4j.Marker; @@ -63,6 +64,7 @@ public class ScheduledTasksRunner { /** * Function which have to stop tasks execution. */ + @PreDestroy public synchronized void cancelTasks() { scheduledPrhTaskFutureList.forEach(x -> x.cancel(false)); scheduledPrhTaskFutureList.clear(); diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksTest.java index cefc5c76..346421ec 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/ScheduledTasksTest.java @@ -139,14 +139,17 @@ class ScheduledTasksTest { @Test void whenPnfHasActiveService_OnlyPostToPnfUpdateShouldBePerformed() throws SSLException, PrhTaskException { //given + Mono consumerModel = Mono.just(DMAAP_MODEL); + given(consumer.execute()).willReturn(Flux.just(DMAAP_MODEL)); given(aaiQuery.execute(any())).willReturn(Mono.just(true)); + given(aaiProducer.execute(DMAAP_MODEL)).willReturn(consumerModel); //when sut.scheduleMainPrhEventTask(); //then - verifyThatPnfUpdateWasNotSentToAai(); + verifyThatPnfUpdateWasSentToAai(); verifyIfLogicalLinkWasNotCreated(); verifyThatPnfModelWasNotSentDmaapPnfReadyTopic(); verifyThatPnfModelWasSentDmaapPnfUpdateTopic(); -- cgit 1.2.3-korg