diff options
author | elinuxhenrik <henrik.b.andersson@est.tech> | 2018-09-26 16:03:45 +0200 |
---|---|---|
committer | elinuxhenrik <henrik.b.andersson@est.tech> | 2018-09-27 14:30:56 +0200 |
commit | 263d1a481bd5378e59b804425bc8a9bdc9bebb9a (patch) | |
tree | 4825c45fbccf1f99e3765417118c8a74bd9fe990 /datafile-dmaap-client/src/test | |
parent | d1e9b1e4004faf059c2505ef9ab561bf19472b98 (diff) |
Fix delivery to DataRouter
The messages to the DataRouter was not actually sent.
Change-Id: I5748ee0cc19a5049ca4d965caefb5cdf2204419f
Issue-ID: DCAEGEN2-841
Signed-off-by: elinuxhenrik <henrik.b.andersson@est.tech>
Diffstat (limited to 'datafile-dmaap-client/src/test')
-rw-r--r-- | datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClientTest.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClientTest.java b/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClientTest.java index c0dbf31b..5f4c1a58 100644 --- a/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClientTest.java +++ b/datafile-dmaap-client/src/test/java/org/onap/dcaegen2/collectors/datafile/service/producer/DmaapProducerReactiveHttpClientTest.java @@ -42,7 +42,8 @@ import org.springframework.web.reactive.function.client.WebClient.RequestBodyUri import org.springframework.web.reactive.function.client.WebClient.ResponseSpec; import org.springframework.web.util.DefaultUriBuilderFactory; -import reactor.core.publisher.Mono; +import reactor.core.publisher.Flux; +import reactor.test.StepVerifier; /** * @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 7/4/18 @@ -52,6 +53,7 @@ class DmaapProducerReactiveHttpClientTest { private static final String FILE_NAME = "A20161224.1030-1045.bin.gz"; private static final String LOCATION_JSON_TAG = "location"; + private static final String NAME_JSON_TAG = "name"; private static final String X_ATT_DR_META = "X-ATT-DR-META"; private static final String HOST = "54.45.33.2"; @@ -98,11 +100,13 @@ class DmaapProducerReactiveHttpClientTest { List<ConsumerDmaapModel> consumerDmaapModelList = new ArrayList<ConsumerDmaapModel>(); consumerDmaapModelList.add(consumerDmaapModel); - dmaapProducerReactiveHttpClient.getDmaapProducerResponse(Mono.just(consumerDmaapModelList)); + StepVerifier.create(dmaapProducerReactiveHttpClient.getDmaapProducerResponse(consumerDmaapModel)) + .expectNext("200").verifyComplete(); verify(requestBodyUriSpecMock).header(HttpHeaders.CONTENT_TYPE, APPLICATION_OCTET_STREAM_CONTENT_TYPE); JsonElement metaData = new JsonParser().parse(CommonFunctions.createJsonBody(consumerDmaapModel)); metaData.getAsJsonObject().remove(LOCATION_JSON_TAG); + metaData.getAsJsonObject().remove(NAME_JSON_TAG); verify(requestBodyUriSpecMock).header(X_ATT_DR_META, metaData.toString()); URI expectedUri = new DefaultUriBuilderFactory().builder().scheme(HTTP_SCHEME).host(HOST).port(PORT) .path(PUBLISH_TOPIC + "/" + DEFAULT_FEED_ID + "/" + FILE_NAME).build(); @@ -116,7 +120,7 @@ class DmaapProducerReactiveHttpClientTest { when(requestBodyUriSpecMock.retrieve()).thenReturn(responseSpecMock); when(responseSpecMock.onStatus(any(), any())).thenReturn(responseSpecMock); - Mono<String> expectedResult = Mono.just("200"); - when(responseSpecMock.bodyToMono(String.class)).thenReturn(expectedResult); + Flux<String> expectedResult = Flux.just("200"); + when(responseSpecMock.bodyToFlux(String.class)).thenReturn(expectedResult); } } |