@Test public void createBindingToRouteFiltersPlansSucceeds() throws Exception { setupCatalogService(); setupServiceInstanceBindingService(CreateServiceInstanceRouteBindingResponse .builder() .bindingExisted(false) .build()); client.put().uri(buildCreateUrl()) .contentType(MediaType.APPLICATION_JSON) .syncBody(createRequestBody) .accept(MediaType.APPLICATION_JSON) .exchange() .expectStatus().isCreated(); CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding(); assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false); assertThat(actualRequest.getPlan().getId()).isEqualTo(actualRequest.getPlanId()); assertHeaderValuesNotSet(actualRequest); }
@Test public void createBindingToAppFiltersPlansSucceeds() throws Exception { setupCatalogService(); setupServiceInstanceBindingService(CreateServiceInstanceAppBindingResponse .builder() .bindingExisted(false) .build()); client.put().uri(buildCreateUrl(PLATFORM_INSTANCE_ID, false)) .contentType(MediaType.APPLICATION_JSON) .syncBody(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); }
@Test public 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); }