Search in sources :

Example 1 with ServiceBrokerCreateOperationInProgressException

use of org.springframework.cloud.servicebroker.exception.ServiceBrokerCreateOperationInProgressException in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceControllerIntegrationTest method createServiceInstanceWithAsyncAndHeadersOperationInProgress.

@Test
void createServiceInstanceWithAsyncAndHeadersOperationInProgress() throws Exception {
    setupCatalogService();
    setupServiceInstanceService(new ServiceBrokerCreateOperationInProgressException("task_10"));
    client.put().uri(buildCreateUpdateUrl(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("task_10");
    CreateServiceInstanceRequest actualRequest = verifyCreateServiceInstance();
    assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true);
    assertHeaderValuesSet(actualRequest);
}
Also used : CreateServiceInstanceRequest(org.springframework.cloud.servicebroker.model.instance.CreateServiceInstanceRequest) ServiceBrokerCreateOperationInProgressException(org.springframework.cloud.servicebroker.exception.ServiceBrokerCreateOperationInProgressException) AbstractServiceInstanceControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 2 with ServiceBrokerCreateOperationInProgressException

use of org.springframework.cloud.servicebroker.exception.ServiceBrokerCreateOperationInProgressException in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceControllerIntegrationTest method createServiceInstanceWithAsyncAndHeadersOperationInProgress.

@Test
void createServiceInstanceWithAsyncAndHeadersOperationInProgress() throws Exception {
    setupCatalogService();
    setupServiceInstanceService(new ServiceBrokerCreateOperationInProgressException("task_10"));
    MvcResult mvcResult = mockMvc.perform(put(buildCreateUpdateUrl(PLATFORM_INSTANCE_ID, true)).content(createRequestBody).contentType(MediaType.APPLICATION_JSON).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).accept(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andExpect(status().isOk()).andReturn();
    mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isAccepted()).andExpect(jsonPath("$.operation", is("task_10")));
    CreateServiceInstanceRequest actualRequest = verifyCreateServiceInstance();
    assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true);
    assertHeaderValuesSet(actualRequest);
}
Also used : CreateServiceInstanceRequest(org.springframework.cloud.servicebroker.model.instance.CreateServiceInstanceRequest) MvcResult(org.springframework.test.web.servlet.MvcResult) ServiceBrokerCreateOperationInProgressException(org.springframework.cloud.servicebroker.exception.ServiceBrokerCreateOperationInProgressException) AbstractServiceInstanceControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 3 with ServiceBrokerCreateOperationInProgressException

use of org.springframework.cloud.servicebroker.exception.ServiceBrokerCreateOperationInProgressException in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppWithAsyncAndHeadersOperationInProgress.

@Test
void createBindingToAppWithAsyncAndHeadersOperationInProgress() throws Exception {
    setupCatalogService();
    setupServiceInstanceBindingService(new ServiceBrokerCreateOperationInProgressException("task_10"));
    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", is("task_10")));
    verifyCreateBinding();
}
Also used : MvcResult(org.springframework.test.web.servlet.MvcResult) ServiceBrokerCreateOperationInProgressException(org.springframework.cloud.servicebroker.exception.ServiceBrokerCreateOperationInProgressException) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 4 with ServiceBrokerCreateOperationInProgressException

use of org.springframework.cloud.servicebroker.exception.ServiceBrokerCreateOperationInProgressException in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppWithAsyncAndHeadersOperationInProgress.

@Test
void createBindingToAppWithAsyncAndHeadersOperationInProgress() throws Exception {
    setupCatalogService();
    setupServiceInstanceBindingService(new ServiceBrokerCreateOperationInProgressException("task_10"));
    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("task_10");
    verifyCreateBinding();
}
Also used : ServiceBrokerCreateOperationInProgressException(org.springframework.cloud.servicebroker.exception.ServiceBrokerCreateOperationInProgressException) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)4 ServiceBrokerCreateOperationInProgressException (org.springframework.cloud.servicebroker.exception.ServiceBrokerCreateOperationInProgressException)4 AbstractServiceInstanceBindingControllerIntegrationTest (org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest)2 AbstractServiceInstanceControllerIntegrationTest (org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceControllerIntegrationTest)2 CreateServiceInstanceRequest (org.springframework.cloud.servicebroker.model.instance.CreateServiceInstanceRequest)2 MvcResult (org.springframework.test.web.servlet.MvcResult)2