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));
}
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));
}
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));
}
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));
}
Aggregations