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));
}
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);
}
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);
}
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);
}
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);
}
Aggregations