use of org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method deleteBindingSucceeds.
@Test
public void deleteBindingSucceeds() throws Exception {
setupCatalogService();
mockMvc.perform(delete(buildDeleteUrl(PLATFORM_INSTANCE_ID)).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk()).andExpect(jsonPath("$", is("{}")));
verify(serviceInstanceBindingService).deleteServiceInstanceBinding(any(DeleteServiceInstanceBindingRequest.class));
DeleteServiceInstanceBindingRequest actualRequest = verifyDeleteBinding();
assertHeaderValuesSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method deleteBindingFiltersPlansSucceeds.
@Test
void deleteBindingFiltersPlansSucceeds() throws Exception {
setupCatalogService();
setupServiceInstanceBindingService(DeleteServiceInstanceBindingResponse.builder().build());
client.delete().uri(buildDeleteUrl(PLATFORM_INSTANCE_ID, false)).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).exchange().expectStatus().isOk().expectBody().json("{}");
then(serviceInstanceBindingService).should().deleteServiceInstanceBinding(any(DeleteServiceInstanceBindingRequest.class));
DeleteServiceInstanceBindingRequest actualRequest = verifyDeleteBinding();
assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false);
assertThat(actualRequest.getPlan().getId()).isEqualTo(actualRequest.getPlanId());
assertHeaderValuesSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method deleteBindingFiltersPlansSucceeds.
@Test
void deleteBindingFiltersPlansSucceeds() throws Exception {
setupCatalogService();
setupServiceInstanceBindingService(DeleteServiceInstanceBindingResponse.builder().build());
MvcResult mvcResult = mockMvc.perform(delete(buildDeleteUrl(PLATFORM_INSTANCE_ID, false)).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).contentType(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andExpect(status().isOk()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isOk()).andExpect(content().string("{}"));
then(serviceInstanceBindingService).should().deleteServiceInstanceBinding(any(DeleteServiceInstanceBindingRequest.class));
DeleteServiceInstanceBindingRequest actualRequest = verifyDeleteBinding();
assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false);
assertThat(actualRequest.getPlan().getId()).isEqualTo(actualRequest.getPlanId());
assertHeaderValuesSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingController method deleteServiceInstanceBinding.
@DeleteMapping(value = { "/{platformInstanceId}/v2/service_instances/{instanceId}/service_bindings/{bindingId}", "/v2/service_instances/{instanceId}/service_bindings/{bindingId}" })
public ResponseEntity<String> deleteServiceInstanceBinding(@PathVariable Map<String, String> pathVariables, @PathVariable(INSTANCE_ID_PATH_VARIABLE) String serviceInstanceId, @PathVariable(BINDING_ID_PATH_VARIABLE) String bindingId, @RequestParam(SERVICE_ID_PARAMETER) String serviceDefinitionId, @RequestParam(PLAN_ID_PARAMETER) String planId, @RequestHeader(value = API_INFO_LOCATION_HEADER, required = false) String apiInfoLocation, @RequestHeader(value = ORIGINATING_IDENTITY_HEADER, required = false) String originatingIdentityString) {
DeleteServiceInstanceBindingRequest request = DeleteServiceInstanceBindingRequest.builder().serviceInstanceId(serviceInstanceId).bindingId(bindingId).serviceDefinitionId(serviceDefinitionId).planId(planId).serviceDefinition(getServiceDefinition(serviceDefinitionId)).platformInstanceId(pathVariables.get(PLATFORM_INSTANCE_ID_VARIABLE)).apiInfoLocation(apiInfoLocation).originatingIdentity(parseOriginatingIdentity(originatingIdentityString)).build();
LOGGER.debug("Deleting a service instance binding: request={}", request);
try {
serviceInstanceBindingService.deleteServiceInstanceBinding(request);
} catch (ServiceInstanceBindingDoesNotExistException e) {
LOGGER.debug(e.getMessage(), e);
return new ResponseEntity<>("{}", HttpStatus.GONE);
}
LOGGER.debug("Deleting a service instance binding succeeded: bindingId={}", bindingId);
return new ResponseEntity<>("{}", HttpStatus.OK);
}
use of org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method deleteBindingSucceeds.
@Test
public void deleteBindingSucceeds() throws Exception {
setupCatalogService();
client.delete().uri(buildDeleteUrl(PLATFORM_INSTANCE_ID)).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).exchange().expectStatus().isOk().expectBody().json("{}");
verify(serviceInstanceBindingService).deleteServiceInstanceBinding(any(DeleteServiceInstanceBindingRequest.class));
DeleteServiceInstanceBindingRequest actualRequest = verifyDeleteBinding();
assertHeaderValuesSet(actualRequest);
}
Aggregations