Search in sources :

Example 41 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_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);
}
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 42 with When

use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.

the class DeploymentTopologyStepDefinitions method iUpdateThePropertyToASecretWithASecretPathForTheSubstitutedPolicy.

@When("^I update the property \"([^\"]*)\" to a secret with a secret path \"([^\"]*)\" for the substituted policy \"([^\"]*)\"$")
public void iUpdateThePropertyToASecretWithASecretPathForTheSubstitutedPolicy(String propertyName, String secretPath, String nodeName) throws Throwable {
    FunctionPropertyValue propertyValue = new FunctionPropertyValue();
    propertyValue.setFunction(ToscaFunctionConstants.GET_SECRET);
    propertyValue.setParameters(Arrays.asList(secretPath));
    updateProperty(propertyName, propertyValue, nodeName, "/rest/v1/applications/%s/environments/%s/deployment-topology/policies/%s/substitution/properties");
}
Also used : FunctionPropertyValue(org.alien4cloud.tosca.model.definitions.FunctionPropertyValue) When(cucumber.api.java.en.When)

Example 43 with When

use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.

the class InputPropertiesStepDefinitions method I_define_the_property_of_the_node_as_of_typeId_as_input_property.

@When("^I define the property \"([^\"]*)\" of the node \"([^\"]*)\" of typeId \"([^\"]*)\" as input property$")
public void I_define_the_property_of_the_node_as_of_typeId_as_input_property(String inputId, String nodeName, String typeId) throws Throwable {
    // get the component to use the right property definition
    String componentResponse = Context.getRestClientInstance().get("/rest/v1/components/" + typeId);
    RestResponse<NodeType> componentResult = JsonUtil.read(componentResponse, NodeType.class, Context.getJsonMapper());
    PropertyDefinition propertyDefinition = componentResult.getData().getProperties().get(inputId);
    String fullUrl = String.format("/rest/v1/topologies/%s/inputs/%s", Context.getInstance().getTopologyId(), inputId);
    String json = JsonUtil.toString(propertyDefinition);
    Context.getInstance().registerRestResponse(Context.getRestClientInstance().postJSon(fullUrl, json));
}
Also used : NodeType(org.alien4cloud.tosca.model.types.NodeType) PropertyDefinition(org.alien4cloud.tosca.model.definitions.PropertyDefinition) When(cucumber.api.java.en.When)

Example 44 with When

use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.

the class InputPropertiesStepDefinitions method I_define_the_property_of_the_node_as_input_property.

@When("^I define the property \"([^\"]*)\" of the node \"([^\"]*)\" as input property$")
public void I_define_the_property_of_the_node_as_input_property(String inputId, String nodeName) throws Throwable {
    // get the topologyTDO to have the real type of the propertyDefinition
    PropertyDefinition propertyDefinition = getPropertyDefinition(nodeName, inputId);
    AddInputOperation addInputOperation = new AddInputOperation();
    addInputOperation.setPropertyDefinition(propertyDefinition);
    addInputOperation.setInputName(inputId);
    EditorStepDefinitions.do_i_execute_the_operation(addInputOperation);
    SetNodePropertyAsInputOperation setNodePropertyAsInputOperation = new SetNodePropertyAsInputOperation();
    setNodePropertyAsInputOperation.setInputName(inputId);
    setNodePropertyAsInputOperation.setPropertyName(inputId);
    setNodePropertyAsInputOperation.setNodeName(nodeName);
    EditorStepDefinitions.do_i_execute_the_operation(setNodePropertyAsInputOperation);
    EditorStepDefinitions.do_i_save_the_topology();
}
Also used : AddInputOperation(org.alien4cloud.tosca.editor.operations.inputs.AddInputOperation) SetNodePropertyAsInputOperation(org.alien4cloud.tosca.editor.operations.nodetemplate.inputs.SetNodePropertyAsInputOperation) PropertyDefinition(org.alien4cloud.tosca.model.definitions.PropertyDefinition) When(cucumber.api.java.en.When)

Example 45 with When

use of cucumber.api.java.en.When in project alien4cloud by alien4cloud.

the class SecretPropertiesStepDefinitions method iDefineThePropertyOfCapabilityOfTheNodeAsSecretWithASecretPath.

@When("^I define the property \"([^\"]*)\" of capability \"([^\"]*)\" of the node \"([^\"]*)\" as secret with a secret path \"([^\"]*)\"$")
public void iDefineThePropertyOfCapabilityOfTheNodeAsSecretWithASecretPath(String propertyName, String capabilityName, String nodeName, String secretPath) throws Throwable {
    SetNodeCapabilityPropertyAsSecretOperation operation = new SetNodeCapabilityPropertyAsSecretOperation();
    operation.setNodeName(nodeName);
    operation.setPropertyName(propertyName);
    operation.setSecretPath(secretPath);
    operation.setCapabilityName(capabilityName);
    EditorStepDefinitions.do_i_execute_the_operation(operation);
}
Also used : SetNodeCapabilityPropertyAsSecretOperation(org.alien4cloud.tosca.editor.operations.secrets.SetNodeCapabilityPropertyAsSecretOperation) 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