Search in sources :

Example 6 with DeleteServiceInstanceBindingRequest

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);
}
Also used : DeleteServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest) MvcResult(org.springframework.test.web.servlet.MvcResult) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 7 with DeleteServiceInstanceBindingRequest

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);
}
Also used : DeleteServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest) MvcResult(org.springframework.test.web.servlet.MvcResult) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 8 with DeleteServiceInstanceBindingRequest

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);
}
Also used : DeleteServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 9 with DeleteServiceInstanceBindingRequest

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);
}
Also used : DeleteServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 10 with DeleteServiceInstanceBindingRequest

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");
}
Also used : DeleteServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest) Test(org.junit.jupiter.api.Test)

Aggregations

DeleteServiceInstanceBindingRequest (org.springframework.cloud.servicebroker.model.binding.DeleteServiceInstanceBindingRequest)10 AbstractServiceInstanceBindingControllerIntegrationTest (org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest)8 Test (org.junit.jupiter.api.Test)7 MvcResult (org.springframework.test.web.servlet.MvcResult)3 Test (org.junit.Test)2 ServiceInstanceBindingDoesNotExistException (org.springframework.cloud.servicebroker.exception.ServiceInstanceBindingDoesNotExistException)1 ResponseEntity (org.springframework.http.ResponseEntity)1 DeleteMapping (org.springframework.web.bind.annotation.DeleteMapping)1