Search in sources :

Example 1 with Transaction

use of sqlite.kripton64.BindBean64ADataSource.Transaction in project kripton by xcesco.

the class Test64BRuntime method testRunSqlite.

@Test
public void testRunSqlite() {
    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 2 with Transaction

use of sqlite.kripton64.BindBean64ADataSource.Transaction 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 3 with Transaction

use of sqlite.kripton64.BindBean64ADataSource.Transaction 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)

Aggregations

BaseAndroidTest (base.BaseAndroidTest)3 TransactionResult (com.abubusoft.kripton.android.sqlite.TransactionResult)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Test (org.junit.Test)3 Transaction (sqlite.kripton64.BindBean64ADataSource.Transaction)2 Transaction (sqlite.kripton64.BindBean64DataSource.Transaction)1