use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppSucceeds.
@Test
public void createBindingToAppSucceeds() throws Exception {
setupCatalogService();
setupServiceInstanceBindingService(CreateServiceInstanceAppBindingResponse.builder().bindingExisted(false).build());
client.put().uri(buildCreateUrl(PLATFORM_INSTANCE_ID)).contentType(MediaType.APPLICATION_JSON).syncBody(createRequestBody).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isCreated();
CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
assertHeaderValuesSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppWithExistingSucceeds.
@Test
void createBindingToAppWithExistingSucceeds() throws Exception {
setupCatalogService();
setupServiceInstanceBindingService(CreateServiceInstanceAppBindingResponse.builder().bindingExisted(true).build());
MvcResult mvcResult = mockMvc.perform(put(buildCreateUrl()).content(createRequestBody).accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andExpect(status().isOk()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isOk());
CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
assertHeaderValuesNotSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method createBindingToRouteWithAsyncHeadersSucceeds.
@Test
void createBindingToRouteWithAsyncHeadersSucceeds() throws Exception {
setupCatalogService();
setupServiceInstanceBindingService(CreateServiceInstanceRouteBindingResponse.builder().async(true).operation("working").bindingExisted(false).build());
MvcResult mvcResult = mockMvc.perform(put(buildCreateUrl(null, true)).content(createRequestBody).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")));
CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true);
assertHeaderValuesNotSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppWithoutAsyncAndHeadersSucceeds.
@Test
void createBindingToAppWithoutAsyncAndHeadersSucceeds() throws Exception {
setupCatalogService();
setupServiceInstanceBindingService(CreateServiceInstanceAppBindingResponse.builder().bindingExisted(false).build());
MvcResult mvcResult = mockMvc.perform(put(buildCreateUrl(PLATFORM_INSTANCE_ID, false)).content(createRequestBody).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isCreated());
CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false);
assertHeaderValuesSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppWithoutAsyncAndHeadersSucceeds.
@Test
void createBindingToAppWithoutAsyncAndHeadersSucceeds() throws Exception {
setupCatalogService();
setupServiceInstanceBindingService(CreateServiceInstanceAppBindingResponse.builder().bindingExisted(false).build());
client.put().uri(buildCreateUrl(PLATFORM_INSTANCE_ID, false)).contentType(MediaType.APPLICATION_JSON).bodyValue(createRequestBody).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isCreated();
CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
assertHeaderValuesSet(actualRequest);
}
Aggregations