diff options
author | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2018-04-25 11:54:47 +0200 |
---|---|---|
committer | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2018-04-25 11:58:28 +0200 |
commit | 7c73254c00e5dc598f68e074d160b2d263872cda (patch) | |
tree | 06eff647af12b7215c28e05ab681117ca0348a8b /bpmn/MSOInfrastructureBPMN/src/test | |
parent | c7c76f0e6d6aacf6f1b1cd07a42360291fde7e85 (diff) |
PnfReadyEventConsumer implementation
Change-Id: Ic8d5814c555bad436bfcbe1b4e212637a6800947
Issue-ID: SO-466
Signed-off-by: Lukasz Muszkieta <lukasz.muszkieta@nokia.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/test')
-rw-r--r-- | bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java (renamed from bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java) | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java index 73b8247ebc..393730ed43 100644 --- a/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyConsumerTest.java +++ b/bpmn/MSOInfrastructureBPMN/src/test/java/org/openecomp/mso/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java @@ -43,8 +43,9 @@ import org.apache.http.message.BasicHttpResponse; import org.junit.Before; import org.junit.Test; import org.mockito.ArgumentCaptor; +import org.openecomp.mso.bpmn.infrastructure.pnf.dmaap.PnfEventReadyDmaapClient.DmaapTopicListenerThread; -public class PnfEventReadyConsumerTest { +public class PnfEventReadyDmaapClientTest { private static final String CORRELATION_ID = "corrTestId"; private static final String CORRELATION_ID_NOT_FOUND_IN_MAP = "otherCorrId"; @@ -61,14 +62,15 @@ public class PnfEventReadyConsumerTest { private static final String CONSUMER_ID = "consumerTestId"; private static final String CONSUMER_GROUP = "consumerGroupTest"; - private PnfEventReadyConsumer testedObject; + private PnfEventReadyDmaapClient testedObject; + private DmaapTopicListenerThread testedObjectInnerClassThread; private HttpClient httpClientMock; private Runnable threadMockToNotifyCamundaFlow; private ScheduledExecutorService executorMock; @Before public void init() throws NoSuchFieldException, IllegalAccessException { - testedObject = new PnfEventReadyConsumer(); + testedObject = new PnfEventReadyDmaapClient(); testedObject.setDmaapHost(HOST); testedObject.setDmaapPort(PORT); testedObject.setDmaapProtocol(PROTOCOL); @@ -78,6 +80,7 @@ public class PnfEventReadyConsumerTest { testedObject.setConsumerGroup(CONSUMER_GROUP); testedObject.setDmaapClientDelayInSeconds(1); testedObject.init(); + testedObjectInnerClassThread = testedObject.new DmaapTopicListenerThread(); httpClientMock = mock(HttpClient.class); threadMockToNotifyCamundaFlow = mock(Runnable.class); executorMock = mock(ScheduledExecutorService.class); @@ -96,7 +99,7 @@ public class PnfEventReadyConsumerTest { throws IOException { when(httpClientMock.execute(any(HttpGet.class))). thenReturn(createResponse(String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID))); - testedObject.sendRequest(); + testedObjectInnerClassThread.run(); ArgumentCaptor<HttpGet> captor1 = ArgumentCaptor.forClass(HttpGet.class); verify(httpClientMock).execute(captor1.capture()); assertThat(captor1.getValue().getURI()).hasHost(HOST).hasPort(PORT).hasScheme(PROTOCOL) @@ -119,7 +122,7 @@ public class PnfEventReadyConsumerTest { when(httpClientMock.execute(any(HttpGet.class))). thenReturn(createResponse( String.format(JSON_EXAMPLE_WITH_CORRELATION_ID, CORRELATION_ID_NOT_FOUND_IN_MAP))); - testedObject.sendRequest(); + testedObjectInnerClassThread.run(); verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); } @@ -133,7 +136,7 @@ public class PnfEventReadyConsumerTest { public void correlationIdIsNotFoundInHttpResponse() throws IOException { when(httpClientMock.execute(any(HttpGet.class))). thenReturn(createResponse(JSON_EXAMPLE_WITH_NO_CORRELATION_ID)); - testedObject.sendRequest(); + testedObjectInnerClassThread.run(); verifyZeroInteractions(threadMockToNotifyCamundaFlow, executorMock); } |