use of org.teiid.dqp.service.AutoGenDataService 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.service.AutoGenDataService in project teiid by teiid.
the class TestDataTierManager method setUp.
@Before
public void setUp() {
limit = -1;
connectorManager = new AutoGenDataService();
serial = false;
}
use of org.teiid.dqp.service.AutoGenDataService in project teiid by teiid.
the class TestDQPCore method setUp.
@Before
public void setUp() throws Exception {
agds = new AutoGenDataService();
DQPWorkContext context = RealMetadataFactory.buildWorkContext(RealMetadataFactory.createTransformationMetadata(RealMetadataFactory.exampleBQTCached().getMetadataStore(), "bqt"));
// $NON-NLS-1$
context.getVDB().getModel("BQT3").setVisible(false);
// $NON-NLS-1$
context.getVDB().getModel("VQT").setVisible(false);
HashMap<String, DataPolicy> policies = new HashMap<String, DataPolicy>();
policies.put("foo", new DataPolicyMetadata());
context.setPolicies(policies);
ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class);
context.getVDB().addAttchment(ConnectorManagerRepository.class, repo);
Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(agds);
BufferManagerImpl bm = BufferManagerFactory.createBufferManager();
bm.setInlineLobs(false);
FakeBufferService bs = new FakeBufferService(bm, bm);
core = new DQPCore();
core.setBufferManager(bs.getBufferManager());
core.setResultsetCache(new SessionAwareCache<CachedResults>("resultset", new DefaultCacheFactory(new CacheConfiguration()), SessionAwareCache.Type.RESULTSET, 0));
core.setPreparedPlanCache(new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(new CacheConfiguration()), SessionAwareCache.Type.PREPAREDPLAN, 0));
core.setTransactionService(new FakeTransactionService());
config = new DQPConfiguration();
config.setMaxActivePlans(1);
config.setUserRequestSourceConcurrency(2);
DefaultAuthorizationValidator daa = new DefaultAuthorizationValidator();
daa.setPolicyDecider(new DataRolePolicyDecider());
config.setAuthorizationValidator(daa);
core.start(config);
core.getPrepPlanCache().setModTime(1);
core.getRsCache().setTupleBufferCache(bs.getBufferManager());
}
use of org.teiid.dqp.service.AutoGenDataService in project teiid by teiid.
the class TestPreparedStatement method helpGetProcessorPlan.
static PreparedStatementRequest helpGetProcessorPlan(String preparedSql, List<?> values, CapabilitiesFinder capFinder, QueryMetadataInterface metadata, SessionAwareCache<PreparedPlan> prepPlanCache, int conn, boolean callableStatement, boolean limitResults, VDBMetaData vdb) throws TeiidComponentException, TeiidProcessingException {
// Create Request
RequestMessage request = new RequestMessage(preparedSql);
if (callableStatement) {
request.setStatementType(StatementType.CALLABLE);
} else {
request.setStatementType(StatementType.PREPARED);
}
request.setParameterValues(values);
if (values != null && values.size() > 0 && values.get(0) instanceof List) {
request.setBatchedUpdate(true);
}
if (limitResults) {
request.setRowLimit(1);
}
DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
workContext.getSession().setSessionId(String.valueOf(conn));
PreparedStatementRequest serverRequest = new PreparedStatementRequest(prepPlanCache);
ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class);
Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(new AutoGenDataService());
serverRequest.initialize(request, BufferManagerFactory.getStandaloneBufferManager(), null, new FakeTransactionService(), null, workContext, prepPlanCache);
serverRequest.setMetadata(capFinder, metadata);
DefaultAuthorizationValidator drav = new DefaultAuthorizationValidator();
serverRequest.setAuthorizationValidator(drav);
serverRequest.processRequest();
assertNotNull(serverRequest.processPlan);
return serverRequest;
}
use of org.teiid.dqp.service.AutoGenDataService in project teiid by teiid.
the class TestJDBCSocketTransport method testSyncTimeout.
/**
* Tests to ensure that a SynchronousTtl/synchTimeout does
* not cause a cancel.
* TODO: had to increase the values since the test would fail on slow machine runs
* @throws Exception
*/
@Test
public void testSyncTimeout() throws Exception {
TeiidDriver td = new TeiidDriver();
td.setSocketProfile(new ConnectionProfile() {
@Override
public ConnectionImpl connect(String url, Properties info) throws TeiidSQLException {
SocketServerConnectionFactory sscf = new SocketServerConnectionFactory();
sscf.initialize(info);
try {
return new ConnectionImpl(sscf.getConnection(info), info, url);
} catch (CommunicationException e) {
throw TeiidSQLException.create(e);
} catch (ConnectionException e) {
throw TeiidSQLException.create(e);
}
}
});
Properties p = new Properties();
p.setProperty("user", "testuser");
p.setProperty("password", "testpassword");
ConnectorManagerRepository cmr = server.getConnectorManagerRepository();
AutoGenDataService agds = new AutoGenDataService() {
@Override
public Object getConnectionFactory() throws TranslatorException {
return null;
}
};
// wait longer than the synch ttl/soTimeout, we should still succeed
agds.setSleep(2000);
cmr.addConnectorManager("source", agds);
try {
conn = td.connect("jdbc:teiid:parts@mm://" + addr.getHostName() + ":" + jdbcTransport.getPort(), p);
Statement s = conn.createStatement();
assertTrue(s.execute("select * from parts"));
} finally {
server.setConnectorManagerRepository(cmr);
}
}
Aggregations