diff options
author | pwielebs <piotr.wielebski@nokia.com> | 2019-03-07 10:47:59 +0100 |
---|---|---|
committer | Marcin Migdal <marcin.migdal@nokia.com> | 2019-03-20 11:59:16 +0100 |
commit | 295746ec486e0300e7d5958ba44f8054c30389f4 (patch) | |
tree | 3b43650f5878d00af3193a82d8394b1e0fcac1c0 /prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java | |
parent | d824f1434f7ea71f1efdf3e9a667f6724ae600d3 (diff) |
Integrate PRH with SDK in version 1.1.4
- AAI client aligned
- CBS client aligned
- DmaaP client aligned
Change-Id: I7afd0a44572e1097be5c3a4acc7221c7923cea8b
Issue-ID: DCAEGEN2-1319
Signed-off-by: pwielebs <piotr.wielebski@nokia.com>
Diffstat (limited to 'prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java')
-rw-r--r-- | prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/AaiProducerTaskImplTest.java | 30 |
1 files changed, 15 insertions, 15 deletions
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 d99d4f57..419e9144 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 @@ -43,10 +43,10 @@ import org.onap.dcaegen2.services.prh.exceptions.PrhTaskException; import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel; import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel; import org.onap.dcaegen2.services.sdk.rest.services.aai.client.config.AaiClientConfiguration; -import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.patch.AaiReactiveHttpPatchClient; +import org.onap.dcaegen2.services.sdk.rest.services.aai.client.service.http.patch.AaiHttpPatchClient; -import org.springframework.http.HttpStatus; -import org.springframework.web.reactive.function.client.ClientResponse; +import reactor.netty.http.client.HttpClientResponse; +import io.netty.handler.codec.http.HttpResponseStatus; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; @@ -58,13 +58,13 @@ class AaiProducerTaskImplTest { private ConsumerDmaapModel consumerDmaapModel; private AaiProducerTaskImpl aaiProducerTask; private AaiClientConfiguration aaiClientConfiguration; - private AaiReactiveHttpPatchClient aaiReactiveHttpPatchClient; + private AaiHttpPatchClient aaiReactiveHttpPatchClient; private AppConfig appConfig; - private ClientResponse clientResponse; + private HttpClientResponse clientResponse; @BeforeEach void setUp() { - clientResponse = mock(ClientResponse.class); + clientResponse = mock(HttpClientResponse.class); aaiClientConfiguration = TestAppConfiguration.createDefaultAaiClientConfiguration(); consumerDmaapModel = ImmutableConsumerDmaapModel.builder() .ipv4("10.16.123.234") @@ -97,11 +97,11 @@ class AaiProducerTaskImplTest { @Test void whenPassedObjectFits_ReturnsCorrectStatus() throws PrhTaskException, SSLException { //given/when - getAaiProducerTask_whenMockingResponseObject(200); + getAaiProducerTask_whenMockingResponseObject(HttpResponseStatus.OK); Mono<ConsumerDmaapModel> response = aaiProducerTask.execute(consumerDmaapModel); //then - verify(aaiReactiveHttpPatchClient, times(1)).getAaiProducerResponse(any()); + verify(aaiReactiveHttpPatchClient, times(1)).getAaiResponse(any()); verifyNoMoreInteractions(aaiReactiveHttpPatchClient); Assertions.assertEquals(consumerDmaapModel, response.block()); @@ -110,20 +110,20 @@ class AaiProducerTaskImplTest { @Test void whenPassedObjectFits_butIncorrectResponseReturns() throws PrhTaskException, SSLException { //given/when - getAaiProducerTask_whenMockingResponseObject(400); + getAaiProducerTask_whenMockingResponseObject(HttpResponseStatus.BAD_REQUEST); StepVerifier.create(aaiProducerTask.execute(consumerDmaapModel)).expectSubscription() .expectError(PrhTaskException.class).verify(); //then - verify(aaiReactiveHttpPatchClient, times(1)).getAaiProducerResponse(any()); + verify(aaiReactiveHttpPatchClient, times(1)).getAaiResponse(any()); verifyNoMoreInteractions(aaiReactiveHttpPatchClient); } - private void getAaiProducerTask_whenMockingResponseObject(int statusCode) throws SSLException { + private void getAaiProducerTask_whenMockingResponseObject(HttpResponseStatus httpResponseStatus) throws SSLException { //given - doReturn(HttpStatus.valueOf(statusCode)).when(clientResponse).statusCode(); - Mono<ClientResponse> clientResponseMono = Mono.just(clientResponse); - aaiReactiveHttpPatchClient = mock(AaiReactiveHttpPatchClient.class); - when(aaiReactiveHttpPatchClient.getAaiProducerResponse(any())) + doReturn(httpResponseStatus).when(clientResponse).status(); + Mono<HttpClientResponse> clientResponseMono = Mono.just(clientResponse); + aaiReactiveHttpPatchClient = mock(AaiHttpPatchClient.class); + when(aaiReactiveHttpPatchClient.getAaiResponse(any())) .thenReturn(clientResponseMono); when(appConfig.getAaiClientConfiguration()).thenReturn(aaiClientConfiguration); aaiProducerTask = spy(new AaiProducerTaskImpl(appConfig)); |