Search in sources :

Example 1 with BindFamilyDataSource

use of sqlite.feature.jql.persistence.BindFamilyDataSource in project kripton by xcesco.

the class TestFeatJQLRuntime method testJQL1.

@Test
public void testJQL1() {
    BindFamilyDataSource dataSource = BindFamilyDataSource.instance();
    // transaction to insert elements
    dataSource.execute(new BindFamilyDataSource.Transaction() {

        @Override
        public TransactionResult onExecute(BindFamilyDaoFactory daoFactory) {
            // TODO Auto-generated method stub
            Person person = new Person();
            person.name = "Tonj Manero";
            daoFactory.getDaoPerson().insertBean(person);
            Child child = new Child();
            child.name = "Luna";
            child.parentId = person.id;
            daoFactory.getDaoChild().insertBean(child);
            daoFactory.getDaoChild().insertBean(child);
            List<Child> list = daoFactory.getDaoChild().selectByParent(person.id);
            assertTrue(2 == list.size());
            for (int i = 0; i < list.size(); i++) {
                assertTrue(list.get(i).name.equals("Luna"));
            }
            return TransactionResult.COMMIT;
        }
    });
}
Also used : BindFamilyDaoFactory(sqlite.feature.jql.persistence.BindFamilyDaoFactory) TransactionResult(com.abubusoft.kripton.android.sqlite.TransactionResult) BindFamilyDataSource(sqlite.feature.jql.persistence.BindFamilyDataSource) List(java.util.List) Person(sqlite.feature.jql.entities.Person) Child(sqlite.feature.jql.entities.Child) Test(org.junit.Test) BaseAndroidTest(base.BaseAndroidTest)

Aggregations

BaseAndroidTest (base.BaseAndroidTest)1 TransactionResult (com.abubusoft.kripton.android.sqlite.TransactionResult)1 List (java.util.List)1 Test (org.junit.Test)1 Child (sqlite.feature.jql.entities.Child)1 Person (sqlite.feature.jql.entities.Person)1 BindFamilyDaoFactory (sqlite.feature.jql.persistence.BindFamilyDaoFactory)1 BindFamilyDataSource (sqlite.feature.jql.persistence.BindFamilyDataSource)1