use of org.talend.dataprep.transformation.pipeline.node.StepNode in project data-prep by Talend.
the class UpdatedStepVisitorTest method testUpdatedStepsWithKO.
@Test
public void testUpdatedStepsWithKO() throws Exception {
// Given
final Step step = new Step(ROOT_STEP.id(), new PreparationActions().id(), "0.0");
final RowMetadata stepRowMetadata = new RowMetadata();
final Node stepNode = NodeBuilder.from(new StepNode(step, stepRowMetadata, entryNode, new BasicNode())).to(new BasicNode()).build();
final UpdatedStepVisitor visitor = new UpdatedStepVisitor(stepMetadataRepository);
// Canceled action!
actionContext.setActionStatus(ActionContext.ActionStatus.CANCELED);
// When
stepNode.exec().receive(new DataSetRow(metadata), metadata);
// Then
stepNode.accept(visitor);
verify(stepMetadataRepository).update(step.id(), stepRowMetadata);
}
use of org.talend.dataprep.transformation.pipeline.node.StepNode in project data-prep by Talend.
the class UpdatedStepVisitorTest method testUpdatedStepsWithOk.
@Test
public void testUpdatedStepsWithOk() throws Exception {
// Given
final Step step = new Step(ROOT_STEP.id(), new PreparationActions().id(), "0.0");
final RowMetadata stepRowMetadata = new RowMetadata();
final Node stepNode = NodeBuilder.from(new StepNode(step, stepRowMetadata, entryNode, new BasicNode())).to(new BasicNode()).build();
final UpdatedStepVisitor visitor = new UpdatedStepVisitor(stepMetadataRepository);
// OK action!
actionContext.setActionStatus(ActionContext.ActionStatus.OK);
// When
stepNode.exec().receive(new DataSetRow(metadata), metadata);
// Then
stepNode.accept(visitor);
verify(stepMetadataRepository).update(step.id(), stepRowMetadata);
}
use of org.talend.dataprep.transformation.pipeline.node.StepNode in project data-prep by Talend.
the class StepNodeTransformerTest method shouldCreateStepNodesWhenSurrounded.
@Test
public void shouldCreateStepNodesWhenSurrounded() throws Exception {
// given
Node node = //
NodeBuilder.from(//
new TestNode()).to(//
new CompileNode(null, null)).to(//
new ActionNode(null, null)).to(//
new BasicNode()).to(//
new CompileNode(null, null)).to(//
new ActionNode(null, null)).build();
// when
final Node processed = StepNodeTransformer.transform(node, asList(ROOT, STEP, STEP), s -> null);
// then
final AtomicInteger stepNodeCount = new AtomicInteger();
processed.accept(new Visitor() {
@Override
public void visitStepNode(StepNode stepNode) {
stepNodeCount.incrementAndGet();
super.visitStepNode(stepNode);
}
});
assertEquals(2, stepNodeCount.get());
}
Aggregations