@Test public void createBindingToAppWithAsyncAndHeadersSucceeds() throws Exception { setupCatalogService(); setupServiceInstanceBindingService(CreateServiceInstanceAppBindingResponse.builder() .async(true) .operation("working") .bindingExisted(false) .build()); 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", equalTo("working"))); CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding(); assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true); assertHeaderValuesSet(actualRequest); }
@Test public void createBindingToAppWithAsyncAndHeadersSucceeds() throws Exception { setupCatalogService(); setupServiceInstanceBindingService(CreateServiceInstanceAppBindingResponse.builder() .async(true) .operation("working") .bindingExisted(false) .build()); client.put().uri(buildCreateUrl(PLATFORM_INSTANCE_ID, true)) .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().isAccepted() .expectBody() .jsonPath("$.operation").isEqualTo("working"); CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding(); assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true); assertHeaderValuesSet(actualRequest); }