use of cucumber.api.java.en.When 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 cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method I_substitute_on_the_current_application_the_node_with_the_location_resource.
@When("^I substitute on the current application the node \"(.*?)\" with the location resource \"(.*?)\"/\"(.*?)\"/\"(.*?)\"$")
public void I_substitute_on_the_current_application_the_node_with_the_location_resource(String nodeName, String orchestratorName, String locationName, String resourceName) throws Throwable {
Context context = Context.getInstance();
String orchestratorId = context.getOrchestratorId(orchestratorName);
String locationId = context.getLocationId(orchestratorId, locationName);
String resourceId = context.getLocationResourceId(orchestratorId, locationId, resourceName);
doNodeSubstitution(nodeName, resourceId);
}
use of cucumber.api.java.en.When 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 cucumber.api.java.en.When 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);
}
use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method I_set_the_following_inputs_properties.
@When("^I set the following inputs properties$")
public void I_set_the_following_inputs_properties(Map<String, Object> inputProperties) throws Throwable {
UpdateDeploymentTopologyRequest request = new UpdateDeploymentTopologyRequest();
request.setInputProperties(parseAndReplaceProperties(inputProperties));
executeUpdateDeploymentTopologyCall(request);
}
Aggregations