org.springframework.cloud.servicebroker.model.instance.DeleteServiceInstanceResponse Java Examples
The following examples show how to use
org.springframework.cloud.servicebroker.model.instance.DeleteServiceInstanceResponse.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ServiceInstanceControllerIntegrationTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 6 votes |
@Test void deleteServiceInstanceWithoutAsyncAndHeadersSucceeds() throws Exception { setupCatalogService(); setupServiceInstanceService(DeleteServiceInstanceResponse.builder() .build()); MvcResult mvcResult = mockMvc.perform(delete(buildDeleteUrl()) .accept(MediaType.APPLICATION_JSON)) .andExpect(request().asyncStarted()) .andReturn(); mockMvc.perform(asyncDispatch(mvcResult)) .andExpect(status().isOk()) .andExpect(content().string("{}")); DeleteServiceInstanceRequest actualRequest = verifyDeleteServiceInstance(); assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false); assertHeaderValuesNotSet(actualRequest); }
Example #2
Source File: ServiceInstanceEventServiceTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 6 votes |
@Test void deleteServiceInstanceSucceeds() { prepareDeleteEventFlows(); StepVerifier .create(serviceInstanceEventService.deleteServiceInstance( DeleteServiceInstanceRequest.builder() .serviceInstanceId("service-instance-id") .serviceDefinitionId("service-def-id") .build())) .expectNext(DeleteServiceInstanceResponse.builder().build()) .verifyComplete(); assertThat(this.results.getBeforeDelete()).isEqualTo("before service-instance-id"); assertThat(this.results.getAfterDelete()).isEqualTo("after service-instance-id"); assertThat(this.results.getErrorDelete()).isNullOrEmpty(); }
Example #3
Source File: WorkflowServiceInstanceService.java From spring-cloud-app-broker with Apache License 2.0 | 6 votes |
private Mono<Void> delete(DeleteServiceInstanceRequest request, DeleteServiceInstanceResponse response) { return stateRepository.saveState(request.getServiceInstanceId(), OperationState.IN_PROGRESS, "delete service instance started") .thenMany(invokeDeleteWorkflows(request, response) .doOnRequest(l -> { LOG.info("Deleting service instance"); LOG.debug("request={}", request); }) .doOnComplete(() -> { LOG.info("Finish deleting service instance"); LOG.debug("request={}, response={}", request, response); }) .doOnError(e -> LOG.error(String.format("Error deleting service instance. error=%s", e.getMessage()), e))) .thenEmpty(stateRepository.saveState(request.getServiceInstanceId(), OperationState.SUCCEEDED, "delete service instance completed") .then()) .onErrorResume(e -> stateRepository.saveState(request.getServiceInstanceId(), OperationState.FAILED, e.getMessage()) .then()); }
Example #4
Source File: ServiceInstanceControllerIntegrationTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 6 votes |
@Test void deleteServiceInstanceWithAsyncAndHeadersSucceeds() throws Exception { setupCatalogService(); setupServiceInstanceService(DeleteServiceInstanceResponse.builder() .async(true) .operation("working") .build()); MvcResult mvcResult = mockMvc.perform(delete(buildDeleteUrl(PLATFORM_INSTANCE_ID, true)) .header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION) .header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()) .accept(MediaType.APPLICATION_JSON)) .andExpect(request().asyncStarted()) .andReturn(); mockMvc.perform(asyncDispatch(mvcResult)) .andExpect(status().isAccepted()) .andExpect(jsonPath("$.operation", equalTo("working"))); DeleteServiceInstanceRequest actualRequest = verifyDeleteServiceInstance(); assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true); assertHeaderValuesSet(actualRequest); }
Example #5
Source File: ServiceInstanceControllerResponseCodeTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 6 votes |
private void validateDeleteServiceInstanceWithResponseStatus(DeleteServiceInstanceResponse response, HttpStatus expectedStatus) { Mono<DeleteServiceInstanceResponse> responseMono; if (response == null) { responseMono = Mono.empty(); } else { responseMono = Mono.just(response); } given(serviceInstanceService.deleteServiceInstance(any(DeleteServiceInstanceRequest.class))) .willReturn(responseMono); ResponseEntity<DeleteServiceInstanceResponse> responseEntity = controller .deleteServiceInstance(pathVariables, null, "service-definition-id", "service-definition-plan-id", false, null, null, null) .block(); assertThat(responseEntity).isNotNull(); assertThat(responseEntity.getStatusCode()).isEqualTo(expectedStatus); assertThat(responseEntity.getBody()).isEqualTo(response); }
Example #6
Source File: ServiceInstanceControllerIntegrationTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 6 votes |
@Test void deleteServiceInstanceFiltersPlansSucceeds() throws Exception { setupCatalogService(); setupServiceInstanceService(DeleteServiceInstanceResponse.builder() .build()); MvcResult mvcResult = mockMvc .perform(delete(buildDeleteUrl()) .accept(MediaType.APPLICATION_JSON)) .andExpect(request().asyncStarted()) .andReturn(); mockMvc.perform(asyncDispatch(mvcResult)) .andExpect(status().isOk()) .andExpect(content().string("{}")); DeleteServiceInstanceRequest actualRequest = verifyDeleteServiceInstance(); assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false); assertThat(actualRequest.getPlan().getId()).isEqualTo(actualRequest.getPlanId()); assertHeaderValuesNotSet(actualRequest); }
Example #7
Source File: ServiceInstanceControllerIntegrationTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 6 votes |
@Test void deleteServiceInstanceWithAsyncAndHeadersSucceeds() throws Exception { setupCatalogService(); setupServiceInstanceService(DeleteServiceInstanceResponse.builder() .async(true) .operation("working") .build()); client.delete().uri(buildDeleteUrl(PLATFORM_INSTANCE_ID, true)) .header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION) .header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()) .accept(MediaType.APPLICATION_JSON) .exchange() .expectStatus().isAccepted() .expectBody() .jsonPath("$.operation").isEqualTo("working"); DeleteServiceInstanceRequest actualRequest = verifyDeleteServiceInstance(); assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true); assertHeaderValuesSet(actualRequest); }
Example #8
Source File: ServiceInstanceControllerIntegrationTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 6 votes |
@Test void deleteServiceInstanceWithoutAsyncAndHeadersSucceeds() { setupCatalogService(); setupServiceInstanceService(DeleteServiceInstanceResponse.builder() .build()); client.delete().uri(buildDeleteUrl()) .accept(MediaType.APPLICATION_JSON) .exchange() .expectStatus().isOk() .expectBody() .json("{}"); DeleteServiceInstanceRequest actualRequest = verifyDeleteServiceInstance(); assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false); assertHeaderValuesNotSet(actualRequest); }
Example #9
Source File: TestServiceInstanceService.java From spring-cloud-open-service-broker with Apache License 2.0 | 6 votes |
@Override public Mono<DeleteServiceInstanceResponse> deleteServiceInstance(DeleteServiceInstanceRequest request) { if (IN_PROGRESS_SERVICE_INSTANCE_ID.equals(request.getServiceInstanceId())) { return Mono.error(new ServiceBrokerDeleteOperationInProgressException("task_10")); } if (UNKNOWN_SERVICE_INSTANCE_ID.equals(request.getServiceInstanceId())) { return Mono.error(new ServiceInstanceDoesNotExistException(UNKNOWN_SERVICE_INSTANCE_ID)); } if (request.isAsyncAccepted()) { return Mono.just(DeleteServiceInstanceResponse.builder() .async(true) .operation("working") .build()); } else { return Mono.just(DeleteServiceInstanceResponse.builder() .build()); } }
Example #10
Source File: ServiceInstanceControllerIntegrationTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 6 votes |
@Test void deleteServiceInstanceFiltersPlansSucceeds() { setupCatalogService(); setupServiceInstanceService(DeleteServiceInstanceResponse .builder() .build()); client.delete().uri(buildDeleteUrl()) .accept(MediaType.APPLICATION_JSON) .exchange() .expectStatus().isOk() .expectBody() .json("{}"); DeleteServiceInstanceRequest actualRequest = verifyDeleteServiceInstance(); assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false); assertThat(actualRequest.getPlan().getId()).isEqualTo("plan-three-id"); assertHeaderValuesNotSet(actualRequest); }
Example #11
Source File: ExampleServiceInstanceService.java From spring-cloud-open-service-broker with Apache License 2.0 | 5 votes |
@Override public Mono<DeleteServiceInstanceResponse> deleteServiceInstance(DeleteServiceInstanceRequest request) { String serviceInstanceId = request.getServiceInstanceId(); String planId = request.getPlanId(); // // perform the steps necessary to initiate the asynchronous // deletion of all provisioned resources // return Mono.just(DeleteServiceInstanceResponse.builder() .async(true) .build()); }
Example #12
Source File: EventFlowsAutoConfigurationTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 5 votes |
@Bean public DeleteServiceInstanceCompletionFlow deleteCompleteFlow() { return new DeleteServiceInstanceCompletionFlow() { @Override public Mono<Void> complete(DeleteServiceInstanceRequest request, DeleteServiceInstanceResponse response) { return Mono.empty(); } }; }
Example #13
Source File: MailServiceInstanceService.java From tutorials with MIT License | 5 votes |
@Override public Mono<DeleteServiceInstanceResponse> deleteServiceInstance(DeleteServiceInstanceRequest request) { return Mono.just(request.getServiceInstanceId()) .flatMap(instanceId -> mailService.serviceInstanceExists(instanceId) .flatMap(exists -> { if (exists) { return mailService.deleteServiceInstance(instanceId) .thenReturn(DeleteServiceInstanceResponse.builder().build()); } else { return Mono.error(new ServiceInstanceDoesNotExistException(instanceId)); } })); }
Example #14
Source File: ExampleServiceInstanceEventFlowsConfiguration2.java From spring-cloud-open-service-broker with Apache License 2.0 | 5 votes |
@Bean public DeleteServiceInstanceCompletionFlow deleteServiceInstanceCompletionFlow() { return new DeleteServiceInstanceCompletionFlow() { @Override public Mono<Void> complete(DeleteServiceInstanceRequest request, DeleteServiceInstanceResponse response) { // // do something after the instance is deleted // return Mono.empty(); } }; }
Example #15
Source File: ServiceInstanceEventService.java From spring-cloud-open-service-broker with Apache License 2.0 | 5 votes |
@Override public Mono<DeleteServiceInstanceResponse> deleteServiceInstance(DeleteServiceInstanceRequest request) { return flows.getDeleteInstanceRegistry().getInitializationFlows(request) .then(service.deleteServiceInstance(request)) .onErrorResume(e -> flows.getDeleteInstanceRegistry().getErrorFlows(request, e) .then(Mono.error(e))) .flatMap(response -> flows.getDeleteInstanceRegistry().getCompletionFlows(request, response) .then(Mono.just(response))); }
Example #16
Source File: ServiceInstanceControllerResponseCodeTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 5 votes |
@Test void deleteServiceInstanceWithAsyncResponseGivesExpectedStatus() { validateDeleteServiceInstanceWithResponseStatus(DeleteServiceInstanceResponse.builder() .async(true) .operation("deleting") .build(), HttpStatus.ACCEPTED); }
Example #17
Source File: ServiceInstanceControllerResponseCodeTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 5 votes |
@Test void deleteServiceInstanceWithMissingInstanceGivesExpectedStatus() { given(serviceInstanceService.deleteServiceInstance(any(DeleteServiceInstanceRequest.class))) .willReturn(Mono.error(new ServiceInstanceDoesNotExistException("instance does not exist"))); ResponseEntity<DeleteServiceInstanceResponse> responseEntity = controller .deleteServiceInstance(pathVariables, null, "service-definition-id", "service-definition-plan-id", false, null, null, null) .block(); assertThat(responseEntity).isNotNull(); assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.GONE); }
Example #18
Source File: ServiceInstanceEventServiceTest.java From spring-cloud-open-service-broker with Apache License 2.0 | 5 votes |
@Override public Mono<DeleteServiceInstanceResponse> deleteServiceInstance( DeleteServiceInstanceRequest request) { if (request.getServiceDefinitionId() == null) { return Mono.error(new ServiceInstanceDoesNotExistException("service-instance-id")); } return Mono.just(DeleteServiceInstanceResponse.builder().build()); }
Example #19
Source File: AppDeploymentDeleteServiceInstanceWorkflowTest.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
@Test void deleteServiceInstanceWithOnlyBoundServicesSucceeds() { DeleteServiceInstanceRequest request = buildRequest("service2", "plan2"); DeleteServiceInstanceResponse response = DeleteServiceInstanceResponse.builder().build(); // configured backing services given(this.targetService.addToBackingServices(eq(backingServices), eq(targetSpec), eq("service-instance-id"))) .willReturn(Mono.just(backingServices)); // no backing apps given(this.backingAppManagementService.getDeployedBackingApplications(request.getServiceInstanceId(), request.getServiceDefinition().getName(), request.getPlan().getName())) .willReturn(Mono.empty()); given(this.backingServicesProvisionService.deleteServiceInstance(argThat(backingServices -> { boolean nameMatch = "my-service-instance".equals(backingServices.get(0).getServiceInstanceName()); boolean sizeMatch = backingServices.size() == 1; return sizeMatch && nameMatch; }))).willReturn(Flux.just("my-service-instance")); StepVerifier.create(deleteServiceInstanceWorkflow.delete(request, response)) .expectNext() .expectNext() .verifyComplete(); verify(this.backingServicesProvisionService, Mockito.times(1)).deleteServiceInstance(any()); verifyNoMoreInteractionsWithServices(); }
Example #20
Source File: AppDeploymentDeleteServiceInstanceWorkflowTest.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
@Test void deleteServiceInstanceWithWithNoAppsDoesNothing() { DeleteServiceInstanceRequest request = buildRequest("unsupported-service", "plan1"); DeleteServiceInstanceResponse response = DeleteServiceInstanceResponse.builder().build(); given(this.backingAppManagementService.getDeployedBackingApplications(request.getServiceInstanceId(), request.getServiceDefinition().getName(), request.getPlan().getName())) .willReturn(Mono.empty()); StepVerifier .create(deleteServiceInstanceWorkflow.delete(request, response)) .verifyComplete(); verifyNoMoreInteractionsWithServices(); }
Example #21
Source File: WorkflowServiceInstanceService.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
@Override public Mono<DeleteServiceInstanceResponse> deleteServiceInstance(DeleteServiceInstanceRequest request) { return invokeDeleteResponseBuilders(request) .publishOn(Schedulers.parallel()) .doOnNext(response -> delete(request, response) .subscribe()); }
Example #22
Source File: AppDeploymentDeleteServiceInstanceWorkflowTest.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
@Test void deleteServiceInstanceSucceedsWhenBackingServicesDifferFromConfiguration() { DeleteServiceInstanceRequest request = buildRequest("service3", "plan3"); DeleteServiceInstanceResponse response = DeleteServiceInstanceResponse.builder().build(); given(this.backingAppDeploymentService.undeploy(eq(backingApps))) .willReturn(Flux.just("undeployed1", "undeployed2")); // configured backing services given(this.targetService.addToBackingServices(eq(backingServices2), eq(targetSpec), eq("service-instance-id"))) .willReturn(Mono.just(backingServices2)); // different bound services given(this.backingAppManagementService.getDeployedBackingApplications(request.getServiceInstanceId(), request.getServiceDefinition().getName(), request.getPlan().getName())) .willReturn(Mono.just(getExistingBackingAppsWithService("different-service-instance"))); given(this.credentialProviderService.deleteCredentials(eq(backingApps), eq(request.getServiceInstanceId()))) .willReturn(Mono.just(backingApps)); given(this.targetService.addToBackingApplications(eq(backingApps), eq(targetSpec), eq("service-instance-id"))) .willReturn(Mono.just(backingApps)); given(this.backingServicesProvisionService.deleteServiceInstance(argThat(backingServices -> { boolean nameMatch0 = "my-service-instance2".equals(backingServices.get(0).getServiceInstanceName()); boolean spaceMatch0 = "my-space2".equals(backingServices.get(0).getProperties() .get(DeploymentProperties.TARGET_PROPERTY_KEY)); boolean nameMatch1 = "different-service-instance".equals(backingServices.get(1).getServiceInstanceName()); boolean spaceMatch1 = "TargetSpace".equals(backingServices.get(1).getProperties() .get(DeploymentProperties.TARGET_PROPERTY_KEY)); boolean sizeMatch = backingServices.size() == 2; return sizeMatch && (nameMatch0 && spaceMatch0 || nameMatch1 && spaceMatch1); }))).willReturn(Flux.just("different-service-instance")); StepVerifier.create(deleteServiceInstanceWorkflow.delete(request, response)) .expectNext() .expectNext() .verifyComplete(); verify(this.backingServicesProvisionService, Mockito.times(1)).deleteServiceInstance(any()); verifyNoMoreInteractionsWithServices(); }
Example #23
Source File: WorkflowServiceInstanceService.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
private Mono<DeleteServiceInstanceResponse> invokeDeleteResponseBuilders(DeleteServiceInstanceRequest request) { AtomicReference<DeleteServiceInstanceResponseBuilder> responseBuilder = new AtomicReference<>(DeleteServiceInstanceResponse.builder()); return Flux.fromIterable(deleteServiceInstanceWorkflows) .filterWhen(workflow -> workflow.accept(request)) .flatMap(workflow -> workflow.buildResponse(request, responseBuilder.get()) .doOnNext(responseBuilder::set)) .last(responseBuilder.get()) .map(DeleteServiceInstanceResponseBuilder::build); }
Example #24
Source File: AppDeploymentDeleteServiceInstanceWorkflowTest.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
@Test void deleteServiceInstanceWithDeployedAppsAndBoundServicesSucceeds() { DeleteServiceInstanceRequest request = buildRequest("service1", "plan1"); DeleteServiceInstanceResponse response = DeleteServiceInstanceResponse.builder().build(); given(this.backingAppDeploymentService.undeploy(eq(backingApps))) .willReturn(Flux.just("undeployed1", "undeployed2")); // configured backing services given(this.targetService.addToBackingServices(eq(backingServices), eq(targetSpec), eq("service-instance-id"))) .willReturn(Mono.just(backingServices)); // services bound to deployed apps given(this.backingAppManagementService.getDeployedBackingApplications(request.getServiceInstanceId(), request.getServiceDefinition().getName(), request.getPlan().getName())) .willReturn(Mono.just(getExistingBackingAppsWithService("my-service-instance"))); given(this.credentialProviderService.deleteCredentials(eq(backingApps), eq(request.getServiceInstanceId()))) .willReturn(Mono.just(backingApps)); given(this.targetService.addToBackingApplications(eq(backingApps), eq(targetSpec), eq("service-instance-id"))) .willReturn(Mono.just(backingApps)); given(this.backingServicesProvisionService.deleteServiceInstance(argThat(backingServices -> { boolean nameMatch = "my-service-instance".equals(backingServices.get(0).getServiceInstanceName()); boolean sizeMatch = backingServices.size() == 1; return sizeMatch && nameMatch; }))).willReturn(Flux.just("my-service-instance")); StepVerifier .create(deleteServiceInstanceWorkflow.delete(request, response)) .expectNext() .expectNext() .verifyComplete(); verify(this.backingServicesProvisionService, Mockito.times(1)).deleteServiceInstance(any()); verifyNoMoreInteractionsWithServices(); }
Example #25
Source File: WorkflowServiceInstanceServiceTest.java From spring-cloud-app-broker with Apache License 2.0 | 5 votes |
@Test void deleteServiceInstanceWithResponseError() { DeleteServiceInstanceRequest request = DeleteServiceInstanceRequest.builder() .serviceInstanceId("foo") .build(); DeleteServiceInstanceResponseBuilder responseBuilder = DeleteServiceInstanceResponse.builder(); given(deleteServiceInstanceWorkflow1.accept(request)) .willReturn(Mono.just(true)); given( deleteServiceInstanceWorkflow1 .buildResponse(eq(request), any(DeleteServiceInstanceResponseBuilder.class))) .willReturn(Mono.error(new ServiceBrokerException("delete foo error"))); given(deleteServiceInstanceWorkflow2.accept(request)) .willReturn(Mono.just(true)); given( deleteServiceInstanceWorkflow2 .buildResponse(eq(request), any(DeleteServiceInstanceResponseBuilder.class))) .willReturn(Mono.just(responseBuilder)); StepVerifier.create(workflowServiceInstanceService.deleteServiceInstance(request)) .expectErrorSatisfies(e -> assertThat(e) .isInstanceOf(ServiceBrokerException.class) .hasMessage("delete foo error")) .verify(); }
Example #26
Source File: BookStoreServiceInstanceService.java From bookstore-service-broker with Apache License 2.0 | 5 votes |
@Override public Mono<DeleteServiceInstanceResponse> deleteServiceInstance(DeleteServiceInstanceRequest request) { return Mono.just(request.getServiceInstanceId()) .flatMap(instanceId -> instanceRepository.existsById(instanceId) .flatMap(exists -> { if (exists) { return storeService.deleteBookStore(instanceId) .then(instanceRepository.deleteById(instanceId)) .thenReturn(DeleteServiceInstanceResponse.builder().build()); } else { return Mono.error(new ServiceInstanceDoesNotExistException(instanceId)); } })); }
Example #27
Source File: WorkflowServiceInstanceServiceTest.java From spring-cloud-app-broker with Apache License 2.0 | 4 votes |
@Test void deleteServiceInstanceWithAsyncError() { given(serviceInstanceStateRepository.saveState(anyString(), any(OperationState.class), anyString())) .willReturn( Mono.just( new ServiceInstanceState(OperationState.IN_PROGRESS, "delete service instance started", new Timestamp(Instant.now().minusSeconds(60).toEpochMilli())))) .willReturn(Mono.just(new ServiceInstanceState(OperationState.FAILED, "delete service instance failed", new Timestamp(Instant.now().minusSeconds(30).toEpochMilli())))); DeleteServiceInstanceRequest request = DeleteServiceInstanceRequest.builder() .serviceInstanceId("foo") .build(); DeleteServiceInstanceResponseBuilder responseBuilder = DeleteServiceInstanceResponse.builder(); given(deleteServiceInstanceWorkflow1.accept(request)) .willReturn(Mono.just(true)); given(deleteServiceInstanceWorkflow1.delete(request, responseBuilder.build())) .willReturn(Mono.error(new RuntimeException("delete foo error"))); given( deleteServiceInstanceWorkflow1 .buildResponse(eq(request), any(DeleteServiceInstanceResponseBuilder.class))) .willReturn(Mono.just(responseBuilder)); given(deleteServiceInstanceWorkflow2.accept(request)) .willReturn(Mono.just(true)); given(deleteServiceInstanceWorkflow2.delete(request, responseBuilder.build())) .willReturn(Mono.empty()); given( deleteServiceInstanceWorkflow2 .buildResponse(eq(request), any(DeleteServiceInstanceResponseBuilder.class))) .willReturn(Mono.just(responseBuilder)); StepVerifier.create(workflowServiceInstanceService.deleteServiceInstance(request)) .assertNext(response -> { InOrder repoOrder = inOrder(serviceInstanceStateRepository); repoOrder.verify(serviceInstanceStateRepository) .saveState(eq("foo"), eq(OperationState.IN_PROGRESS), eq("delete service instance started")); repoOrder.verify(serviceInstanceStateRepository) .saveState(eq("foo"), eq(OperationState.FAILED), eq("delete foo error")); repoOrder.verifyNoMoreInteractions(); InOrder deleteOrder = inOrder(deleteServiceInstanceWorkflow1, deleteServiceInstanceWorkflow2); deleteOrder.verify(deleteServiceInstanceWorkflow2).buildResponse(eq(request), any(DeleteServiceInstanceResponseBuilder.class)); deleteOrder.verify(deleteServiceInstanceWorkflow1).buildResponse(eq(request), any(DeleteServiceInstanceResponseBuilder.class)); deleteOrder.verify(deleteServiceInstanceWorkflow2).delete(request, responseBuilder.build()); deleteOrder.verify(deleteServiceInstanceWorkflow1).delete(request, responseBuilder.build()); deleteOrder.verifyNoMoreInteractions(); assertThat(response).isNotNull(); }) .verifyComplete(); }
Example #28
Source File: DeleteServiceInstanceWorkflow.java From spring-cloud-app-broker with Apache License 2.0 | 4 votes |
default Mono<Void> delete(DeleteServiceInstanceRequest request, DeleteServiceInstanceResponse response) { return Mono.empty(); }
Example #29
Source File: NoOpServiceInstanceService.java From spring-cloud-open-service-broker with Apache License 2.0 | 4 votes |
@Override public Mono<DeleteServiceInstanceResponse> deleteServiceInstance(DeleteServiceInstanceRequest request) { return Mono.empty(); }
Example #30
Source File: WorkflowServiceInstanceService.java From spring-cloud-app-broker with Apache License 2.0 | 4 votes |
private Flux<Void> invokeDeleteWorkflows(DeleteServiceInstanceRequest request, DeleteServiceInstanceResponse response) { return Flux.fromIterable(deleteServiceInstanceWorkflows) .filterWhen(workflow -> workflow.accept(request)) .concatMap(workflow -> workflow.delete(request, response)); }