Search in sources :

Example 6 with CompileNode

use of org.talend.dataprep.transformation.pipeline.node.CompileNode 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());
}
Also used : CompileNode(org.talend.dataprep.transformation.pipeline.node.CompileNode) StepNode(org.talend.dataprep.transformation.pipeline.node.StepNode) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) StepNode(org.talend.dataprep.transformation.pipeline.node.StepNode) SourceNode(org.talend.dataprep.transformation.pipeline.node.SourceNode) ActionNode(org.talend.dataprep.transformation.pipeline.node.ActionNode) CompileNode(org.talend.dataprep.transformation.pipeline.node.CompileNode) BasicNode(org.talend.dataprep.transformation.pipeline.node.BasicNode) ActionNode(org.talend.dataprep.transformation.pipeline.node.ActionNode) BasicNode(org.talend.dataprep.transformation.pipeline.node.BasicNode) Test(org.junit.Test)

Aggregations

ActionNode (org.talend.dataprep.transformation.pipeline.node.ActionNode)6 CompileNode (org.talend.dataprep.transformation.pipeline.node.CompileNode)6 Test (org.junit.Test)5 BasicNode (org.talend.dataprep.transformation.pipeline.node.BasicNode)5 SourceNode (org.talend.dataprep.transformation.pipeline.node.SourceNode)5 StepNode (org.talend.dataprep.transformation.pipeline.node.StepNode)5 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 RunnableAction (org.talend.dataprep.transformation.actions.common.RunnableAction)1 DataSetRowAction (org.talend.dataprep.transformation.api.action.DataSetRowAction)1 TransformationContext (org.talend.dataprep.transformation.api.action.context.TransformationContext)1 Node (org.talend.dataprep.transformation.pipeline.Node)1 CleanUpNode (org.talend.dataprep.transformation.pipeline.node.CleanUpNode)1