use of org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method deleteBindingWithoutAsyncAndHeadersSucceeds.
@Test
void deleteBindingWithoutAsyncAndHeadersSucceeds() 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);
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 deleteBindingWithAsyncAndHeadersSucceeds.
@Test
void deleteBindingWithAsyncAndHeadersSucceeds() throws Exception {
setupCatalogService();
setupServiceInstanceBindingService(DeleteServiceInstanceBindingResponse.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).contentType(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andExpect(status().isOk()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isAccepted()).andExpect(jsonPath("$.operation", equalTo("working")));
then(serviceInstanceBindingService).should().deleteServiceInstanceBinding(any(DeleteServiceInstanceBindingRequest.class));
DeleteServiceInstanceBindingRequest actualRequest = verifyDeleteBinding();
assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true);
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 deleteBindingWithAsyncAndHeadersSucceeds.
@Test
void deleteBindingWithAsyncAndHeadersSucceeds() throws Exception {
setupCatalogService();
setupServiceInstanceBindingService(DeleteServiceInstanceBindingResponse.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()).exchange().expectStatus().isAccepted().expectBody().jsonPath("$.operation").isEqualTo("working");
then(serviceInstanceBindingService).should().deleteServiceInstanceBinding(any(DeleteServiceInstanceBindingRequest.class));
DeleteServiceInstanceBindingRequest actualRequest = verifyDeleteBinding();
assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true);
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 deleteBindingWithoutAsyncAndHeadersSucceeds.
@Test
void deleteBindingWithoutAsyncAndHeadersSucceeds() 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);
assertHeaderValuesSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerRequestTest method deleteServiceBindingParametersAreMappedToRequest.
@Test
void deleteServiceBindingParametersAreMappedToRequest() {
DeleteServiceInstanceBindingRequest expectedRequest = DeleteServiceInstanceBindingRequest.builder().asyncAccepted(true).serviceInstanceId("service-instance-id").serviceDefinitionId(serviceDefinition.getId()).planId("plan-id").bindingId("binding-id").platformInstanceId("platform-instance-id").apiInfoLocation("api-info-location").originatingIdentity(identityContext).requestIdentity("request-id").serviceDefinition(serviceDefinition).plan(plan).build();
ServiceInstanceBindingController controller = createControllerUnderTest(expectedRequest);
controller.deleteServiceInstanceBinding(pathVariables, "service-instance-id", "binding-id", serviceDefinition.getId(), "plan-id", true, "api-info-location", encodeOriginatingIdentity(identityContext), "request-id");
}
Aggregations