Search in sources :

Example 16 with CreateServiceInstanceRequest

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

the class ServiceInstanceControllerRequestTest method createServiceInstanceWithInvalidPlanIdThrowsException.

@Test
void createServiceInstanceWithInvalidPlanIdThrowsException() {
    CreateServiceInstanceRequest createRequest = CreateServiceInstanceRequest.builder().serviceDefinitionId("service-definition-id").planId("unknown-plan-id").build();
    ServiceInstanceController controller = createControllerUnderTest();
    assertThrows(ServiceDefinitionPlanDoesNotExistException.class, () -> controller.createServiceInstance(pathVariables, null, false, null, null, null, createRequest).block());
}
Also used : CreateServiceInstanceRequest(org.springframework.cloud.servicebroker.model.instance.CreateServiceInstanceRequest) Test(org.junit.jupiter.api.Test)

Example 17 with CreateServiceInstanceRequest

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

the class ServiceInstanceControllerRequestTest method createServiceInstanceParametersAreMappedToRequest.

@Test
void createServiceInstanceParametersAreMappedToRequest() {
    CreateServiceInstanceRequest parsedRequest = buildCreateRequest().build();
    CreateServiceInstanceRequest expectedRequest = buildCreateRequest().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.createServiceInstance(pathVariables, "service-instance-id", true, "api-info-location", encodeOriginatingIdentity(identityContext), "request-id", parsedRequest).block();
}
Also used : CreateServiceInstanceRequest(org.springframework.cloud.servicebroker.model.instance.CreateServiceInstanceRequest) Test(org.junit.jupiter.api.Test)

Aggregations

CreateServiceInstanceRequest (org.springframework.cloud.servicebroker.model.instance.CreateServiceInstanceRequest)17 Test (org.junit.jupiter.api.Test)15 AbstractServiceInstanceControllerIntegrationTest (org.springframework.cloud.servicebroker.autoconfigure.web.AbstractServiceInstanceControllerIntegrationTest)12 MvcResult (org.springframework.test.web.servlet.MvcResult)6 StringContains.containsString (org.hamcrest.core.StringContains.containsString)2 ServiceBrokerCreateOperationInProgressException (org.springframework.cloud.servicebroker.exception.ServiceBrokerCreateOperationInProgressException)2 CreateServiceInstanceResponse (org.springframework.cloud.servicebroker.model.instance.CreateServiceInstanceResponse)2 Theory (org.junit.experimental.theories.Theory)1