Search in sources :

Example 1 with RequestID

use of org.teiid.dqp.message.RequestID 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 2 with RequestID

use of org.teiid.dqp.message.RequestID 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 3 with RequestID

use of org.teiid.dqp.message.RequestID 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 4 with RequestID

use of org.teiid.dqp.message.RequestID 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)

Example 5 with RequestID

use of org.teiid.dqp.message.RequestID in project teiid by teiid.

the class TestRequestID method testGetters1.

public void testGetters1() {
    // $NON-NLS-1$
    String connID = "100";
    long executionID = 200;
    RequestID r = new RequestID(connID, executionID);
    // $NON-NLS-1$
    assertEquals("Lost connectionID", connID, r.getConnectionID());
    // $NON-NLS-1$
    assertEquals("Lost executionID", executionID, r.getExecutionID());
    // $NON-NLS-1$ //$NON-NLS-2$
    assertEquals("Wrong string representation", "100.200", r.toString());
}
Also used : RequestID(org.teiid.dqp.message.RequestID)

Aggregations

RequestID (org.teiid.dqp.message.RequestID)25 RequestMessage (org.teiid.client.RequestMessage)8 AtomicRequestMessage (org.teiid.dqp.message.AtomicRequestMessage)8 FakeTransactionService (org.teiid.dqp.internal.datamgr.FakeTransactionService)6 RequestMetadata (org.teiid.adminapi.impl.RequestMetadata)4 HashSet (java.util.HashSet)3 TeiidComponentException (org.teiid.core.TeiidComponentException)2 QueryProcessor (org.teiid.query.processor.QueryProcessor)2 Command (org.teiid.query.sql.lang.Command)2 CommandContext (org.teiid.query.util.CommandContext)2 WeakReference (java.lang.ref.WeakReference)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 PreParser (org.teiid.PreParser)1 CacheConfiguration (org.teiid.cache.CacheConfiguration)1 DefaultCacheFactory (org.teiid.cache.DefaultCacheFactory)1 ResultsMessage (org.teiid.client.ResultsMessage)1 PlanNode (org.teiid.client.plan.PlanNode)1 ResultsFuture (org.teiid.client.util.ResultsFuture)1 DQPWorkContext (org.teiid.dqp.internal.process.DQPWorkContext)1