Search in sources :

Example 1 with AtomicRequestMessage

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

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

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

the class TestDataTierManager method testCheckForUpdatesWithBatched.

@Test
public void testCheckForUpdatesWithBatched() throws Exception {
    helpSetupDataTierManager();
    QueryMetadataInterface metadata = RealMetadataFactory.exampleBQTCached();
    AtomicRequestMessage request = helpSetupRequest("delete from bqt1.smalla", 1, metadata);
    Command command = helpGetCommand("insert into bqt1.smalla (stringkey) values ('1')", metadata);
    BatchedUpdateCommand bac = new BatchedUpdateCommand(Arrays.asList(request.getCommand(), command));
    request.setCommand(bac);
    DataTierTupleSource dtts = new DataTierTupleSource(request, workItem, connectorManager.registerRequest(request), dtm, limit);
    pullTuples(dtts, 2);
}
Also used : Command(org.teiid.query.sql.lang.Command) BatchedUpdateCommand(org.teiid.query.sql.lang.BatchedUpdateCommand) QueryMetadataInterface(org.teiid.query.metadata.QueryMetadataInterface) BatchedUpdateCommand(org.teiid.query.sql.lang.BatchedUpdateCommand) AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage) Test(org.junit.Test)

Example 4 with AtomicRequestMessage

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

the class TestDataTierManager method helpSetup.

private DataTierTupleSource helpSetup(String sql, int nodeId) throws Exception {
    helpSetupDataTierManager();
    AtomicRequestMessage request = helpSetupRequest(sql, nodeId, RealMetadataFactory.exampleBQTCached());
    request.setSerial(serial);
    return new DataTierTupleSource(request, workItem, connectorManager.registerRequest(request), dtm, limit);
}
Also used : AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage)

Example 5 with AtomicRequestMessage

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

the class TestConnectorWorkItem method testSourcHints.

@Test
public void testSourcHints() throws Exception {
    // $NON-NLS-1$
    Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT);
    command.setSourceHint(new SourceHint());
    AtomicRequestMessage arm = createNewAtomicRequestMessage(1, 1);
    arm.setCommand(command);
    ConnectorManager cm = TestConnectorManager.getConnectorManager();
    cm.registerRequest(arm);
}
Also used : Command(org.teiid.query.sql.lang.Command) BatchedUpdateCommand(org.teiid.query.sql.lang.BatchedUpdateCommand) AtomicRequestMessage(org.teiid.dqp.message.AtomicRequestMessage) SourceHint(org.teiid.query.sql.lang.SourceHint) Test(org.junit.Test)

Aggregations

AtomicRequestMessage (org.teiid.dqp.message.AtomicRequestMessage)18 Test (org.junit.Test)9 BatchedUpdateCommand (org.teiid.query.sql.lang.BatchedUpdateCommand)8 Command (org.teiid.query.sql.lang.Command)8 RequestMessage (org.teiid.client.RequestMessage)5 RequestID (org.teiid.dqp.message.RequestID)5 ArrayList (java.util.ArrayList)4 List (java.util.List)3 BufferManager (org.teiid.common.buffer.BufferManager)3 AtomicResultsMessage (org.teiid.dqp.message.AtomicResultsMessage)3 QueryExpression (org.teiid.language.QueryExpression)3 RuntimeMetadata (org.teiid.metadata.RuntimeMetadata)3 Xid (javax.transaction.xa.Xid)2 Ignore (org.junit.Ignore)2 FakeTransactionService (org.teiid.dqp.internal.datamgr.FakeTransactionService)2 TransactionContext (org.teiid.dqp.service.TransactionContext)2 QueryMetadataInterface (org.teiid.query.metadata.QueryMetadataInterface)2 CommandContext (org.teiid.query.util.CommandContext)2 ExecutionContext (org.teiid.translator.ExecutionContext)2 ExecutionFactory (org.teiid.translator.ExecutionFactory)2