Fixing update when target specified
Updating ATs to fail when invalid status
This commit is contained in:
committed by
Alberto Ríos
parent
2ea9f15cd4
commit
3cfb342960
@@ -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<String, Object> 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<String, Object> 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) {
|
||||
|
||||
@@ -170,7 +170,18 @@ public class CloudFoundryAppDeployer implements AppDeployer, ResourceLoaderAware
|
||||
final Map<String, Object> environmentVariables =
|
||||
getApplicationEnvironment(request.getProperties(), request.getEnvironment());
|
||||
|
||||
return this.operations
|
||||
Map<String, String> 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)
|
||||
|
||||
Reference in New Issue
Block a user