diff --git a/spring-cloud-app-broker-acceptance-tests/src/test/java/org.springframework.cloud.appbroker.acceptance/CloudFoundryAcceptanceTest.java b/spring-cloud-app-broker-acceptance-tests/src/test/java/org.springframework.cloud.appbroker.acceptance/CloudFoundryAcceptanceTest.java index 9205b1d..3512a6d 100644 --- a/spring-cloud-app-broker-acceptance-tests/src/test/java/org.springframework.cloud.appbroker.acceptance/CloudFoundryAcceptanceTest.java +++ b/spring-cloud-app-broker-acceptance-tests/src/test/java/org.springframework.cloud.appbroker.acceptance/CloudFoundryAcceptanceTest.java @@ -41,7 +41,6 @@ import org.cloudfoundry.uaa.clients.GetClientResponse; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.extension.ExtendWith; -import org.springframework.cloud.appbroker.acceptance.fixtures.uaa.UaaService; import reactor.core.publisher.Flux; import reactor.core.publisher.Mono; @@ -50,6 +49,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.appbroker.acceptance.fixtures.cf.CloudFoundryClientConfiguration; import org.springframework.cloud.appbroker.acceptance.fixtures.cf.CloudFoundryService; +import org.springframework.cloud.appbroker.acceptance.fixtures.uaa.UaaService; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.web.client.RestTemplate; @@ -146,23 +146,23 @@ class CloudFoundryAcceptanceTest { String planName, String serviceInstanceName, Map parameters) { - blockingSubscribe( - cloudFoundryService.createServiceInstance(planName, serviceName, serviceInstanceName, parameters) - .then(getServiceInstanceMono(serviceInstanceName)) - .flatMap(serviceInstance -> { - assertThat(serviceInstance.getStatus()).isEqualTo("succeeded"); - return Mono.empty(); - })); + cloudFoundryService.createServiceInstance(planName, serviceName, serviceInstanceName, parameters) + .then(getServiceInstanceMono(serviceInstanceName)) + .flatMap(serviceInstance -> { + assertThat(serviceInstance.getStatus()).isEqualTo("succeeded"); + return Mono.empty(); + }) + .block(); } void updateServiceInstance(String serviceInstanceName, Map parameters) { - blockingSubscribe( - cloudFoundryService.updateServiceInstance(serviceInstanceName, parameters) - .then(getServiceInstanceMono(serviceInstanceName)) - .flatMap(serviceInstance -> { - assertThat(serviceInstance.getStatus()).isEqualTo("succeeded"); - return Mono.empty(); - })); + cloudFoundryService.updateServiceInstance(serviceInstanceName, parameters) + .then(getServiceInstanceMono(serviceInstanceName)) + .flatMap(serviceInstance -> { + assertThat(serviceInstance.getStatus()).isEqualTo("succeeded"); + return Mono.empty(); + }) + .block(); } void deleteServiceInstance(String serviceInstanceName) { diff --git a/spring-cloud-app-broker-deployer-cloudfoundry/src/main/java/org/springframework/cloud/appbroker/deployer/cloudfoundry/CloudFoundryAppDeployer.java b/spring-cloud-app-broker-deployer-cloudfoundry/src/main/java/org/springframework/cloud/appbroker/deployer/cloudfoundry/CloudFoundryAppDeployer.java index ddce744..2a5c911 100644 --- a/spring-cloud-app-broker-deployer-cloudfoundry/src/main/java/org/springframework/cloud/appbroker/deployer/cloudfoundry/CloudFoundryAppDeployer.java +++ b/spring-cloud-app-broker-deployer-cloudfoundry/src/main/java/org/springframework/cloud/appbroker/deployer/cloudfoundry/CloudFoundryAppDeployer.java @@ -170,7 +170,18 @@ public class CloudFoundryAppDeployer implements AppDeployer, ResourceLoaderAware final Map environmentVariables = getApplicationEnvironment(request.getProperties(), request.getEnvironment()); - return this.operations + Map deploymentProperties = request.getProperties(); + CloudFoundryOperations operations; + + if (deploymentProperties.containsKey(DeploymentProperties.TARGET_PROPERTY_KEY)) { + String space = deploymentProperties.get(DeploymentProperties.TARGET_PROPERTY_KEY); + operations = createCloudFoundryOperationsForSpace(space); + } + else { + operations = this.operations; + } + + return operations .applications() .get(GetApplicationRequest.builder().name(name).build()) .map(ApplicationDetail::getId)