use of org.talend.dataprep.api.preparation.Step in project data-prep by Talend.
the class FileSystemPreparationRepositoryTest method shouldGetStepThatWasAdded.
@Test
public void shouldGetStepThatWasAdded() {
final Step expected = new Step(Step.ROOT_STEP.id(), "684fdqs638", versionService.version().getVersionId());
repository.add(expected);
final Step actual = repository.get(expected.id(), Step.class);
assertEquals(expected, actual);
}
use of org.talend.dataprep.api.preparation.Step in project data-prep by Talend.
the class FileSystemPreparationRepositoryTest method shouldListOnlyPreparationsExactlyMatchingGivenName.
@Test
public void shouldListOnlyPreparationsExactlyMatchingGivenName() {
final List<Integer> ids = Arrays.asList(1, 12, 3);
// store preparations
final List<Preparation> preparations = //
ids.stream().map(//
i -> getPreparation(String.valueOf(i))).collect(Collectors.toList());
preparations.forEach(prep -> repository.add(prep));
// and some steps to add some noise
//
ids.stream().map(i -> new Step(Step.ROOT_STEP.id(), "step" + i, versionService.version().getVersionId())).forEach(step -> repository.add(step));
// get some preparation by dataset id
final Preparation expected = preparations.get(0);
final Collection<Preparation> actual = repository.list(Preparation.class, eq("name", "prep-1")).collect(Collectors.toList());
assertEquals(1, actual.size());
assertTrue(actual.contains(expected));
}
use of org.talend.dataprep.api.preparation.Step in project data-prep by Talend.
the class FileSystemPreparationRepositoryTest method shouldGetOnlyWantedClass.
@Test
public void shouldGetOnlyWantedClass() {
final Step expected = new Step(Step.ROOT_STEP.id(), "8rq4868", versionService.version().getVersionId());
repository.add(expected);
assertNull(repository.get(expected.id(), Preparation.class));
assertNull(repository.get(expected.id(), PreparationActions.class));
}
use of org.talend.dataprep.api.preparation.Step in project data-prep by Talend.
the class FileSystemPreparationRepositoryTest method shouldListOnlyPreparationsContainingGivenName.
@Test
public void shouldListOnlyPreparationsContainingGivenName() {
final List<Integer> ids = Arrays.asList(1, 12, 3);
// store preparations
final List<Preparation> preparations = //
ids.stream().map(//
i -> getPreparation(String.valueOf(i))).collect(Collectors.toList());
preparations.forEach(prep -> repository.add(prep));
// and some steps to add some noise
//
ids.stream().map(i -> new Step(Step.ROOT_STEP.id(), "step" + i, versionService.version().getVersionId())).forEach(step -> repository.add(step));
// get some preparation by dataset id
final Preparation expected1 = preparations.get(0);
final Preparation expected2 = preparations.get(1);
final Collection<Preparation> actual = repository.list(Preparation.class, contains("name", "1")).collect(Collectors.toList());
assertEquals(2, actual.size());
assertTrue(actual.contains(expected1));
assertTrue(actual.contains(expected2));
}
use of org.talend.dataprep.api.preparation.Step in project data-prep by Talend.
the class UpdatedStepVisitor method visitStepNode.
@Override
public void visitStepNode(StepNode stepNode) {
stepNode.getEntryNode().accept(new Visitor() {
@Override
public void visitAction(ActionNode actionNode) {
final ActionContext.ActionStatus status = actionNode.getActionContext().getActionStatus();
final Step step = stepNode.getStep();
switch(status) {
case NOT_EXECUTED:
case CANCELED:
LOGGER.debug("Not updating metadata for {} (action ended with status {}).", step.getId(), status);
step.setRowMetadata(null);
break;
case OK:
case DONE:
LOGGER.debug("Keeping metadata {} (action ended with status {}).", step.getId(), status);
break;
}
preparationUpdater.update(step.id(), actionNode.getActionContext().getRowMetadata());
}
});
super.visitStepNode(stepNode);
}
Aggregations