use of org.teiid.dqp.internal.datamgr.FakeTransactionService in project teiid by teiid.
the class TestRequest method helpProcessMessage.
private Request helpProcessMessage(RequestMessage message, SessionAwareCache<PreparedPlan> cache, DQPWorkContext workContext) throws TeiidComponentException, TeiidProcessingException {
Request request = null;
if (cache != null) {
request = new PreparedStatementRequest(cache);
} else {
request = new Request();
}
ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class);
workContext.getVDB().addAttchment(ConnectorManagerRepository.class, repo);
Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(new AutoGenDataService());
request.initialize(message, Mockito.mock(BufferManager.class), new FakeDataManager(), new FakeTransactionService(), TEMP_TABLE_STORE, workContext, null);
DefaultAuthorizationValidator drav = new DefaultAuthorizationValidator();
request.setAuthorizationValidator(drav);
request.processRequest();
return request;
}
use of org.teiid.dqp.internal.datamgr.FakeTransactionService in project teiid by teiid.
the class TestDQPCoreRequestHandling method testRemoveConnectorInfo.
public void testRemoveConnectorInfo() {
DQPCore rm = new DQPCore();
rm.setTransactionService(new FakeTransactionService());
// $NON-NLS-1$
RequestMessage r0 = new RequestMessage("foo");
RequestID requestID = new RequestID(SESSION_STRING, 1);
RequestWorkItem workItem = addRequest(rm, r0, requestID, null, null);
AtomicRequestMessage atomicReq = new AtomicRequestMessage(workItem.requestMsg, workItem.getDqpWorkContext(), 1);
DataTierTupleSource info = Mockito.mock(DataTierTupleSource.class);
workItem.addConnectorRequest(atomicReq.getAtomicRequestID(), info);
workItem.closeAtomicRequest(atomicReq.getAtomicRequestID());
DataTierTupleSource arInfo = workItem.getConnectorRequest(atomicReq.getAtomicRequestID());
assertNull(arInfo);
}
use of org.teiid.dqp.internal.datamgr.FakeTransactionService in project teiid by teiid.
the class TestDQPCoreRequestHandling method testGetConnectorInfo.
public void testGetConnectorInfo() {
DQPCore rm = new DQPCore();
rm.setTransactionService(new FakeTransactionService());
// $NON-NLS-1$
RequestMessage r0 = new RequestMessage("foo");
RequestID requestID = new RequestID(SESSION_STRING, 1);
RequestWorkItem workItem = addRequest(rm, r0, requestID, null, null);
AtomicRequestMessage atomicReq = new AtomicRequestMessage(workItem.requestMsg, workItem.getDqpWorkContext(), 1);
DataTierTupleSource info = Mockito.mock(DataTierTupleSource.class);
workItem.addConnectorRequest(atomicReq.getAtomicRequestID(), info);
DataTierTupleSource arInfo = workItem.getConnectorRequest(atomicReq.getAtomicRequestID());
assertTrue(arInfo == info);
}
use of org.teiid.dqp.internal.datamgr.FakeTransactionService in project teiid by teiid.
the class TestDQPCoreRequestHandling method testAddRequest.
public void testAddRequest() {
DQPCore rm = new DQPCore();
rm.setTransactionService(new FakeTransactionService());
// $NON-NLS-1$
RequestMessage r0 = new RequestMessage("foo");
RequestID requestID = new RequestID(SESSION_STRING, 1);
addRequest(rm, r0, requestID, null, null);
}
use of org.teiid.dqp.internal.datamgr.FakeTransactionService in project teiid by teiid.
the class TestDQPCoreRequestHandling method testGetRequestsSessionToken2.
/**
* Test for Collection getRequests(SessionToken) - 1 request
*/
public void testGetRequestsSessionToken2() {
DQPCore rm = new DQPCore();
rm.setTransactionService(new FakeTransactionService());
Set<RequestID> reqs = new HashSet<RequestID>();
RequestID id = addRequest(rm, SESSION_STRING, 1);
reqs.add(id);
Collection<RequestMetadata> actualReqs = rm.getRequestsForSession(SESSION_STRING);
compareReqInfos(reqs, actualReqs);
}
Aggregations