use of org.springframework.cloud.servicebroker.model.instance.UpdateServiceInstanceRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerResponseCodeTest method validateUpdateServiceInstanceWithResponseStatus.
private void validateUpdateServiceInstanceWithResponseStatus(UpdateServiceInstanceResponse response, HttpStatus expectedStatus) {
Mono<UpdateServiceInstanceResponse> responseMono;
if (response == null) {
responseMono = Mono.empty();
} else {
responseMono = Mono.just(response);
}
given(serviceInstanceService.updateServiceInstance(any(UpdateServiceInstanceRequest.class))).willReturn(responseMono);
UpdateServiceInstanceRequest updateRequest = UpdateServiceInstanceRequest.builder().serviceDefinitionId("service-definition-id").build();
ResponseEntity<UpdateServiceInstanceResponse> responseEntity = controller.updateServiceInstance(pathVariables, null, false, null, null, null, updateRequest).block();
assertThat(responseEntity).isNotNull();
assertThat(responseEntity.getStatusCode()).isEqualTo(expectedStatus);
assertThat(responseEntity.getBody()).isEqualTo(response);
}
use of org.springframework.cloud.servicebroker.model.instance.UpdateServiceInstanceRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerRequestTest method updateServiceInstanceParametersAreMappedToRequest.
@Test
void updateServiceInstanceParametersAreMappedToRequest() {
UpdateServiceInstanceRequest parsedRequest = buildUpdateRequest().build();
UpdateServiceInstanceRequest expectedRequest = buildUpdateRequest().asyncAccepted(true).serviceInstanceId("service-instance-id").platformInstanceId("platform-instance-id").apiInfoLocation("api-info-location").originatingIdentity(identityContext).requestIdentity("request-id").serviceDefinition(serviceDefinition).plan(plan).build();
ServiceInstanceController controller = createControllerUnderTest(expectedRequest);
controller.updateServiceInstance(pathVariables, "service-instance-id", true, "api-info-location", encodeOriginatingIdentity(identityContext), "request-id", parsedRequest).block();
}
use of org.springframework.cloud.servicebroker.model.instance.UpdateServiceInstanceRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerIntegrationTest method updateServiceInstanceWithoutAsyncAndHeadersSucceeds.
@Test
void updateServiceInstanceWithoutAsyncAndHeadersSucceeds() {
setupCatalogService();
setupServiceInstanceService(UpdateServiceInstanceResponse.builder().build());
client.patch().uri(buildCreateUpdateUrl()).contentType(MediaType.APPLICATION_JSON).bodyValue(updateRequestBody).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk().expectBody().json("{}");
UpdateServiceInstanceRequest actualRequest = verifyUpdateServiceInstance();
assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false);
assertThat(actualRequest.getPlan()).isNull();
assertHeaderValuesNotSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.instance.UpdateServiceInstanceRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerIntegrationTest method updateServiceInstanceWithoutSyncAndHeadersSucceeds.
@Test
void updateServiceInstanceWithoutSyncAndHeadersSucceeds() throws Exception {
setupCatalogService();
setupServiceInstanceService(UpdateServiceInstanceResponse.builder().build());
MvcResult mvcResult = mockMvc.perform(patch(buildCreateUpdateUrl()).content(updateRequestBody).contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON)).andExpect(request().asyncStarted()).andReturn();
mockMvc.perform(asyncDispatch(mvcResult)).andExpect(status().isOk()).andExpect(content().string("{}"));
UpdateServiceInstanceRequest actualRequest = verifyUpdateServiceInstance();
assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false);
assertThat(actualRequest.getServiceDefinition().getPlans().size()).isEqualTo(3);
assertThat(actualRequest.getPlan()).isNull();
assertHeaderValuesNotSet(actualRequest);
}
use of org.springframework.cloud.servicebroker.model.instance.UpdateServiceInstanceRequest in project spring-cloud-open-service-broker by spring-cloud.
the class ServiceInstanceControllerIntegrationTest method updateServiceInstanceWithoutSyncAndHeadersSucceeds.
@Test
public void updateServiceInstanceWithoutSyncAndHeadersSucceeds() {
setupCatalogService();
setupServiceInstanceService(UpdateServiceInstanceResponse.builder().build());
client.patch().uri(buildCreateUpdateUrl()).contentType(MediaType.APPLICATION_JSON).syncBody(updateRequestBody).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk().expectBody().json("{}");
UpdateServiceInstanceRequest actualRequest = verifyUpdateServiceInstance();
assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false);
assertHeaderValuesNotSet(actualRequest);
}
Aggregations