Search in sources :

Example 6 with CreateServiceInstanceBindingRequest

use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToRouteWithoutAsyncHeadersSucceeds.

@Test
void createBindingToRouteWithoutAsyncHeadersSucceeds() throws Exception {
    setupCatalogService();
    setupServiceInstanceBindingService(CreateServiceInstanceRouteBindingResponse.builder().bindingExisted(false).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().isCreated());
    CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
    assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false);
    assertHeaderValuesNotSet(actualRequest);
}
Also used : CreateServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest) MvcResult(org.springframework.test.web.servlet.MvcResult) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 7 with CreateServiceInstanceBindingRequest

use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppWithAsyncAndHeadersSucceeds.

@Test
void createBindingToAppWithAsyncAndHeadersSucceeds() throws Exception {
    setupCatalogService();
    setupServiceInstanceBindingService(CreateServiceInstanceAppBindingResponse.builder().async(true).operation("working").bindingExisted(false).build());
    MvcResult mvcResult = mockMvc.perform(put(buildCreateUrl(PLATFORM_INSTANCE_ID, true)).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()).andExpect(status().isOk()).andReturn();
    mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isAccepted()).andExpect(jsonPath("$.operation", equalTo("working")));
    CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
    assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true);
    assertHeaderValuesSet(actualRequest);
}
Also used : CreateServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest) MvcResult(org.springframework.test.web.servlet.MvcResult) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 8 with CreateServiceInstanceBindingRequest

use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppWithAsyncAndHeadersSucceeds.

@Test
void createBindingToAppWithAsyncAndHeadersSucceeds() throws Exception {
    setupCatalogService();
    setupServiceInstanceBindingService(CreateServiceInstanceAppBindingResponse.builder().async(true).operation("working").bindingExisted(false).build());
    client.put().uri(buildCreateUrl(PLATFORM_INSTANCE_ID, true)).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().isAccepted().expectBody().jsonPath("$.operation").isEqualTo("working");
    CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
    assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true);
    assertHeaderValuesSet(actualRequest);
}
Also used : CreateServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 9 with CreateServiceInstanceBindingRequest

use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppFiltersPlansSucceeds.

@Test
void createBindingToAppFiltersPlansSucceeds() 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();
    assertThat(actualRequest.getPlan().getId()).isEqualTo(actualRequest.getPlanId());
    assertHeaderValuesSet(actualRequest);
}
Also used : CreateServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 10 with CreateServiceInstanceBindingRequest

use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppFiltersPlansSucceeds.

@Test
void createBindingToAppFiltersPlansSucceeds() 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);
    assertThat(actualRequest.getPlan().getId()).isEqualTo(actualRequest.getPlanId());
    assertHeaderValuesSet(actualRequest);
}
Also used : CreateServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest) MvcResult(org.springframework.test.web.servlet.MvcResult) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

CreateServiceInstanceBindingRequest (org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest)21 Test (org.junit.jupiter.api.Test)16 AbstractServiceInstanceBindingControllerIntegrationTest (org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest)15 MvcResult (org.springframework.test.web.servlet.MvcResult)6 Test (org.junit.Test)2 CreateServiceInstanceBindingResponse (org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingResponse)2 Theory (org.junit.experimental.theories.Theory)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1