Search in sources :

Example 6 with BasicNode

use of org.talend.dataprep.transformation.pipeline.node.BasicNode in project data-prep by Talend.

the class NodeBuilderTest method should_append__clone_link_then_zip_to_a_common_node.

@Test
public void should_append__clone_link_then_zip_to_a_common_node() {
    // given
    final Node firstNode = new BasicNode();
    final Node branch1 = new BasicNode();
    final Node branch2 = new BasicNode();
    final Node zipTarget = new BasicNode();
    // when
    final Node node = NodeBuilder.from(firstNode).dispatchTo(branch1, branch2).zipTo(zipTarget).build();
    // then
    assertThat(node, is(firstNode));
    assertThat(node.getLink(), instanceOf(CloneLink.class));
    assertThat(((CloneLink) node.getLink()).getNodes(), arrayContaining(branch1, branch2));
    assertThat(branch1.getLink(), instanceOf(ZipLink.Zipper.class));
    assertThat(branch2.getLink(), instanceOf(ZipLink.Zipper.class));
    assertThat(branch1.getLink().getTarget(), is(zipTarget));
    assertThat(branch2.getLink().getTarget(), is(zipTarget));
}
Also used : CloneLink(org.talend.dataprep.transformation.pipeline.link.CloneLink) FilteredSourceNode(org.talend.dataprep.transformation.pipeline.node.FilteredSourceNode) SourceNode(org.talend.dataprep.transformation.pipeline.node.SourceNode) Node(org.talend.dataprep.transformation.pipeline.Node) BasicNode(org.talend.dataprep.transformation.pipeline.node.BasicNode) BasicNode(org.talend.dataprep.transformation.pipeline.node.BasicNode) Test(org.junit.Test)

Example 7 with BasicNode

use of org.talend.dataprep.transformation.pipeline.node.BasicNode in project data-prep by Talend.

the class NodeBuilderTest method should_take_provided_node_as_source.

@Test
public void should_take_provided_node_as_source() {
    // given
    final Node source = new BasicNode();
    // when
    final Node node = NodeBuilder.from(source).build();
    // then
    assertThat(node, is(source));
}
Also used : FilteredSourceNode(org.talend.dataprep.transformation.pipeline.node.FilteredSourceNode) SourceNode(org.talend.dataprep.transformation.pipeline.node.SourceNode) Node(org.talend.dataprep.transformation.pipeline.Node) BasicNode(org.talend.dataprep.transformation.pipeline.node.BasicNode) BasicNode(org.talend.dataprep.transformation.pipeline.node.BasicNode) Test(org.junit.Test)

Example 8 with BasicNode

use of org.talend.dataprep.transformation.pipeline.node.BasicNode in project data-prep by Talend.

the class NodeBuilderTest method should_append_node_with_basic_link.

@Test
public void should_append_node_with_basic_link() {
    // given
    final Node nextNode = new BasicNode();
    // when
    final Node node = NodeBuilder.source().to(nextNode).build();
    // then
    assertThat(node.getLink(), instanceOf(BasicLink.class));
    assertThat(node.getLink().getTarget(), is(nextNode));
}
Also used : FilteredSourceNode(org.talend.dataprep.transformation.pipeline.node.FilteredSourceNode) SourceNode(org.talend.dataprep.transformation.pipeline.node.SourceNode) Node(org.talend.dataprep.transformation.pipeline.Node) BasicNode(org.talend.dataprep.transformation.pipeline.node.BasicNode) BasicNode(org.talend.dataprep.transformation.pipeline.node.BasicNode) BasicLink(org.talend.dataprep.transformation.pipeline.link.BasicLink) Test(org.junit.Test)

Example 9 with BasicNode

use of org.talend.dataprep.transformation.pipeline.node.BasicNode in project data-prep by Talend.

the class NodeBuilderTest method should_append_a_pipeline.

@Test
public void should_append_a_pipeline() {
    // given
    final Node firstNode = new BasicNode();
    final Node secondNode = new BasicNode();
    final Node nodeToAppend = new BasicNode();
    final Node pipeline = NodeBuilder.from(firstNode).to(secondNode).build();
    // when
    final Node node = NodeBuilder.source().to(pipeline).to(nodeToAppend).build();
    // then
    assertThat(node.getLink().getTarget(), is(firstNode));
    assertThat(node.getLink().getTarget().getLink().getTarget(), is(secondNode));
    assertThat(node.getLink().getTarget().getLink().getTarget().getLink().getTarget(), is(nodeToAppend));
}
Also used : FilteredSourceNode(org.talend.dataprep.transformation.pipeline.node.FilteredSourceNode) SourceNode(org.talend.dataprep.transformation.pipeline.node.SourceNode) Node(org.talend.dataprep.transformation.pipeline.Node) BasicNode(org.talend.dataprep.transformation.pipeline.node.BasicNode) BasicNode(org.talend.dataprep.transformation.pipeline.node.BasicNode) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)9 BasicNode (org.talend.dataprep.transformation.pipeline.node.BasicNode)9 Node (org.talend.dataprep.transformation.pipeline.Node)7 SourceNode (org.talend.dataprep.transformation.pipeline.node.SourceNode)7 FilteredSourceNode (org.talend.dataprep.transformation.pipeline.node.FilteredSourceNode)5 ActionNode (org.talend.dataprep.transformation.pipeline.node.ActionNode)4 StepNode (org.talend.dataprep.transformation.pipeline.node.StepNode)4 DataSetRow (org.talend.dataprep.api.dataset.row.DataSetRow)3 RowMetadata (org.talend.dataprep.api.dataset.RowMetadata)2 PreparationActions (org.talend.dataprep.api.preparation.PreparationActions)2 Step (org.talend.dataprep.api.preparation.Step)2 BasicLink (org.talend.dataprep.transformation.pipeline.link.BasicLink)2 CloneLink (org.talend.dataprep.transformation.pipeline.link.CloneLink)2 CompileNode (org.talend.dataprep.transformation.pipeline.node.CompileNode)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Predicate (java.util.function.Predicate)1 CoreMatchers.is (org.hamcrest.CoreMatchers.is)1 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)1 Matchers.arrayContaining (org.hamcrest.Matchers.arrayContaining)1 IsInstanceOf.instanceOf (org.hamcrest.core.IsInstanceOf.instanceOf)1