use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestDQPCore method testProcedureMaxRows.
/**
* Ensure that the row limit is not misapplied.
* Note that it still could be applied in this example, but the
* resultset only returns a single row
*/
@Test
public void testProcedureMaxRows() throws Exception {
// $NON-NLS-1$
String sql = "{? = call TEIIDSP9(1, ?)}";
RequestMessage request = exampleRequestMessage(sql);
request.setRowLimit(1);
request.setStatementType(StatementType.CALLABLE);
ResultsMessage rm = execute("A", 1, request);
assertNull(rm.getException());
assertEquals(2, rm.getResultsList().size());
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestDQPCore method testLimitCompensation1.
@Test
public void testLimitCompensation1() throws Exception {
// $NON-NLS-1$
String sql = "SELECT * FROM VQT.SmallA_2589g LIMIT 1, 1";
// $NON-NLS-1$
ResultsMessage rm = helpExecute(sql, "a");
assertEquals(1, rm.getResultsList().size());
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestDQPCore method testBufferReuse.
@Test
public void testBufferReuse() throws Exception {
// the sql should return 100 rows
// $NON-NLS-1$
String sql = "SELECT A.IntKey FROM BQT1.SmallA as A, BQT1.SmallA as B ORDER BY A.IntKey";
// $NON-NLS-1$
String userName = "1";
// $NON-NLS-1$
String sessionid = "1";
RequestMessage reqMsg = exampleRequestMessage(sql);
reqMsg.setCursorType(ResultSet.TYPE_FORWARD_ONLY);
DQPWorkContext.getWorkContext().getSession().setSessionId(sessionid);
DQPWorkContext.getWorkContext().getSession().setUserName(userName);
((BufferManagerImpl) core.getBufferManager()).setProcessorBatchSize(1);
Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
ResultsMessage rm = message.get(500000, TimeUnit.MILLISECONDS);
assertNull(rm.getException());
assertEquals(8, rm.getResultsList().size());
RequestWorkItem item = core.getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(reqMsg.getExecutionId()));
assertEquals(100, item.resultsBuffer.getRowCount());
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestDQPCore method testLobConcurrency.
@Test
public void testLobConcurrency() throws Exception {
RequestMessage reqMsg = exampleRequestMessage("select to_bytes(stringkey, 'utf-8') FROM BQT1.SmallA");
reqMsg.setTxnAutoWrapMode(RequestMessage.TXN_WRAP_OFF);
agds.setSleep(100);
ResultsFuture<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
final LobThread t = new LobThread(reqMsg);
t.start();
message.addCompletionListener(new ResultsFuture.CompletionListener<ResultsMessage>() {
@Override
public void onCompletion(ResultsFuture<ResultsMessage> future) {
try {
final BlobType bt = (BlobType) future.get().getResultsList().get(0).get(0);
synchronized (t) {
t.bt = bt;
t.workContext = DQPWorkContext.getWorkContext();
t.notify();
}
// give the Thread a chance to run
Thread.sleep(100);
} catch (Exception e) {
t.interrupt();
throw new RuntimeException(e);
}
}
});
message.get();
t.join();
assertNotNull(t.chunkFuture.get().getBytes());
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestDQPCore method testServerTimeout.
@Test
public void testServerTimeout() throws Exception {
RequestMessage reqMsg = exampleRequestMessage("select to_bytes(stringkey, 'utf-8') FROM BQT1.SmallA");
reqMsg.setTxnAutoWrapMode(RequestMessage.TXN_WRAP_OFF);
agds.setSleep(100);
this.config.setQueryTimeout(1);
ResultsMessage rm = execute("A", 1, reqMsg);
assertNotNull(rm.getException());
assertEquals("57014 TEIID30563 The request 1.0 has been cancelled: TEIID31096 Query has exceeded the VDB/engine timeout of 1 milliseconds.", rm.getException().getMessage());
}
Aggregations