Search in sources :

Example 1 with Action

use of org.talend.dataprep.helper.api.Action in project data-prep by Talend.

the class ActionStep method existStep.

@Given("^I check that a step like \"(.*)\" exists in the preparation \"(.*)\"$")
public void existStep(String stepAlias, String prepFullName) throws IOException {
    String prepSuffixedName = suffixName(util.extractNameFromFullName(prepFullName));
    String prepPath = util.extractPathFromFullName(prepFullName);
    String prepId = context.getPreparationId(prepSuffixedName, prepPath);
    Action storedAction = context.getAction(stepAlias);
    List<Action> actions = getActionsFromStoredAction(prepId, storedAction);
    Assert.assertTrue(actions.contains(storedAction));
}
Also used : Action(org.talend.dataprep.helper.api.Action) Given(cucumber.api.java.en.Given)

Example 2 with Action

use of org.talend.dataprep.helper.api.Action in project data-prep by Talend.

the class ActionStep method updateStep.

@Then("^I update the first step like \"(.*)\" on the preparation \"(.*)\" with the following parameters :$")
public void updateStep(String stepName, String prepName, DataTable dataTable) throws IOException {
    Map<String, String> params = dataTable.asMap(String.class, String.class);
    String prepId = context.getPreparationId(suffixName(prepName));
    Action storedAction = context.getAction(stepName);
    Assert.assertTrue(storedAction != null);
    List<Action> actions = getActionsFromStoredAction(prepId, storedAction);
    Assert.assertTrue(actions.size() > 0);
    // update stored action parameters
    storedAction.parameters.putAll(util.mapParamsToActionParameters(params));
    storedAction.id = actions.get(0).id;
    Response response = api.updateAction(prepId, storedAction.id, storedAction);
    response.then().statusCode(200);
}
Also used : Response(com.jayway.restassured.response.Response) Action(org.talend.dataprep.helper.api.Action) Then(cucumber.api.java.en.Then)

Example 3 with Action

use of org.talend.dataprep.helper.api.Action in project data-prep by Talend.

the class ActionStep method moveStep.

/**
 * Try to move a step after another step called parentStep.
 *
 * @param stepName the step to move.
 * @param parentStepName the parent step.
 * @param prepName the preparation name.
 * @return the response.
 * @throws IOException
 */
private Response moveStep(String stepName, String parentStepName, String prepName) throws IOException {
    String prepId = context.getPreparationId(prepName);
    Action action = getActionsFromStoredAction(prepId, context.getAction(stepName)).get(0);
    Action parentAction = getActionsFromStoredAction(prepId, context.getAction(parentStepName)).get(0);
    return api.moveAction(prepId, action.id, parentAction.id);
}
Also used : Action(org.talend.dataprep.helper.api.Action)

Example 4 with Action

use of org.talend.dataprep.helper.api.Action in project data-prep by Talend.

the class ActionStep method updateFirstActionFoundWithName.

@Given("I update the first action with name \"(.*)\" on the preparation \"(.*)\" with the following parameters :")
public void updateFirstActionFoundWithName(String actionName, String prepName, DataTable dataTable) throws IOException {
    Map<String, String> params = dataTable.asMap(String.class, String.class);
    String prepId = context.getPreparationId(suffixName(prepName));
    Action foundAction = getFirstActionWithName(prepId, actionName);
    Assert.assertTrue(foundAction != null);
    // Update action
    Action action = new Action();
    action.action = actionName;
    action.id = foundAction.id;
    action.parameters = new HashMap<>(foundAction.parameters);
    action.parameters.putAll(util.mapParamsToActionParameters(params));
    Response response = api.updateAction(prepId, action.id, action);
    response.then().statusCode(200);
}
Also used : Response(com.jayway.restassured.response.Response) Action(org.talend.dataprep.helper.api.Action) Given(cucumber.api.java.en.Given)

Example 5 with Action

use of org.talend.dataprep.helper.api.Action in project data-prep by Talend.

the class ActionStep method whenIAddAStepWithAliasToAPreparation.

@When("^I add a \"(.*)\" step identified by \"(.*)\" on the preparation \"(.*)\" with parameters :$")
public void whenIAddAStepWithAliasToAPreparation(String actionName, String stepAlias, String preparationName, DataTable dataTable) throws IOException {
    // step creation
    whenIAddAStepToAPreparation(actionName, preparationName, dataTable);
    // we recover the preparation details in order to get an action object with the step Id
    String prepId = context.getPreparationId(suffixName(preparationName));
    Action action = getLastActionfromPreparation(prepId);
    context.storeAction(stepAlias, action);
}
Also used : Action(org.talend.dataprep.helper.api.Action) When(cucumber.api.java.en.When)

Aggregations

Action (org.talend.dataprep.helper.api.Action)9 Response (com.jayway.restassured.response.Response)4 Given (cucumber.api.java.en.Given)4 When (cucumber.api.java.en.When)3 Then (cucumber.api.java.en.Then)2 HashMap (java.util.HashMap)2 DataTable (cucumber.api.DataTable)1 And (cucumber.api.java.en.And)1 IOException (java.io.IOException)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 Assert (org.junit.Assert)1 Test (org.junit.Test)1 Logger (org.slf4j.Logger)1 LoggerFactory (org.slf4j.LoggerFactory)1 DataPrepStep (org.talend.dataprep.qa.config.DataPrepStep)1 FeatureContext.suffixName (org.talend.dataprep.qa.config.FeatureContext.suffixName)1 PreparationDetails (org.talend.dataprep.qa.dto.PreparationDetails)1