Search in sources :

Example 36 with When

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);
}
Also used : SetLocationPoliciesRequest(alien4cloud.rest.application.model.SetLocationPoliciesRequest) Application(alien4cloud.model.application.Application) When(cucumber.api.java.en.When)

Example 37 with When

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);
}
Also used : EvaluationContext(org.springframework.expression.EvaluationContext) Context(alien4cloud.it.Context) StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) When(cucumber.api.java.en.When)

Example 38 with When

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))));
}
Also used : Application(alien4cloud.model.application.Application) When(cucumber.api.java.en.When)

Example 39 with When

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);
}
Also used : EvaluationContext(org.springframework.expression.EvaluationContext) Context(alien4cloud.it.Context) StandardEvaluationContext(org.springframework.expression.spel.support.StandardEvaluationContext) UpdatePropertyRequest(alien4cloud.rest.topology.UpdatePropertyRequest) Application(alien4cloud.model.application.Application) When(cucumber.api.java.en.When)

Example 40 with When

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);
}
Also used : UpdateDeploymentTopologyRequest(alien4cloud.rest.application.model.UpdateDeploymentTopologyRequest) When(cucumber.api.java.en.When)

Aggregations

When (cucumber.api.java.en.When)161 TestUtils.nullAsString (alien4cloud.it.utils.TestUtils.nullAsString)12 Application (alien4cloud.model.application.Application)10 FlowPayload (org.openkilda.messaging.payload.flow.FlowPayload)9 Response (com.jayway.restassured.response.Response)7 IOException (java.io.IOException)6 List (java.util.List)6 StandardEvaluationContext (org.springframework.expression.spel.support.StandardEvaluationContext)6 FilteredSearchRequest (alien4cloud.rest.model.FilteredSearchRequest)5 Then (cucumber.api.java.en.Then)5 Collectors (java.util.stream.Collectors)5 Action (org.talend.dataprep.helper.api.Action)5 ComponentSearchRequest (alien4cloud.rest.component.ComponentSearchRequest)4 TopologyDTO (alien4cloud.topology.TopologyDTO)4 Path (java.nio.file.Path)4 HashMap (java.util.HashMap)4 UiApplicationDriver (org.activityinfo.test.driver.UiApplicationDriver)4 PivotTableEditor (org.activityinfo.test.pageobject.web.reports.PivotTableEditor)4 IslInfoData (org.openkilda.messaging.info.event.IslInfoData)4 WebElement (org.openqa.selenium.WebElement)4