use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestDQPCore method testRsCacheInvalidation.
@Test
public void testRsCacheInvalidation() throws Exception {
// $NON-NLS-1$
String sql = "select * FROM vqt.SmallB";
// $NON-NLS-1$
String userName = "1";
// $NON-NLS-1$
int sessionid = 1;
RequestMessage reqMsg = exampleRequestMessage(sql);
reqMsg.setUseResultSetCache(true);
ResultsMessage rm = execute(userName, sessionid, reqMsg);
// $NON-NLS-1$
assertEquals(10, rm.getResultsList().size());
assertEquals(0, this.core.getRsCache().getCacheHitCount());
// $NON-NLS-1$
sql = "select * FROM vqt.SmallB";
reqMsg = exampleRequestMessage(sql);
reqMsg.setUseResultSetCache(true);
rm = execute(userName, sessionid, reqMsg);
// $NON-NLS-1$
assertEquals(10, rm.getResultsList().size());
assertEquals(1, this.core.getRsCache().getCacheHitCount());
Thread.sleep(100);
// $NON-NLS-1$
sql = "delete from bqt1.smalla";
reqMsg = exampleRequestMessage(sql);
rm = execute(userName, sessionid, reqMsg);
// $NON-NLS-1$
assertEquals(1, rm.getResultsList().size());
// $NON-NLS-1$
sql = "select * FROM vqt.SmallB";
reqMsg = exampleRequestMessage(sql);
reqMsg.setUseResultSetCache(true);
rm = execute(userName, sessionid, reqMsg);
// $NON-NLS-1$
assertEquals(10, rm.getResultsList().size());
assertEquals(1, this.core.getRsCache().getCacheHitCount());
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestDQPCore method testHasRole.
@Test
public void testHasRole() throws Exception {
// $NON-NLS-1$
String sql = "SELECT hasRole('foo')";
// $NON-NLS-1$
String userName = "logon";
ResultsMessage rm = helpExecute(sql, userName);
assertTrue((Boolean) rm.getResultsList().get(0).get(0));
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestDQPCore method helpTestVisibilityFails.
public void helpTestVisibilityFails(String sql) throws Exception {
RequestMessage reqMsg = exampleRequestMessage(sql);
reqMsg.setTxnAutoWrapMode(RequestMessage.TXN_WRAP_OFF);
Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
ResultsMessage results = message.get(5000, TimeUnit.MILLISECONDS);
// $NON-NLS-1$
assertEquals("[QueryValidatorException]Group does not exist: BQT3.SmallA", results.getException().toString());
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestDQPCore method testProcedureUpdateCount.
@Test
public void testProcedureUpdateCount() throws Exception {
// $NON-NLS-1$
String sql = "{? = call TEIIDSP8(1)}";
RequestMessage request = exampleRequestMessage(sql);
request.setResultsMode(ResultsMode.UPDATECOUNT);
request.setStatementType(StatementType.CALLABLE);
ResultsMessage rm = execute("A", 1, request);
assertNull(rm.getException());
assertEquals(1, rm.getResultsList().size());
}
use of org.teiid.client.ResultsMessage in project teiid by teiid.
the class TestDQPCore method testFinalRow.
@Test
public void testFinalRow() throws Exception {
// $NON-NLS-1$
String sql = "SELECT A.IntKey FROM BQT1.SmallA as A";
// $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(10);
Future<ResultsMessage> message = core.executeRequest(reqMsg.getExecutionId(), reqMsg);
ResultsMessage rm = message.get(500000, TimeUnit.MILLISECONDS);
assertNull(rm.getException());
assertEquals(10, rm.getResultsList().size());
RequestWorkItem item = core.getRequestWorkItem(DQPWorkContext.getWorkContext().getRequestID(reqMsg.getExecutionId()));
while (item.isProcessing()) ;
synchronized (item) {
for (int i = 0; i < 100; i++) {
Thread.sleep(10);
}
}
assertEquals(10, item.resultsBuffer.getRowCount());
}
Aggregations