use of com.abubusoft.kripton.android.sqlite.TransactionResult in project kripton by xcesco.
the class Test64ARuntime method testRunSqlite.
@Test
public void testRunSqlite() throws IOException, InstantiationException, IllegalAccessException {
BindBean64ADataSource dataSource = BindBean64ADataSource.instance();
dataSource.execute(new Transaction() {
@Override
public TransactionResult onExecute(BindBean64ADaoFactory daoFactory) {
Bean64ADaoImpl dao = daoFactory.getBean64ADao();
Bean64A bean = new Bean64A();
bean.valueString = "hello";
bean.valueMapStringBean = new HashMap<>();
bean.valueMapStringBean.put("key1", new Bean64A());
bean.valueSetString = new HashSet<String>();
bean.valueSetString.add("hello");
dao.insert(bean);
List<Bean64A> list = dao.selectList(bean.id);
Assert.assertEquals("not list ", 1, list.size());
Assert.assertEquals("not map", 1, list.size());
Assert.assertEquals("not set", 1, list.get(0).valueSetString.size());
return TransactionResult.COMMIT;
}
});
}
use of com.abubusoft.kripton.android.sqlite.TransactionResult in project kripton by xcesco.
the class Test64Runtime method testRunSqlite.
@Test
public void testRunSqlite() throws IOException, InstantiationException, IllegalAccessException {
BindBean64DataSource dataSource = BindBean64DataSource.instance();
dataSource.execute(new Transaction() {
@Override
public TransactionResult onExecute(BindBean64DaoFactory daoFactory) {
Bean64DaoImpl dao = daoFactory.getBean64Dao();
Bean64 bean = new Bean64();
bean.valueString = "hello";
bean.valueMapStringBean = new HashMap<>();
bean.valueMapStringBean.put("key1", new Bean64());
bean.valueSetString = new HashSet<String>();
bean.valueSetString.add("hello");
dao.insert(bean);
List<Bean64> list = dao.selectList(bean.id);
Assert.assertEquals("not list ", 1, list.size());
Assert.assertEquals("not set", 1, list.get(0).valueSetString.size());
return TransactionResult.COMMIT;
}
});
}
use of com.abubusoft.kripton.android.sqlite.TransactionResult 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