use of org.talend.dataprep.qa.dto.PreparationDetails in project data-prep by Talend.
the class ActionStep method getLastActionfromPreparation.
/**
* Get the last {@link Action} from a preparation.
*
* @param preparationId the preparation id.
* @return the last preparation {@link Action}.
* @throws IOException
*/
private Action getLastActionfromPreparation(String preparationId) throws IOException {
PreparationDetails prepDet = getPreparationDetails(preparationId);
prepDet.updateActionIds();
return prepDet.actions.get(prepDet.actions.size() - 1);
}
use of org.talend.dataprep.qa.dto.PreparationDetails in project data-prep by Talend.
the class ActionStep method getFirstActionWithName.
private Action getFirstActionWithName(String preparationId, String actionName) throws IOException {
PreparationDetails prepDet = getPreparationDetails(preparationId);
prepDet.updateActionIds();
return prepDet.actions.stream().filter(//
action -> action.action.equals(actionName)).findFirst().get();
}
use of org.talend.dataprep.qa.dto.PreparationDetails in project data-prep by Talend.
the class PreparationStep method registerExistingPreparation.
@When("^I load the existing preparation called \"(.*)\"$")
public void registerExistingPreparation(String preparationFullname) throws IOException {
String preparationName = util.extractNameFromFullName(preparationFullname);
String prepPath = util.extractPathFromFullName(preparationFullname);
Folder prepFolder = folderUtil.searchFolder(prepPath);
FolderContent folderContent = folderUtil.listPreparation(prepPath);
if (folderContent != null) {
List<PreparationDetails> preparations = //
folderContent.preparations.stream().filter(p -> p.name.equals(preparationName)).collect(Collectors.toList());
assertEquals("More than one preparation with \"" + preparationFullname + "\" name founded.", 1, preparations.size());
PreparationDetails preparation = preparations.get(0);
context.storeExistingPreparationRef(preparation.id, preparation.name, prepFolder.getPath());
}
}
use of org.talend.dataprep.qa.dto.PreparationDetails in project data-prep by Talend.
the class PreparationStep method checkPreparation.
/**
* Check if an existing preparation contains the same actions as the one given in parameters.
* Be careful ! If your preparation contains lookup actions, you'll need to load your dataset by restoring a Mongo
* dump, else the lookup_ds_id won't be the same in actions' parameter value.
*
* @param dataTable step parameters.
* @throws IOException in case of exception.
*/
@Given("^A preparation with the following parameters exists :$")
public void checkPreparation(DataTable dataTable) throws IOException {
Map<String, String> params = dataTable.asMap(String.class, String.class);
String suffixedPrepName = getSuffixedPrepName(params.get(PREPARATION_NAME));
String prepPath = util.extractPathFromFullName(params.get(PREPARATION_NAME));
String prepId = context.getPreparationId(suffixedPrepName, prepPath);
PreparationDetails prepDet = getPreparationDetails(prepId);
Assert.assertNotNull(prepDet);
assertEquals(prepDet.dataSetId, context.getDatasetId(suffixName(params.get(DATASET_NAME))));
assertEquals(Integer.toString(prepDet.steps.size() - 1), params.get(NB_STEPS));
if (params.get("actionsList") != null) {
List<Action> actionsList = prepDet.actions;
checkActionsListOfPrepa(actionsList, params.get("actionsList").toString());
}
}
use of org.talend.dataprep.qa.dto.PreparationDetails in project data-prep by Talend.
the class PreparationStep method checkPreparationsSteps.
@And("^I check that the preparations \"(.*)\" and \"(.*)\" have the same steps$")
public void checkPreparationsSteps(String prep1FullName, String prep2FullName) {
String suffixedPrep1Name = getSuffixedPrepName(prep1FullName);
String prep1Path = util.extractPathFromFullName(prep1FullName);
String suffixedPrep2Name = getSuffixedPrepName(prep2FullName);
String prep2Path = util.extractPathFromFullName(prep2FullName);
String prepId1 = context.getPreparationId(suffixedPrep1Name, prep1Path);
String prepId2 = context.getPreparationId(suffixedPrep2Name, prep2Path);
PreparationDetails prepDet1 = getPreparationDetails(prepId1);
PreparationDetails prepDet2 = getPreparationDetails(prepId2);
assertEquals(prepDet1.actions, prepDet2.actions);
assertEquals(prepDet1.steps.size(), prepDet2.steps.size());
context.storeObject("copiedPrep", prepDet1);
}
Aggregations