use of org.apache.cayenne.access.jdbc.reader.DefaultRowReaderFactory in project cayenne by apache.
the class JDBCResultIteratorTest method testNextDataRow.
@Test
public void testNextDataRow() throws Exception {
Connection c = new MockConnection();
Statement s = new MockStatement(c);
MockResultSet rs = new MockResultSet("rs");
rs.addColumn("a", new Object[] { "1", "2", "3" });
RowDescriptor descriptor = new RowDescriptorBuilder().setResultSet(rs).getDescriptor(new ExtendedTypeMap());
RowReader<?> rowReader = new DefaultRowReaderFactory().rowReader(descriptor, new MockQueryMetadata(), mock(DbAdapter.class), Collections.<ObjAttribute, ColumnDescriptor>emptyMap());
JDBCResultIterator it = new JDBCResultIterator(s, rs, rowReader);
DataRow row = (DataRow) it.nextRow();
assertNotNull(row);
assertEquals(1, row.size());
assertEquals("1", row.get("a"));
}
use of org.apache.cayenne.access.jdbc.reader.DefaultRowReaderFactory in project cayenne by apache.
the class SchemaBuilder method initNode.
private void initNode(DataMap map) {
DataNode node = new DataNode(map.getName());
node.setJdbcEventLogger(jdbcEventLogger);
node.setAdapter(dbAdapter);
node.setDataSource(dataSourceFactory.getSharedDataSource());
// setup test extended types
node.getAdapter().getExtendedTypes().registerType(new StringET1ExtendedType());
// tweak mapping with a delegate
for (Procedure proc : map.getProcedures()) {
unitDbAdapter.tweakProcedure(proc);
}
filterDataMap(map);
node.addDataMap(map);
node.setSchemaUpdateStrategy(new SkipSchemaUpdateStrategy());
node.setRowReaderFactory(new DefaultRowReaderFactory());
node.setBatchTranslatorFactory(new DefaultBatchTranslatorFactory());
node.setSelectTranslatorFactory(new DefaultSelectTranslatorFactory());
domain.addNode(node);
}
Aggregations