use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class JDBCSinkTest method emptyColumnList.
@Test
public void emptyColumnList() {
String columns = JDBCSink.columnList(new Row());
assertNull(columns);
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class CSVImportTest method nullHandling.
@Test
public void nullHandling() {
VirtualSinkSource vss = getSource("./src/test/files/nullcolumns.csv");
int numberOfRows = vss.getNumberOfRows();
assertThat(numberOfRows, is(3));
Iterable<Row> query = vss.query();
Iterator<Row> iterator = query.iterator();
//skipping header
iterator.next();
Row first = iterator.next();
assertNull(first.getColumnValue("1"));
assertNull(first.getColumnValue("2"));
assertNull(first.getColumnValue("3"));
assertNull(first.getColumnValue("4"));
Row second = iterator.next();
String emptyString = " ";
assertThat(second.getColumnValue("1"), is(emptyString));
assertThat(second.getColumnValue("2"), is(emptyString));
assertThat(second.getColumnValue("3"), is(emptyString));
assertNull(second.getColumnValue("4"));
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class CSVImportTest method copy.
/**
* 1997;Ford;E350;2,34
*/
@Test
public void copy() {
VirtualSinkSource vss = getSource("./src/test/files/cars.csv");
int numberOfRows = vss.getNumberOfRows();
assertTrue(numberOfRows > 0);
Iterable<Row> query = vss.query();
boolean foundFord = false;
for (Row list : query) {
assertThat(list.getNumberOfColumns(), is(4));
if ("Ford".equals(list.getColumnValue("Make"))) {
foundFord = true;
}
}
assertTrue(foundFord);
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class ConvertToIntAndCopyTest method scenario.
@Test
public void scenario() {
Row row = new Row();
row.addColumn(new Column(0, "question", "21"));
this.input.getRows().add(row);
Memory result = this.pump.start();
assertThat(result.getErroneousRowCount(), is(0l));
assertThat(result.getProcessedRowCount(), is(1l));
Row first = this.output.getRow(0);
assertThat(first.getColumns().size(), is(3));
Column answerColumn = first.getColumnByName("answer");
assertThat(answerColumn.getValue(), is(42));
Column originColumn = first.getColumnByName("origin");
assertThat(originColumn.getValue(), is("21"));
Column questionColumn = first.getColumnByName("question");
assertThat(questionColumn.getValue(), is("21"));
}
use of com.airhacks.enhydrator.in.Row in project enhydrator by AdamBien.
the class JSONImportTest method readFromJSON.
@Test
public void readFromJSON() throws FileNotFoundException {
VirtualSinkSource vss = getSource("./src/test/files/languages.json");
int numberOfRows = vss.getNumberOfRows();
assertThat(numberOfRows, is(1));
Iterable<Row> query = vss.query();
Iterator<Row> iterator = query.iterator();
Row first = iterator.next();
assertThat(first.getColumnValue("java"), is("1"));
assertThat(first.getColumnValue("c"), is("2"));
assertThat(first.getColumnValue("cobol"), is("3"));
assertThat(first.getColumnValue("esoteric"), is("4"));
}
Aggregations