use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method I_get_the_deployment_toology_for_the_current_application.
@When("^I get the deployment topology for the current application$")
public void I_get_the_deployment_toology_for_the_current_application() throws Throwable {
Application application = Context.getInstance().getApplication();
String environmentId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
String restUrl = String.format("/rest/v1/applications/%s/environments/%s/deployment-topology/", application.getId(), environmentId);
String response = Context.getRestClientInstance().get(restUrl);
Context.getInstance().registerRestResponse(response);
}
use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method executeUpdateDeploymentTopologyCall.
private void executeUpdateDeploymentTopologyCall(UpdateDeploymentTopologyRequest request) throws IOException {
Application application = Context.getInstance().getApplication();
String envId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
String restUrl = String.format("/rest/v1/applications/%s/environments/%s/deployment-topology", application.getId(), envId);
String response = Context.getRestClientInstance().putJSon(restUrl, JsonUtil.toString(request));
Context.getInstance().registerRestResponse(response);
}
use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method I_Set_the_following_location_policies_for_groups.
@When("^I Set the following location policies with orchestrator \"([^\"]*)\" for groups$")
public void I_Set_the_following_location_policies_for_groups(String orchestratorName, Map<String, String> locationPolicies) throws Throwable {
SetLocationPoliciesRequest request = new SetLocationPoliciesRequest();
String orchestratorId = Context.getInstance().getOrchestratorId(orchestratorName);
request.setOrchestratorId(orchestratorId);
Map<String, String> formatedPolicies = Maps.newHashMap();
for (Entry<String, String> entry : locationPolicies.entrySet()) {
formatedPolicies.put(entry.getKey(), Context.getInstance().getLocationId(orchestratorId, entry.getValue()));
}
request.setGroupsToLocations(formatedPolicies);
Application application = Context.getInstance().getApplication();
String environmentId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
String restUrl = String.format("/rest/v1/applications/%s/environments/%s/deployment-topology/location-policies", application.getId(), environmentId);
String response = Context.getRestClientInstance().postJSon(restUrl, JsonUtil.toString(request));
Context.getInstance().registerRestResponse(response);
}
use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method iUploadAFileLocatedAtForTheInputArtifact.
@When("^I upload a file located at \"([^\"]*)\" for the input artifact \"([^\"]*)\"$")
public void iUploadAFileLocatedAtForTheInputArtifact(String localFile, String inputArtifactName) throws Throwable {
Application application = Context.getInstance().getApplication();
String envId = Context.getInstance().getDefaultApplicationEnvironmentId(application.getName());
String url = String.format("/rest/applications/%s/environments/%s/deployment-topology/inputArtifacts/%s/upload", application.getId(), envId, inputArtifactName);
Context.getInstance().registerRestResponse(Context.getRestClientInstance().postMultipart(url, Paths.get(localFile).getFileName().toString(), Files.newInputStream(Paths.get(localFile))));
}
use of alien4cloud.model.application.Application in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method i_update_the_capability_property_to_for_the_subtituted_node.
@When("^I update the capability \"(.*?)\" property \"(.*?)\" to \"(.*?)\" for the subtituted node \"(.*?)\"$")
public void i_update_the_capability_property_to_for_the_subtituted_node(String capabilityName, String propertyName, String propertyValue, String nodeName) throws Throwable {
Context context = Context.getInstance();
Application application = context.getApplication();
String envId = context.getDefaultApplicationEnvironmentId(application.getName());
UpdatePropertyRequest request = new UpdatePropertyRequest(propertyName, propertyValue);
String restUrl = String.format("/rest/v1/applications/%s/environments/%s/deployment-topology/substitutions/%s/capabilities/%s/properties", application.getId(), envId, nodeName, capabilityName);
String response = Context.getRestClientInstance().postJSon(restUrl, JsonUtil.toString(request));
context.registerRestResponse(response);
}
Aggregations