Search in sources :

Example 1 with CloneLink

use of org.talend.dataprep.transformation.pipeline.link.CloneLink 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)

Aggregations

Test (org.junit.Test)1 Node (org.talend.dataprep.transformation.pipeline.Node)1 CloneLink (org.talend.dataprep.transformation.pipeline.link.CloneLink)1 BasicNode (org.talend.dataprep.transformation.pipeline.node.BasicNode)1 FilteredSourceNode (org.talend.dataprep.transformation.pipeline.node.FilteredSourceNode)1 SourceNode (org.talend.dataprep.transformation.pipeline.node.SourceNode)1