use of org.teiid.resource.adapter.coherence.CoherenceManagedConnectionFactory in project teiid by teiid.
the class TestCoherenceTranslator method setUp.
@Override
protected void setUp() throws Exception {
// TODO Auto-generated method stub
super.setUp();
new TradesCacheSource().addMetadata();
CoherenceManagedConnectionFactory connFactory = new CoherenceManagedConnectionFactory();
connFactory.setCacheName(TradesCacheSource.CACHE_NAME);
connFactory.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
CoherenceConnection conn = (CoherenceConnection) connFactory.createConnectionFactory().getConnection();
CoherenceExecutionFactory execFactory = new CoherenceExecutionFactory();
host = new ConnectorHost(execFactory, conn, // getTradeTranslationUtility());
UnitTestUtil.getTestDataPath() + "/Coherence_Designer_Project/Trade.vdb");
}
use of org.teiid.resource.adapter.coherence.CoherenceManagedConnectionFactory in project teiid by teiid.
the class TestCoherenceConnection method testEqualOnTrade.
@Test
public void testEqualOnTrade() throws Exception {
CoherenceManagedConnectionFactory f = new CoherenceManagedConnectionFactory();
f.setCacheName(CACHE_NAME);
f.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
CoherenceConnection conn = (CoherenceConnection) f.createConnectionFactory().getConnection();
// NOTE: Coherence, because the datatype of ID is long, wants the "l" appended to the value
Filter criteria = CoherenceFilterUtil.createFilter("Id = 1l");
List<?> trades = conn.get(criteria);
assertNotNull(trades);
assertEquals("Did not get expected number of trades", 1, trades.size());
long l = 1;
criteria = CoherenceFilterUtil.createCompareFilter("Id", l, Comparison.Operator.EQ, Long.class);
trades = conn.get(criteria);
assertNotNull(trades);
assertEquals("Did not get expected number of trades", 1, trades.size());
}
use of org.teiid.resource.adapter.coherence.CoherenceManagedConnectionFactory in project teiid by teiid.
the class TestCoherenceConnection method testIn.
@Test
public void testIn() throws Exception {
CoherenceManagedConnectionFactory f = new CoherenceManagedConnectionFactory();
f.setCacheName(CACHE_NAME);
f.setCacheTranslatorClassName(OBJECT_TRANSLATOR);
CoherenceConnection conn = (CoherenceConnection) f.createConnectionFactory().getConnection();
// NOTE: Coherence, because the datatype of ID is long, wants the "l" appended to the value
Filter criteria = CoherenceFilterUtil.createFilter("Id In (1l)");
List<?> trades = conn.get(criteria);
assertNotNull(trades);
assertEquals("Did not get expected number of trades", 1, trades.size());
}
Aggregations