use of org.xbib.elasticsearch.common.keyvalue.KeyValueStreamListener in project elasticsearch-jdbc by jprante.
the class MockTests method testMockHighBills.
@Test
@Parameters({ "sql3" })
public void testMockHighBills(String sql) throws Exception {
List<Object> params = new LinkedList<Object>();
params.add(2.00);
Sink output = new MockSink() {
@Override
public void index(IndexableObject object, boolean create) throws IOException {
logger.debug("sql3={}", object);
}
};
PreparedStatement statement = source.prepareQuery(sql);
source.bind(statement, params);
ResultSet results = source.executeQuery(statement);
KeyValueStreamListener listener = new StringKeyValueStreamListener().output(output);
source.beforeRows(results, listener);
long rows = 0L;
while (source.nextRow(results, listener)) {
rows++;
}
source.afterRows(results, listener);
assertEquals(rows, 2);
source.close(results);
source.close(statement);
}
Aggregations