Search in sources :

Example 6 with Action

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

the class OSIntegrationTestUtilTest method mapParamsToActionEmpty.

@Test
public void mapParamsToActionEmpty() {
    Action action = new Action();
    action.parameters = util.mapParamsToActionParameters(new HashMap<>());
    assertEquals(null, action.id);
    assertEquals(null, action.action);
    assertEquals("column", action.parameters.get("scope"));
}
Also used : Action(org.talend.dataprep.helper.api.Action) HashMap(java.util.HashMap) Test(org.junit.Test)

Example 7 with Action

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

the class ActionStep method whenIAddAStepToAPreparation.

@When("^I add a \"(.*)\" step on the preparation \"(.*)\" with parameters :$")
public void whenIAddAStepToAPreparation(String actionName, String preparationName, DataTable dataTable) {
    Map<String, String> params = dataTable.asMap(String.class, String.class);
    String prepId = context.getPreparationId(suffixName(preparationName));
    Action action = new Action();
    action.action = actionName;
    action.parameters.putAll(util.mapParamsToActionParameters(params));
    api.addAction(prepId, action);
}
Also used : Action(org.talend.dataprep.helper.api.Action) When(cucumber.api.java.en.When)

Example 8 with Action

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

the class ActionStep method removeFirstActionFoundWithName.

@Given("I remove the first action with name \"(.*)\" on the preparation \"(.*)\"")
public void removeFirstActionFoundWithName(String actionName, String prepName) throws IOException {
    String prepId = context.getPreparationId(suffixName(prepName));
    Action foundAction = getFirstActionWithName(prepId, actionName);
    Assert.assertTrue(foundAction != null);
    // Remove action
    Response response = api.deleteAction(prepId, foundAction.id);
    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 9 with Action

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

the class ActionStep method getActionsFromStoredAction.

/**
 * Recover a list of {@link Action} corresponding to a stored {@link Action} type in a given preparation.
 *
 * @param preparationId the preparation id.
 * @param storedAction the stored {@link Action} type.
 * @return a {@link List} of {@link Action} that looks like the given storedAction.
 * @throws IOException
 */
private List<Action> getActionsFromStoredAction(String preparationId, Action storedAction) throws IOException {
    PreparationDetails prepDet = getPreparationDetails(preparationId);
    prepDet.updateActionIds();
    return prepDet.actions.stream().filter(action -> // 
    action.action.equals(storedAction.action) && // 
    action.parameters.equals(storedAction.parameters)).collect(Collectors.toList());
}
Also used : And(cucumber.api.java.en.And) Logger(org.slf4j.Logger) FeatureContext.suffixName(org.talend.dataprep.qa.config.FeatureContext.suffixName) LoggerFactory(org.slf4j.LoggerFactory) IOException(java.io.IOException) HashMap(java.util.HashMap) Collectors(java.util.stream.Collectors) Response(com.jayway.restassured.response.Response) Action(org.talend.dataprep.helper.api.Action) List(java.util.List) DataPrepStep(org.talend.dataprep.qa.config.DataPrepStep) Map(java.util.Map) PreparationDetails(org.talend.dataprep.qa.dto.PreparationDetails) Given(cucumber.api.java.en.Given) Assert(org.junit.Assert) Then(cucumber.api.java.en.Then) When(cucumber.api.java.en.When) DataTable(cucumber.api.DataTable) PreparationDetails(org.talend.dataprep.qa.dto.PreparationDetails)

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