use of sqlite.kripton84.BindBean84ADataSource.Transaction in project kripton by xcesco.
the class Test84RuntimeA method testRunSqlite.
@Test
public void testRunSqlite() throws IOException, InstantiationException, IllegalAccessException {
Assert.assertNotNull(Bean84ATable.class.getName() != null);
Assert.assertNotNull(Bean84ADaoImpl.class.getName() != null);
BindBean84ADataSource dataSource = BindBean84ADataSource.instance();
// dataSource.openWritableDatabase();
dataSource.execute(new Transaction() {
@Override
public TransactionResult onExecute(BindBean84ADaoFactory daoFactory) {
Bean84ADaoImpl dao = daoFactory.getBean84ADao();
Bean84A bean = new Bean84A();
bean.valueString = "hello";
dao.insertAll(bean);
List<Bean84A> list = dao.selectById(bean.id);
Assert.assertEquals("not list ", 1, list.size());
Assert.assertEquals("not map", 1, list.size());
return TransactionResult.COMMIT;
}
});
}
use of sqlite.kripton84.BindBean84ADataSource.Transaction in project kripton by xcesco.
the class Test84RuntimeB method testRun.
@Test
public void testRun() throws IOException, InstantiationException, IllegalAccessException {
Assert.assertNotNull(Bean84BTable.class.getName() != null);
Assert.assertNotNull(Bean84BDaoImpl.class.getName() != null);
BindBean84BDataSource dataSource = BindBean84BDataSource.instance();
dataSource.execute(new Transaction() {
@Override
public TransactionResult onExecute(BindBean84BDaoFactory daoFactory) {
Bean84BDaoImpl dao = daoFactory.getBean84BDao();
Bean84B2 innerBean = new Bean84B2();
innerBean.columnString = "test01";
Bean84B bean = new Bean84B();
bean.columnBean = innerBean;
dao.insert(bean);
Bean84B bean2 = dao.selectById(bean.id);
assertTrue(bean.equals(bean2));
Bean84B bean3 = dao.selectByBean(innerBean);
assertTrue(bean.equals(bean3));
return TransactionResult.COMMIT;
}
});
}
Aggregations