use of com.airhacks.enhydrator.functions.NonRecursiveTree in project enhydrator by AdamBien.
the class ParentTest method copy.
/**
* Name;Size;Folder
*/
@Test
public void copy() {
Source source = new CSVFileSource("./src/test/files/files.csv", ";", "UTF-8", true);
VirtualSinkSource vss = new VirtualSinkSource();
Pump pump = new Pump.Engine().from(source).startWith(new SkipFirstRow()).startWith(new NonRecursiveTree("Name", "Folder")).to(vss).to(new LogSink()).build();
pump.start();
System.out.println(vss.getRows());
int numberOfRows = vss.getNumberOfRows();
assertThat(numberOfRows, is(2));
Row parentWithChildren = vss.getRow(0);
assertNotNull(parentWithChildren);
assertThat(parentWithChildren.getNumberOfColumns(), is(3));
List<Row> children = parentWithChildren.getChildren();
assertThat(children.size(), is(2));
children.forEach(e -> assertThat(e.getNumberOfColumns(), is(2)));
}
Aggregations