diff options
Diffstat (limited to 'prh-app-server/src/test/java')
2 files changed, 8 insertions, 7 deletions
diff --git a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java index fe9f6f78..1a858917 100644 --- a/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java +++ b/prh-app-server/src/test/java/org/onap/dcaegen2/services/prh/tasks/DmaapConsumerTaskImplTest.java @@ -36,8 +36,8 @@ import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration; import org.onap.dcaegen2.services.prh.configuration.AppConfig; import org.onap.dcaegen2.services.prh.model.ConsumerDmaapModel; import org.onap.dcaegen2.services.prh.model.ImmutableConsumerDmaapModel; -import org.onap.dcaegen2.services.prh.service.DMaaPReactiveWebClient; import org.onap.dcaegen2.services.prh.service.DmaapConsumerJsonParser; +import org.onap.dcaegen2.services.prh.service.consumer.ConsumerReactiveHttpClientFactory; import org.onap.dcaegen2.services.prh.service.consumer.DMaaPConsumerReactiveHttpClient; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -120,9 +120,8 @@ class DmaapConsumerTaskImplTest { dMaaPConsumerReactiveHttpClient = mock(DMaaPConsumerReactiveHttpClient.class); when(dMaaPConsumerReactiveHttpClient.getDMaaPConsumerResponse()).thenReturn(Mono.just(message.orElse(""))); when(appConfig.getDmaapConsumerConfiguration()).thenReturn(dmaapConsumerConfiguration); - DMaaPReactiveWebClient dmaapReactiveWebClient = mock(DMaaPReactiveWebClient.class); - dmaapConsumerTask = - spy(new DmaapConsumerTaskImpl(appConfig, new DmaapConsumerJsonParser(), dmaapReactiveWebClient)); - doReturn(dMaaPConsumerReactiveHttpClient).when(dmaapConsumerTask).resolveClient(); + ConsumerReactiveHttpClientFactory httpClientFactory = mock(ConsumerReactiveHttpClientFactory.class); + doReturn(dMaaPConsumerReactiveHttpClient).when(httpClientFactory).create(dmaapConsumerConfiguration); + dmaapConsumerTask = new DmaapConsumerTaskImpl(appConfig, new DmaapConsumerJsonParser(), httpClientFactory); } }
\ No newline at end of file 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 e9eed698..5bdcba52 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 @@ -41,6 +41,7 @@ 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.prh.service.producer.DMaaPPublisherReactiveHttpClient; +import org.onap.dcaegen2.services.prh.service.producer.PublisherReactiveHttpClientFactory; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import reactor.core.publisher.Mono; @@ -119,8 +120,9 @@ class DmaapPublisherTaskImplTest { dMaaPPublisherReactiveHttpClient = mock(DMaaPPublisherReactiveHttpClient.class); when(dMaaPPublisherReactiveHttpClient.getDMaaPProducerResponse(any())) .thenReturn(Mono.just(responseEntity)); - dmaapPublisherTask = spy(new DmaapPublisherTaskImpl(appConfig)); - doReturn(dMaaPPublisherReactiveHttpClient).when(dmaapPublisherTask).resolveClient(); + PublisherReactiveHttpClientFactory httpClientFactory = mock(PublisherReactiveHttpClientFactory.class); + doReturn(dMaaPPublisherReactiveHttpClient).when(httpClientFactory).create(dmaapPublisherConfiguration); + dmaapPublisherTask = new DmaapPublisherTaskImpl(appConfig, httpClientFactory); return responseEntity; } }
\ No newline at end of file |