diff options
author | grabinsk <maciej.grabinski@nokia.com> | 2019-05-23 14:25:24 +0200 |
---|---|---|
committer | grabinsk <maciej.grabinski@nokia.com> | 2019-05-23 14:25:24 +0200 |
commit | 14433b1454dd4b881b8b36f184d63528a43931ba (patch) | |
tree | 1b37d5de5dee6d701f43165ca4e35232c47a0129 /prh-app-server/src/test/java | |
parent | e2f12ecdee8f9320e23b95a1671cb7c8fcacf361 (diff) |
Fix sending PNF_READY notification after update to El Alto SDK version usage
Change-Id: I06c1ae2b2a9831a4c31e09fafbe1500c10714caa
Issue-ID: DCAEGEN2-1501
Signed-off-by: grabinsk <maciej.grabinski@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/tasks/DmaapPublisherTaskImplTest.java | 29 |
1 files changed, 14 insertions, 15 deletions
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 6347ad3d..6f38d87d 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 @@ -20,7 +20,8 @@ package org.onap.dcaegen2.services.prh.tasks; -import com.google.gson.JsonPrimitive; +import com.google.gson.JsonElement; +import com.google.gson.JsonParser; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -38,10 +39,8 @@ import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.api.MessageRout import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.ImmutableMessageRouterPublishRequest; import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.model.MessageRouterPublishRequest; import reactor.core.publisher.Flux; +import reactor.test.StepVerifier; -import java.util.function.Supplier; - -import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.verify; @@ -53,30 +52,27 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) class DmaapPublisherTaskImplTest { - private static DmaapPublisherTaskImpl dmaapPublisherTask; + private DmaapPublisherTaskImpl dmaapPublisherTask; + + private MessageRouterPublishRequest mrRequest = createMRRequest(); @Mock private static MessageRouterPublisherResolver messageRouterPublisherClientResolver; @Mock private static MessageRouterPublisher messageRouterPublisher; - private Supplier<MessageRouterPublishRequest> configSupplier; - - @Captor - private ArgumentCaptor<Flux<JsonPrimitive>> fluxCaptor; + private ArgumentCaptor<Flux<JsonElement>> fluxCaptor; @BeforeEach void beforeEach() { when(messageRouterPublisherClientResolver.resolveClient()).thenReturn(messageRouterPublisher); - MessageRouterPublishRequest mrRequest = createMRRequest(); - configSupplier = () -> mrRequest; } @Test void execute_whenPassedObjectDoesntFit_ThrowsPrhTaskException() { //given - dmaapPublisherTask = new DmaapPublisherTaskImpl(configSupplier, messageRouterPublisherClientResolver); + dmaapPublisherTask = new DmaapPublisherTaskImpl(() -> mrRequest, messageRouterPublisherClientResolver); //when Executable executableFunction = () -> dmaapPublisherTask.execute(null); //then @@ -86,12 +82,15 @@ class DmaapPublisherTaskImplTest { @Test void execute_whenPassedObjectFits_ReturnsCorrectStatus() throws DmaapNotFoundException { //given - dmaapPublisherTask = new DmaapPublisherTaskImpl(configSupplier, messageRouterPublisherClientResolver); + dmaapPublisherTask = new DmaapPublisherTaskImpl(() -> mrRequest, messageRouterPublisherClientResolver); //when dmaapPublisherTask.execute(createConsumerDmaapModel()); //then - verify(messageRouterPublisher).put(eq(configSupplier.get()), fluxCaptor.capture()); - assertEquals(new JsonPrimitive("{\"correlationId\":\"NOKQTFCOC540002E\"}"), fluxCaptor.getValue().blockFirst()); + verify(messageRouterPublisher).put(eq(mrRequest), fluxCaptor.capture()); + + StepVerifier.create(fluxCaptor.getValue()) + .expectNext(new JsonParser().parse("{\"correlationId\":\"NOKQTFCOC540002E\"}")) + .verifyComplete(); } |