use of org.teiid.cache.DefaultCacheFactory in project teiid by teiid.
the class TestDataTierManager method helpSetupDataTierManager.
private void helpSetupDataTierManager() {
FakeBufferService bs = new FakeBufferService();
rm = new DQPCore();
rm.setTransactionService(new FakeTransactionService());
rm.setBufferManager(bs.getBufferManager());
CacheConfiguration config = new CacheConfiguration();
config.setMaxAgeInSeconds(-1);
rm.setResultsetCache(new SessionAwareCache<CachedResults>("resultset", new DefaultCacheFactory(config), SessionAwareCache.Type.RESULTSET, 0));
rm.setPreparedPlanCache(new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(config), SessionAwareCache.Type.PREPAREDPLAN, 0));
rm.start(new DQPConfiguration());
ConnectorManagerRepository repo = Mockito.mock(ConnectorManagerRepository.class);
Mockito.stub(repo.getConnectorManager(Mockito.anyString())).toReturn(connectorManager);
vdb.addAttchment(ConnectorManagerRepository.class, repo);
dtm = new DataTierManagerImpl(rm, bs.getBufferManager(), true);
}
use of org.teiid.cache.DefaultCacheFactory in project teiid by teiid.
the class TestMetaDataProcessor method helpTestQuery.
private MetadataResult helpTestQuery(QueryMetadataInterface metadata, String sql, VDBMetaData vdb) throws Exception {
// Create components
SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(new CacheConfiguration()), SessionAwareCache.Type.PREPAREDPLAN, 0);
// Initialize components
MetaDataProcessor mdProc = new MetaDataProcessor(new DQPCore(), prepPlanCache, "MyVDB", 1);
DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
return mdProc.processMessage(workContext.getRequestID(1), workContext, sql, true);
}
use of org.teiid.cache.DefaultCacheFactory 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.cache.DefaultCacheFactory in project teiid by teiid.
the class TestMetaDataProcessor method helpGetMetadata.
public Map[] helpGetMetadata(String sql, QueryMetadataInterface metadata, VDBMetaData vdb) throws Exception {
// Prepare sql
Command command = QueryParser.getQueryParser().parseCommand(sql);
QueryResolver.resolveCommand(command, metadata);
// Create components
SessionAwareCache<PreparedPlan> prepPlanCache = new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(new CacheConfiguration()), SessionAwareCache.Type.PREPAREDPLAN, 0);
DQPCore requestMgr = new DQPCore();
requestMgr.setTransactionService(new FakeTransactionService());
DQPWorkContext workContext = RealMetadataFactory.buildWorkContext(metadata, vdb);
// Initialize components
RequestID requestID = workContext.getRequestID(1);
RequestMessage requestMsg = new RequestMessage(sql);
TestDQPCoreRequestHandling.addRequest(requestMgr, requestMsg, requestID, command, null);
MetaDataProcessor mdProc = new MetaDataProcessor(requestMgr, prepPlanCache, "MyVDB", 1);
return mdProc.processMessage(requestID, workContext, null, true).getColumnMetadata();
}
use of org.teiid.cache.DefaultCacheFactory in project teiid by teiid.
the class TestPreparedPlanCache method testNegativeSizeCacheUsesDefault.
// set init size to negative number, which should default to max
@Test
public void testNegativeSizeCacheUsesDefault() {
CacheConfiguration config = new CacheConfiguration();
config.setMaxEntries(-1);
new SessionAwareCache<PreparedPlan>("preparedplan", new DefaultCacheFactory(config), SessionAwareCache.Type.PREPAREDPLAN, 0);
// -1 means unlimited in the infinispan
}
Aggregations