use of alien4cloud.rest.application.model.UpdateApplicationEnvironmentRequest in project alien4cloud by alien4cloud.
the class ApplicationStepDefinitions method I_update_the_environment_named_to_use_cloud_for_application.
@When("^I update the environment named \"([^\"]*)\" to use cloud \"([^\"]*)\" for application \"([^\"]*)\"$")
public void I_update_the_environment_named_to_use_cloud_for_application(String envName, String cloudName, String appName) throws Throwable {
UpdateApplicationEnvironmentRequest appEnvRequest = new UpdateApplicationEnvironmentRequest();
// appEnvRequest.setCloudId(Context.getInstance().getCloudId(cloudName));
Assert.fail("Fix test");
String applicationId = Context.getInstance().getApplicationId(appName);
String applicationEnvironmentId = Context.getInstance().getApplicationEnvironmentId(appName, envName);
// send the update request
Context.getInstance().registerRestResponse(getRestClientInstance().putJSon("/rest/v1/applications/" + applicationId + "/environments/" + applicationEnvironmentId, JsonUtil.toString(appEnvRequest)));
}
use of alien4cloud.rest.application.model.UpdateApplicationEnvironmentRequest in project alien4cloud by alien4cloud.
the class ApplicationStepDefinitions method I_update_the_application_environment_named_with_values.
@When("^I update the application environment named \"([^\"]*)\" with values$")
public void I_update_the_application_environment_named_with_values(String applicationEnvironmentName, DataTable appEnvAttributeValues) throws Throwable {
UpdateApplicationEnvironmentRequest appEnvRequest = new UpdateApplicationEnvironmentRequest();
String attribute = null, attributeValue = null;
for (List<String> attributesToUpdate : appEnvAttributeValues.raw()) {
attribute = attributesToUpdate.get(0);
attributeValue = attributesToUpdate.get(1);
switch(attribute) {
case "name":
appEnvRequest.setName(attributeValue);
break;
case "description":
appEnvRequest.setDescription(attributeValue);
break;
case "environmentType":
appEnvRequest.setEnvironmentType(EnvironmentType.valueOf(attributeValue));
break;
case "currentVersionId":
appEnvRequest.setCurrentVersionId(attributeValue);
break;
default:
log.info("Attribute [ {} ] not found in ApplicationEnvironmentRequest object", attribute);
break;
}
}
String environmentId = Context.getInstance().getApplicationEnvironmentId(CURRENT_APPLICATION.getName(), applicationEnvironmentName);
// send the update request
Context.getInstance().registerRestResponse(getRestClientInstance().putJSon("/rest/v1/applications/" + CURRENT_APPLICATION.getId() + "/environments/" + environmentId, JsonUtil.toString(appEnvRequest)));
if (StringUtils.isNotBlank(appEnvRequest.getName())) {
Context.getInstance().registerApplicationEnvironmentId(CURRENT_APPLICATION.getId(), appEnvRequest.getName(), environmentId);
}
}
Aggregations