diff options
author | 2018-11-05 16:04:54 +0100 | |
---|---|---|
committer | 2018-11-05 16:10:17 +0100 | |
commit | e8a80102a45458b3f1d15e07dc0a63e1370c44a7 (patch) | |
tree | 374b4fc2d3b7577da8612ab92998f0e25090f147 /prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPPublisherReactiveHttpClientTest.java | |
parent | 600c05b1530c120b34370e86e92dfd79421474fe (diff) |
DmaaP Publisher and consumer interfaces ssl setup
Change-Id: I971d0fb222c6e8e15de4fc4a4d9eeb4ef3a99f44
Issue-ID: DCAEGEN2-944
Signed-off-by: piotr.karas <piotr.karas@nokia.com>
Diffstat (limited to 'prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPPublisherReactiveHttpClientTest.java')
-rw-r--r-- | prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPPublisherReactiveHttpClientTest.java | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPPublisherReactiveHttpClientTest.java b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPPublisherReactiveHttpClientTest.java index db3d515c..ce2f7f36 100644 --- a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPPublisherReactiveHttpClientTest.java +++ b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/producer/DMaaPPublisherReactiveHttpClientTest.java @@ -39,8 +39,6 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.client.RestTemplate; import reactor.test.StepVerifier; - - /** * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 7/4/18 */ @@ -48,10 +46,10 @@ import reactor.test.StepVerifier; class DMaaPPublisherReactiveHttpClientTest { private DMaaPPublisherReactiveHttpClient dmaapPublisherReactiveHttpClient; - private DmaapPublisherConfiguration dmaapPublisherConfigurationMock = mock( - DmaapPublisherConfiguration.class); + DmaapPublisherConfiguration.class); private ConsumerDmaapModel consumerDmaapModel = new ConsumerDmaapModelForUnitTest(); + private RestTemplate restTemplate = mock(RestTemplate.class); @BeforeEach @@ -63,7 +61,8 @@ class DMaaPPublisherReactiveHttpClientTest { when(dmaapPublisherConfigurationMock.dmaapUserPassword()).thenReturn("PRH"); when(dmaapPublisherConfigurationMock.dmaapContentType()).thenReturn("application/json"); when(dmaapPublisherConfigurationMock.dmaapTopicName()).thenReturn("unauthenticated.PNF_READY"); - dmaapPublisherReactiveHttpClient = new DMaaPPublisherReactiveHttpClient(dmaapPublisherConfigurationMock); + dmaapPublisherReactiveHttpClient = + new DMaaPPublisherReactiveHttpClient(dmaapPublisherConfigurationMock, restTemplate); } @@ -72,21 +71,19 @@ class DMaaPPublisherReactiveHttpClientTest { //given int responseSuccess = 200; ResponseEntity<String> mockedResponseEntity = mock(ResponseEntity.class); - RestTemplate restTemplate = mock(RestTemplate.class); //when when(mockedResponseEntity.getStatusCode()).thenReturn(HttpStatus.valueOf(responseSuccess)); doReturn(mockedResponseEntity).when(restTemplate) - .exchange(any(URI.class), any(HttpMethod.class), any(HttpEntity.class), (Class<Object>) any()); - dmaapPublisherReactiveHttpClient.createDMaaPWebClient(restTemplate); + .exchange(any(URI.class), any(HttpMethod.class), any(HttpEntity.class), (Class<Object>) any()); //then StepVerifier.create(dmaapPublisherReactiveHttpClient.getDMaaPProducerResponse(consumerDmaapModel)) - .expectSubscription().expectNext(mockedResponseEntity).verifyComplete(); + .expectSubscription().expectNext(mockedResponseEntity).verifyComplete(); } @Test void getAppropriateUri_whenPassingCorrectedPathForPnf() { Assertions.assertEquals(dmaapPublisherReactiveHttpClient.getUri(), - URI.create("https://54.45.33.2:1234/unauthenticated.PNF_READY")); + URI.create("https://54.45.33.2:1234/unauthenticated.PNF_READY")); } }
\ No newline at end of file |