use of org.teiid.query.processor.BatchIterator in project teiid by teiid.
the class TestSelectNode method helpTestSelect.
private void helpTestSelect(List elements, Criteria criteria, List childElements, ProcessorDataManager dataMgr, List[] expected, RelationalNode child, SelectNode selectNode) throws TeiidComponentException, TeiidProcessingException {
BufferManager mgr = BufferManagerFactory.getStandaloneBufferManager();
// $NON-NLS-1$ //$NON-NLS-2$
CommandContext context = new CommandContext("pid", "test", null, null, 1);
child.setElements(childElements);
child.initialize(context, mgr, dataMgr);
selectNode.setCriteria(criteria);
selectNode.setElements(elements);
selectNode.addChild(child);
selectNode.initialize(context, mgr, dataMgr);
selectNode.open();
BatchIterator iterator = new BatchIterator(selectNode);
for (int i = 0; i < expected.length; i++) {
while (true) {
try {
// $NON-NLS-1$
assertEquals("Rows don't match at " + i, expected[i], iterator.nextTuple());
break;
} catch (BlockedException e) {
continue;
}
}
}
assertFalse(iterator.hasNext());
}
Aggregations