use of com.abubusoft.kripton.android.sqlite.OnReadBeanListener in project kripton by xcesco.
the class TestRx method testRunSyncWithListener.
@Test
public void testRunSyncWithListener() {
BindXenoDataSource dataSource = BindXenoDataSource.instance();
dataSource.execute(new BindXenoDataSource.Transaction() {
@Override
public TransactionResult onExecute(BindXenoDaoFactory daoFactory) {
CountryDaoImpl dao = daoFactory.getCountryDao();
for (int i = 0; i < COUNTER; i++) {
Country bean = new Country();
bean.code = "code" + i;
bean.callingCode = "" + i;
bean.name = "name" + i;
// Object bean = new
dao.insert(bean);
}
dao.selectAll();
return TransactionResult.COMMIT;
}
});
dataSource.execute(new BindXenoDataSource.Transaction() {
@Override
public TransactionResult onExecute(BindXenoDaoFactory daoFactory) {
System.out.println("onSubscribe");
CountryDaoImpl dao = daoFactory.getCountryDao();
dao.selectAll(new OnReadBeanListener<Country>() {
@Override
public void onRead(Country bean, int row, int rowCount) {
System.out.println("onNext" + bean);
}
});
System.out.println("onComplete");
return TransactionResult.COMMIT;
}
});
}
Aggregations