diff options
Diffstat (limited to 'components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/pipelines/CpeAuthenticationPipelineTest.java')
-rw-r--r-- | components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/pipelines/CpeAuthenticationPipelineTest.java | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/pipelines/CpeAuthenticationPipelineTest.java b/components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/pipelines/CpeAuthenticationPipelineTest.java index 76d9659c..c4bef9df 100644 --- a/components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/pipelines/CpeAuthenticationPipelineTest.java +++ b/components/bbs-event-processor/src/test/java/org/onap/bbs/event/processor/pipelines/CpeAuthenticationPipelineTest.java @@ -64,15 +64,13 @@ import org.onap.bbs.event.processor.model.ServiceInstanceAaiObject; import org.onap.bbs.event.processor.tasks.AaiClientTask; import org.onap.bbs.event.processor.tasks.DmaapCpeAuthenticationConsumerTask; import org.onap.bbs.event.processor.tasks.DmaapPublisherTask; +import org.onap.dcaegen2.services.sdk.rest.services.adapters.http.HttpResponse; import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; import reactor.test.StepVerifier; -// We can safely suppress unchecked assignment warnings for the ResponseEntity mock -@SuppressWarnings("unchecked") @DisplayName("CPE Authentication Pipeline Unit-Tests") class CpeAuthenticationPipelineTest { @@ -82,12 +80,12 @@ class CpeAuthenticationPipelineTest { private DmaapPublisherTask publisherTask; private AaiClientTask aaiClientTask; - private ResponseEntity<String> responseEntity; + private HttpResponse httpResponse; @BeforeEach void setup() { - responseEntity = Mockito.mock(ResponseEntity.class); + httpResponse = Mockito.mock(HttpResponse.class); configuration = Mockito.mock(ApplicationConfiguration.class); consumerTask = Mockito.mock(DmaapCpeAuthenticationConsumerTask.class); @@ -268,13 +266,13 @@ class CpeAuthenticationPipelineTest { .executeServiceInstanceRetrieval(RETRIEVE_HSI_CFS_SERVICE_INSTANCE_TASK_NAME, cfsUrl)) .thenReturn(Mono.just(hsiCfsServiceInstance)); - when(responseEntity.getStatusCode()).thenReturn(HttpStatus.valueOf(HttpStatus.OK.value())); - when(publisherTask.execute(any(ControlLoopPublisherDmaapModel.class))).thenReturn(Mono.just(responseEntity)); + when(httpResponse.statusCode()).thenReturn(HttpStatus.OK.value()); + when(publisherTask.execute(any(ControlLoopPublisherDmaapModel.class))).thenReturn(Mono.just(httpResponse)); // Execute the pipeline StepVerifier.create(pipeline.executePipeline()) .expectSubscription() - .assertNext(r -> assertEquals(HttpStatus.OK, r.getStatusCode())) + .assertNext(r -> assertEquals(HttpStatus.OK.value(), r.statusCode())) .verifyComplete(); verify(publisherTask).execute(any(ControlLoopPublisherDmaapModel.class)); @@ -341,14 +339,14 @@ class CpeAuthenticationPipelineTest { .executeServiceInstanceRetrieval(RETRIEVE_HSI_CFS_SERVICE_INSTANCE_TASK_NAME, cfsUrl2)) .thenReturn(Mono.just(hsiCfsServiceInstance2)); - when(responseEntity.getStatusCode()).thenReturn(HttpStatus.valueOf(HttpStatus.OK.value())); - when(publisherTask.execute(any(ControlLoopPublisherDmaapModel.class))).thenReturn(Mono.just(responseEntity)); + when(httpResponse.statusCode()).thenReturn(HttpStatus.OK.value()); + when(publisherTask.execute(any(ControlLoopPublisherDmaapModel.class))).thenReturn(Mono.just(httpResponse)); // Execute the pipeline StepVerifier.create(pipeline.executePipeline()) .expectSubscription() - .assertNext(r -> assertEquals(HttpStatus.OK, r.getStatusCode())) - .assertNext(r -> assertEquals(HttpStatus.OK, r.getStatusCode())) + .assertNext(r -> assertEquals(HttpStatus.OK.value(), r.statusCode())) + .assertNext(r -> assertEquals(HttpStatus.OK.value(), r.statusCode())) .verifyComplete(); verify(publisherTask, times(2)).execute(any(ControlLoopPublisherDmaapModel.class)); @@ -452,13 +450,13 @@ class CpeAuthenticationPipelineTest { .executeServiceInstanceRetrieval(RETRIEVE_HSI_CFS_SERVICE_INSTANCE_TASK_NAME, cfsUrl2)) .thenReturn(Mono.just(hsiCfsServiceInstance2)); - when(responseEntity.getStatusCode()).thenReturn(HttpStatus.valueOf(HttpStatus.OK.value())); - when(publisherTask.execute(any(ControlLoopPublisherDmaapModel.class))).thenReturn(Mono.just(responseEntity)); + when(httpResponse.statusCode()).thenReturn(HttpStatus.OK.value()); + when(publisherTask.execute(any(ControlLoopPublisherDmaapModel.class))).thenReturn(Mono.just(httpResponse)); // Execute the pipeline StepVerifier.create(pipeline.executePipeline()) .expectSubscription() - .assertNext(r -> assertEquals(HttpStatus.OK, r.getStatusCode())) + .assertNext(r -> assertEquals(HttpStatus.OK.value(), r.statusCode())) .verifyComplete(); verify(publisherTask).execute(any(ControlLoopPublisherDmaapModel.class)); @@ -512,13 +510,13 @@ class CpeAuthenticationPipelineTest { .executeServiceInstanceRetrieval(RETRIEVE_HSI_CFS_SERVICE_INSTANCE_TASK_NAME, cfsUrl)) .thenReturn(Mono.just(hsiCfsServiceInstance)); - when(responseEntity.getStatusCode()).thenReturn(HttpStatus.valueOf(HttpStatus.OK.value())); - when(publisherTask.execute(any(ControlLoopPublisherDmaapModel.class))).thenReturn(Mono.just(responseEntity)); + when(httpResponse.statusCode()).thenReturn(HttpStatus.OK.value()); + when(publisherTask.execute(any(ControlLoopPublisherDmaapModel.class))).thenReturn(Mono.just(httpResponse)); // Execute the pipeline StepVerifier.create(pipeline.executePipeline()) .expectSubscription() - .assertNext(r -> assertEquals(HttpStatus.OK, r.getStatusCode())) + .assertNext(r -> assertEquals(HttpStatus.OK.value(), r.statusCode())) .verifyComplete(); verify(aaiClientTask, times(2)).executePnfRetrieval(anyString(), anyString()); @@ -574,13 +572,13 @@ class CpeAuthenticationPipelineTest { .executeServiceInstanceRetrieval(RETRIEVE_HSI_CFS_SERVICE_INSTANCE_TASK_NAME, cfsUrl)) .thenReturn(Mono.just(hsiCfsServiceInstance)); - when(responseEntity.getStatusCode()).thenReturn(HttpStatus.valueOf(HttpStatus.OK.value())); - when(publisherTask.execute(any(ControlLoopPublisherDmaapModel.class))).thenReturn(Mono.just(responseEntity)); + when(httpResponse.statusCode()).thenReturn(HttpStatus.OK.value()); + when(publisherTask.execute(any(ControlLoopPublisherDmaapModel.class))).thenReturn(Mono.just(httpResponse)); // Execute the pipeline StepVerifier.create(pipeline.executePipeline()) .expectSubscription() - .assertNext(r -> assertEquals(HttpStatus.OK, r.getStatusCode())) + .assertNext(r -> assertEquals(HttpStatus.OK.value(), r.statusCode())) .verifyComplete(); verify(aaiClientTask, times(2)) |