Search in sources :

Example 1 with FakeTransactionService

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;
}
Also used : ConnectorManagerRepository(org.teiid.dqp.internal.datamgr.ConnectorManagerRepository) FakeDataManager(org.teiid.query.processor.FakeDataManager) FakeTransactionService(org.teiid.dqp.internal.datamgr.FakeTransactionService) AutoGenDataService(org.teiid.dqp.service.AutoGenDataService) BufferManager(org.teiid.common.buffer.BufferManager)

Example 2 with FakeTransactionService

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);
}
Also used : RequestID(org.teiid.dqp.message.RequestID) AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage) RequestMessage(org.teiid.client.RequestMessage) FakeTransactionService(org.teiid.dqp.internal.datamgr.FakeTransactionService) AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage)

Example 3 with FakeTransactionService

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);
}
Also used : RequestID(org.teiid.dqp.message.RequestID) AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage) RequestMessage(org.teiid.client.RequestMessage) FakeTransactionService(org.teiid.dqp.internal.datamgr.FakeTransactionService) AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage)

Example 4 with FakeTransactionService

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);
}
Also used : RequestID(org.teiid.dqp.message.RequestID) AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage) RequestMessage(org.teiid.client.RequestMessage) FakeTransactionService(org.teiid.dqp.internal.datamgr.FakeTransactionService)

Example 5 with FakeTransactionService

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);
}
Also used : RequestID(org.teiid.dqp.message.RequestID) FakeTransactionService(org.teiid.dqp.internal.datamgr.FakeTransactionService) HashSet(java.util.HashSet) RequestMetadata(org.teiid.adminapi.impl.RequestMetadata)

Aggregations

FakeTransactionService (org.teiid.dqp.internal.datamgr.FakeTransactionService)11 RequestMessage (org.teiid.client.RequestMessage)6 RequestID (org.teiid.dqp.message.RequestID)6 ConnectorManagerRepository (org.teiid.dqp.internal.datamgr.ConnectorManagerRepository)4 CacheConfiguration (org.teiid.cache.CacheConfiguration)3 DefaultCacheFactory (org.teiid.cache.DefaultCacheFactory)3 AtomicRequestMessage (org.teiid.dqp.message.AtomicRequestMessage)3 AutoGenDataService (org.teiid.dqp.service.AutoGenDataService)3 HashSet (java.util.HashSet)2 RequestMetadata (org.teiid.adminapi.impl.RequestMetadata)2 FakeBufferService (org.teiid.dqp.service.FakeBufferService)2 Command (org.teiid.query.sql.lang.Command)2 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Before (org.junit.Before)1 Test (org.junit.Test)1 DataPolicy (org.teiid.adminapi.DataPolicy)1 DataPolicyMetadata (org.teiid.adminapi.impl.DataPolicyMetadata)1 BufferManager (org.teiid.common.buffer.BufferManager)1