Search in sources :

Example 16 with CreateServiceInstanceBindingRequest

use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToAppWithExistingSucceeds.

@Test
void createBindingToAppWithExistingSucceeds() {
    setupCatalogService();
    setupServiceInstanceBindingService(CreateServiceInstanceAppBindingResponse.builder().bindingExisted(true).build());
    client.put().uri(buildCreateUrl()).contentType(MediaType.APPLICATION_JSON).bodyValue(createRequestBody).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isOk();
    CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
    assertHeaderValuesNotSet(actualRequest);
}
Also used : CreateServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 17 with CreateServiceInstanceBindingRequest

use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToRouteFiltersPlansSucceeds.

@Test
void createBindingToRouteFiltersPlansSucceeds() {
    setupCatalogService();
    setupServiceInstanceBindingService(CreateServiceInstanceRouteBindingResponse.builder().bindingExisted(false).build());
    client.put().uri(buildCreateUrl()).contentType(MediaType.APPLICATION_JSON).bodyValue(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);
}
Also used : CreateServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 18 with CreateServiceInstanceBindingRequest

use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToRouteWithoutAsyncAndHeadersSucceeds.

@Test
void createBindingToRouteWithoutAsyncAndHeadersSucceeds() {
    setupCatalogService();
    setupServiceInstanceBindingService(CreateServiceInstanceRouteBindingResponse.builder().bindingExisted(false).build());
    client.put().uri(buildCreateUrl()).contentType(MediaType.APPLICATION_JSON).bodyValue(createRequestBody).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isCreated();
    CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
    assertThat(actualRequest.isAsyncAccepted()).isEqualTo(false);
    assertHeaderValuesNotSet(actualRequest);
}
Also used : CreateServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 19 with CreateServiceInstanceBindingRequest

use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerIntegrationTest method createBindingToRouteWithAsyncAndHeadersSucceeds.

@Test
void createBindingToRouteWithAsyncAndHeadersSucceeds() {
    setupCatalogService();
    setupServiceInstanceBindingService(CreateServiceInstanceRouteBindingResponse.builder().async(true).operation("working").bindingExisted(false).build());
    client.put().uri(buildCreateUrl(null, true)).contentType(MediaType.APPLICATION_JSON).bodyValue(createRequestBody).accept(MediaType.APPLICATION_JSON).exchange().expectStatus().isAccepted().expectBody().jsonPath("$.operation").isEqualTo("working");
    CreateServiceInstanceBindingRequest actualRequest = verifyCreateBinding();
    assertThat(actualRequest.isAsyncAccepted()).isEqualTo(true);
    assertHeaderValuesNotSet(actualRequest);
}
Also used : CreateServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest) AbstractServiceInstanceBindingControllerIntegrationTest(org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest) Test(org.junit.jupiter.api.Test)

Example 20 with CreateServiceInstanceBindingRequest

use of org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest in project spring-cloud-open-service-broker by spring-cloud.

the class ServiceInstanceBindingControllerRequestTest method createServiceBindingParametersAreMappedToRequest.

@Test
void createServiceBindingParametersAreMappedToRequest() {
    CreateServiceInstanceBindingRequest parsedRequest = buildCreateRequest().build();
    CreateServiceInstanceBindingRequest expectedRequest = buildCreateRequest().asyncAccepted(true).serviceInstanceId("service-instance-id").bindingId("binding-id").serviceDefinition(serviceDefinition).plan(plan).platformInstanceId("platform-instance-id").apiInfoLocation("api-info-location").originatingIdentity(identityContext).requestIdentity("request-id").build();
    ServiceInstanceBindingController controller = createControllerUnderTest(expectedRequest);
    controller.createServiceInstanceBinding(pathVariables, "service-instance-id", "binding-id", true, "api-info-location", encodeOriginatingIdentity(identityContext), "request-id", parsedRequest);
}
Also used : CreateServiceInstanceBindingRequest(org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest) Test(org.junit.jupiter.api.Test)

Aggregations

CreateServiceInstanceBindingRequest (org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingRequest)21 Test (org.junit.jupiter.api.Test)16 AbstractServiceInstanceBindingControllerIntegrationTest (org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceBindingControllerIntegrationTest)15 MvcResult (org.springframework.test.web.servlet.MvcResult)6 Test (org.junit.Test)2 CreateServiceInstanceBindingResponse (org.springframework.cloud.servicebroker.model.binding.CreateServiceInstanceBindingResponse)2 Theory (org.junit.experimental.theories.Theory)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1