Search in sources :

Example 26 with TransactionResult

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;
        }
    });
}
Also used : TransactionResult(com.abubusoft.kripton.android.sqlite.TransactionResult) Transaction(sqlite.kripton64.BindBean64ADataSource.Transaction) HashMap(java.util.HashMap) List(java.util.List) HashSet(java.util.HashSet) Test(org.junit.Test) BaseAndroidTest(base.BaseAndroidTest)

Example 27 with TransactionResult

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;
        }
    });
}
Also used : TransactionResult(com.abubusoft.kripton.android.sqlite.TransactionResult) Transaction(sqlite.kripton64.BindBean64DataSource.Transaction) HashMap(java.util.HashMap) List(java.util.List) HashSet(java.util.HashSet) Test(org.junit.Test) BaseAndroidTest(base.BaseAndroidTest)

Example 28 with TransactionResult

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;
        }
    });
}
Also used : TransactionResult(com.abubusoft.kripton.android.sqlite.TransactionResult) Transaction(sqlite.kripton84.BindBean84BDataSource.Transaction) Test(org.junit.Test) BaseAndroidTest(base.BaseAndroidTest)

Aggregations

TransactionResult (com.abubusoft.kripton.android.sqlite.TransactionResult)28 BaseAndroidTest (base.BaseAndroidTest)27 Test (org.junit.Test)27 List (java.util.List)13 Transaction (sqlite.feature.foreignKey.BindDummyDataSource.Transaction)4 One (com.abubusoft.kripton.common.One)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 Country (sqlite.feature.rx.model.Country)3 BindXenoDaoFactory (sqlite.feature.rx.persistence.BindXenoDaoFactory)3 BindXenoDataSource (sqlite.feature.rx.persistence.BindXenoDataSource)3 CountryDaoImpl (sqlite.feature.rx.persistence.CountryDaoImpl)3 Person (sqlite.feature.speed.model.Person)3 BindPersonDaoFactory (sqlite.feature.speed.persistence.BindPersonDaoFactory)3 BindPersonDataSource (sqlite.feature.speed.persistence.BindPersonDataSource)3 Transaction (sqlite.feature.speed.persistence.BindPersonDataSource.Transaction)3 PersonDaoImpl (sqlite.feature.speed.persistence.PersonDaoImpl)3 ArrayList (java.util.ArrayList)2 BindKripton180BeanDaoFactory (sqlite.feature.typeadapter.kripton180.bean.BindKripton180BeanDaoFactory)2 BindKripton180BeanDataSource (sqlite.feature.typeadapter.kripton180.bean.BindKripton180BeanDataSource)2