@Test public void updateServiceInstanceFiltersPlansSucceeds() { setupCatalogService(); setupServiceInstanceService(UpdateServiceInstanceResponse.builder() .build()); client.patch().uri(buildCreateUpdateUrl()) .contentType(MediaType.APPLICATION_JSON) .syncBody(updateRequestBodyWithPlan) .accept(MediaType.APPLICATION_JSON) .exchange() .expectStatus().isOk() .expectBody() .json("{}"); UpdateServiceInstanceRequest actualRequest = verifyUpdateServiceInstance(); assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false); assertThat(actualRequest.getPlan().getId()).isEqualTo("plan-three-id"); assertHeaderValuesNotSet(actualRequest); }
@Test public void updateServiceInstanceFiltersPlansSucceeds() throws Exception { setupCatalogService(); setupServiceInstanceService(UpdateServiceInstanceResponse .builder() .build()); MvcResult mvcResult = mockMvc .perform(patch(buildCreateUpdateUrl()) .content(updateRequestBodyWithPlan) .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.getPlan().getId()).isEqualTo(actualRequest.getPlanId()); assertHeaderValuesNotSet(actualRequest); }
@Test public void updateServiceInstanceWithoutAsyncAndHeadersSucceeds() { 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); assertThat(actualRequest.getPlan()).isNull(); assertHeaderValuesNotSet(actualRequest); }
@Test public 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); }