use of org.springframework.cloud.servicebroker.exception.ServiceBrokerOperationInProgressException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerIntegrationTest method getServiceInstanceWithOperationInProgressFails.
@Test
void getServiceInstanceWithOperationInProgressFails() throws Exception {
setupServiceInstanceService(new ServiceBrokerOperationInProgressException("task_10"));
client.get().uri(buildGetUrl(PLATFORM_INSTANCE_ID)).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isNotFound().expectBody().consumeWith(result -> assertDescriptionContains(result, "operation=task_10"));
}
use of org.springframework.cloud.servicebroker.exception.ServiceBrokerOperationInProgressException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceBindingControllerIntegrationTest method getBindingWithOperationInProgressFails.
@Test
void getBindingWithOperationInProgressFails() throws Exception {
given(serviceInstanceBindingService.getServiceInstanceBinding(any(GetServiceInstanceBindingRequest.class))).willThrow(new ServiceBrokerOperationInProgressException("task_10"));
MvcResult mvcResult = mockMvc.perform(get(buildCreateUrl()).accept(MediaType.APPLICATION_JSON).contentType(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isNotFound());
}
use of org.springframework.cloud.servicebroker.exception.ServiceBrokerOperationInProgressException in project spring-cloud-open-service-broker by spring-cloud.
the class BaseControllerTest method operationInProgressExceptionGivesExpectedStatus.
@Test
public void operationInProgressExceptionGivesExpectedStatus() {
ServiceBrokerOperationInProgressException exception = new ServiceBrokerOperationInProgressException("still working");
ResponseEntity<ErrorMessage> responseEntity = controller.handleException(exception);
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
assertThat(responseEntity.getBody().getError()).isNull();
assertThat(responseEntity.getBody().getMessage()).contains("still working");
}
use of org.springframework.cloud.servicebroker.exception.ServiceBrokerOperationInProgressException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceBrokerExceptionHandlerTest method operationInProgressException.
@Test
void operationInProgressException() {
ServiceBrokerOperationInProgressException exception = new ServiceBrokerOperationInProgressException("task_10");
ErrorMessage errorMessage = exceptionHandler.handleException(exception);
assertThat(errorMessage.getError()).isNull();
assertThat(errorMessage.getMessage()).contains("task_10");
}
use of org.springframework.cloud.servicebroker.exception.ServiceBrokerOperationInProgressException in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerIntegrationTest method getServiceInstanceWithOperationInProgressFails.
@Test
void getServiceInstanceWithOperationInProgressFails() throws Exception {
setupServiceInstanceService(new ServiceBrokerOperationInProgressException("task_10"));
MvcResult mvcResult = mockMvc.perform(get(buildGetUrl(PLATFORM_INSTANCE_ID)).header(API_INFO_LOCATION_HEADER, API_INFO_LOCATION).header(ORIGINATING_IDENTITY_HEADER, buildOriginatingIdentityHeader()).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isNotFound()).andExpect(jsonPath("$.description", containsString("task_10")));
}
Aggregations