use of org.teiid.common.buffer.BufferManager in project teiid by teiid.
the class TestQueryProcessor method testCloseBeforeInitialization.
@Test
public void testCloseBeforeInitialization() throws TeiidComponentException {
BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
FakeDataManager dataManager = new FakeDataManager();
// $NON-NLS-1$ //$NON-NLS-2$
CommandContext context = new CommandContext("pid", "group", null, null, 1);
QueryProcessor processor = new QueryProcessor(null, context, bufferMgr, dataManager);
processor.closeProcessing();
}
use of org.teiid.common.buffer.BufferManager in project teiid by teiid.
the class TestProjectNode method helpSetupProject.
public ProjectNode helpSetupProject(List elements, List[] data, List childElements, ProcessorDataManager dataMgr) {
BufferManager mgr = BufferManagerFactory.getStandaloneBufferManager();
// $NON-NLS-1$ //$NON-NLS-2$
CommandContext context = new CommandContext("pid", "test", null, null, 1);
FakeRelationalNode dataNode = new FakeRelationalNode(2, data);
dataNode.setElements(childElements);
dataNode.initialize(context, mgr, null);
ProjectNode projectNode = new ProjectNode(1);
projectNode.setSelectSymbols(elements);
projectNode.setElements(elements);
projectNode.addChild(dataNode);
projectNode.initialize(context, mgr, dataMgr);
return projectNode;
}
use of org.teiid.common.buffer.BufferManager in project teiid by teiid.
the class TestSortNode method testOnePass.
@Test
public void testOnePass() throws Exception {
// $NON-NLS-1$
ElementSymbol es1 = new ElementSymbol("e1");
es1.setType(DataTypeManager.DefaultDataClasses.INTEGER);
// $NON-NLS-1$
ElementSymbol es2 = new ElementSymbol("e2");
es2.setType(DataTypeManager.DefaultDataClasses.INTEGER);
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
// $NON-NLS-1$
TupleBuffer tsid = bm.createTupleBuffer(Arrays.asList(es1, es2), "test", TupleSourceType.PROCESSOR);
tsid.addTuple(Arrays.asList(1, 1));
tsid.addTuple(Arrays.asList(1, 2));
tsid.close();
// $NON-NLS-1$
SortUtility su = new SortUtility(tsid.createIndexedTupleSource(), Arrays.asList(es1), Arrays.asList(Boolean.TRUE), Mode.SORT, bm, "test", tsid.getSchema());
List<TupleBuffer> buffers = su.onePassSort(true);
assertEquals(1, buffers.size());
assertTrue(!buffers.get(0).isForwardOnly());
}
use of org.teiid.common.buffer.BufferManager in project teiid by teiid.
the class TestBatchIterator method testReset.
@Test
public void testReset() throws Exception {
BatchIterator bi = new BatchIterator(new FakeRelationalNode(1, new List[] { Arrays.asList(1), Arrays.asList(1), Arrays.asList(1) }, 1));
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
// $NON-NLS-1$
bi.setBuffer(bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)), "test", TupleSourceType.PROCESSOR), true);
bi.mark();
bi.nextTuple();
bi.nextTuple();
bi.reset();
bi.nextTuple();
}
use of org.teiid.common.buffer.BufferManager in project teiid by teiid.
the class TestBatchIterator method testDisableSave.
@Test
public void testDisableSave() throws Exception {
BatchIterator bi = new BatchIterator(new FakeRelationalNode(1, new List[] { Arrays.asList(1), Arrays.asList(1), Arrays.asList(1), Arrays.asList(1), Arrays.asList(1), Arrays.asList(1) }, 2));
BufferManager bm = BufferManagerFactory.getStandaloneBufferManager();
TupleBuffer tb = bm.createTupleBuffer(Arrays.asList(new ElementSymbol("x", null, DataTypeManager.DefaultDataClasses.INTEGER)), "test", TupleSourceType.PROCESSOR);
// $NON-NLS-1$
bi.setBuffer(tb, false);
bi.setPosition(2);
assertTrue(bi.hasNext());
tb.setForwardOnly(true);
bi.setPosition(1);
bi.disableSave();
for (int i = 0; i < 6; i++) {
assertNotNull(bi.nextTuple());
}
assertNull(bi.nextTuple());
assertEquals(0, tb.getManagedRowCount());
}
Aggregations