use of org.talend.dataprep.transformation.pipeline.node.ActionNode in project data-prep by Talend.
the class StepNodeTransformerTest method shouldCreateStepNodeWhenSurrounded.
@Test
public void shouldCreateStepNodeWhenSurrounded() throws Exception {
// given
Node node = //
NodeBuilder.from(//
new TestNode()).to(//
new CompileNode(null, null)).to(//
new ActionNode(null, null)).to(//
new BasicNode()).build();
// when
final Node processed = StepNodeTransformer.transform(node, asList(ROOT, STEP), s -> null);
// then
final Class[] expectedClasses = { SourceNode.class, TestNode.class, StepNode.class, BasicNode.class };
final NodeClassVisitor visitor = new NodeClassVisitor();
processed.accept(visitor);
assertThat(visitor.traversedClasses, hasItems(expectedClasses));
}
use of org.talend.dataprep.transformation.pipeline.node.ActionNode in project data-prep by Talend.
the class StepNodeTransformerTest method shouldCreateStepNodeWithTooManySteps.
@Test
public void shouldCreateStepNodeWithTooManySteps() throws Exception {
// given
Node node = //
NodeBuilder.from(//
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 Class[] expectedClasses = { SourceNode.class, StepNode.class };
final NodeClassVisitor visitor = new NodeClassVisitor();
processed.accept(visitor);
assertThat(visitor.traversedClasses, hasItems(expectedClasses));
}
use of org.talend.dataprep.transformation.pipeline.node.ActionNode 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