use of alien4cloud.it.Context 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 alien4cloud.it.Context 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 alien4cloud.it.Context in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method I_substitute_on_the_current_application_the_policy_with_the_location_resource.
@When("^I substitute on the current application the policy \"(.*?)\" with the location resource \"(.*?)\"/\"(.*?)\"/\"(.*?)\"$")
public void I_substitute_on_the_current_application_the_policy_with_the_location_resource(String policyName, 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);
doPolicySubstitution(policyName, resourceId);
}
use of alien4cloud.it.Context in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method The_deployment_topology_shoud_have_the_following_location_policies.
@Then("^the deployment topology shoud have the following location policies$")
public void The_deployment_topology_shoud_have_the_following_location_policies(DataTable expectedSettings) throws Throwable {
String response = Context.getInstance().getRestResponse();
RestResponse<DeploymentTopologyDTO> deploymentTopologyDTO = JsonUtil.read(response, DeploymentTopologyDTO.class, Context.getJsonMapper());
assertNotNull(deploymentTopologyDTO.getData());
Map<String, String> policies = deploymentTopologyDTO.getData().getLocationPolicies();
assertNotNull(policies);
Context context = Context.getInstance();
List<LocationPolicySetting> expectedLocationPoliciesSettings = convert(expectedSettings);
for (LocationPolicySetting expected : expectedLocationPoliciesSettings) {
String expectLocationId = context.getLocationId(context.getOrchestratorId(expected.getOrchestratorName()), expected.getLocationName());
assertEquals(expectLocationId, policies.get(expected.getGroupName()));
}
}
use of alien4cloud.it.Context in project alien4cloud by alien4cloud.
the class DeploymentTopologyStepDefinitions method updateProperty.
private void updateProperty(String propertyName, Object propertyValue, String nodeName, String endpoint) throws IOException {
Context context = Context.getInstance();
Application application = context.getApplication();
String envId = context.getDefaultApplicationEnvironmentId(application.getName());
UpdatePropertyRequest request = new UpdatePropertyRequest(propertyName, propertyValue);
String restUrl = String.format(endpoint, application.getId(), envId, nodeName);
String response = Context.getRestClientInstance().postJSon(restUrl, JsonUtil.toString(request));
context.registerRestResponse(response);
}
Aggregations