use of org.teiid.dqp.message.AtomicRequestMessage in project teiid by teiid.
the class TestConnectorWorkItem method testSourceNotRequired.
@Test
public void testSourceNotRequired() throws Exception {
// $NON-NLS-1$
Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT);
AtomicRequestMessage arm = createNewAtomicRequestMessage(1, 1);
arm.setCommand(command);
ConnectorManager cm = TestConnectorManager.getConnectorManager();
cm.getExecutionFactory().setSourceRequired(false);
ConnectorWork synchConnectorWorkItem = cm.registerRequest(arm);
synchConnectorWorkItem.execute();
synchConnectorWorkItem.close();
FakeConnector fc = (FakeConnector) cm.getExecutionFactory();
assertEquals(1, fc.getConnectionCount());
assertEquals(1, fc.getCloseCount());
}
use of org.teiid.dqp.message.AtomicRequestMessage in project teiid by teiid.
the class TestConnectorWorkItem method testIsImmutablePropertyFails.
@Ignore
@Test(expected = TranslatorException.class)
public void testIsImmutablePropertyFails() throws Exception {
/*
* Setup:
* 1. requestMsg.isTransactional() must be TRUE
* 2. manager.isXa() must be FALSE ()
* 3. command must NOT be a SELECT
* 4. Then, set isImmutable to FALSE, and we should FAIL
*/
ConnectorManager cm = TestConnectorManager.getConnectorManager();
((FakeConnector) cm.getExecutionFactory()).setImmutable(false);
// command must not be a SELECT
// $NON-NLS-1$
Command command = helpGetCommand("update bqt1.smalla set stringkey = 1 where stringkey = 2", EXAMPLE_BQT);
AtomicRequestMessage requestMsg = createNewAtomicRequestMessage(1, 1);
requestMsg.setCommand(command);
// To make the AtomicRequestMessage transactional, construct your own
requestMsg.setTransactionContext(new TransactionContext() {
@Override
public Xid getXid() {
return Mockito.mock(Xid.class);
}
});
new ConnectorWorkItem(requestMsg, cm);
}
use of org.teiid.dqp.message.AtomicRequestMessage in project teiid by teiid.
the class TestDataTierManager method helpSetupRequest.
private AtomicRequestMessage helpSetupRequest(String sql, int nodeId, QueryMetadataInterface metadata) throws Exception {
DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
Command command = helpGetCommand(sql, metadata);
RequestMessage original = new RequestMessage();
original.setExecutionId(id++);
original.setPartialResults(true);
RequestID requestID = workContext.getRequestID(original.getExecutionId());
context = new CommandContext();
context.setSession(workContext.getSession());
// $NON-NLS-1$
context.setVdbName("test");
context.setVdbVersion(1);
context.setQueryProcessorFactory(new QueryProcessorFactoryImpl(dtm.getBufferManager(), dtm, new DefaultCapabilitiesFinder(), null, metadata));
workItem = TestDQPCoreRequestHandling.addRequest(rm, original, requestID, null, workContext);
context.setWorkItem(workItem);
AtomicRequestMessage request = new AtomicRequestMessage(original, workContext, nodeId);
request.setCommand(command);
// $NON-NLS-1$
request.setConnectorName("FakeConnectorID");
request.setCommandContext(context);
return request;
}
Aggregations