Search in sources :

Example 1 with BindApp1DataSource

use of sqlite.kripton209.model1.BindApp1DataSource in project kripton by xcesco.

the class Test209Model1Runtime method testRunSqlite1.

@Test
public void testRunSqlite1() {
    BindApp1DataSource ds = BindApp1DataSource.instance();
    ds.execute(new Transaction() {

        @Override
        public TransactionResult onExecute(BindApp1DaoFactory daoFactory) {
            Device device = new Device();
            device.name = "device-test";
            daoFactory.getDeviceDao().insert(device);
            User user = new User();
            user.userName = "user-test";
            daoFactory.getUserDao().insert(user);
            UserDevice userDevice = new UserDevice();
            userDevice.deviceId = device.id;
            userDevice.userId = user.id;
            daoFactory.getUserDeviceDao().insert(userDevice);
            List<Device> devices = daoFactory.getDeviceDao().getUserDevices(user.id);
            Assert.assertTrue(devices.size() == 1);
            return TransactionResult.ROLLBACK;
        }
    });
}
Also used : TransactionResult(com.abubusoft.kripton.android.sqlite.TransactionResult) User(sqlite.kripton209.model1.User) Transaction(sqlite.kripton209.model1.BindApp1DataSource.Transaction) BindApp1DataSource(sqlite.kripton209.model1.BindApp1DataSource) BindApp1DaoFactory(sqlite.kripton209.model1.BindApp1DaoFactory) UserDevice(sqlite.kripton209.model1.UserDevice) Device(sqlite.kripton209.model1.Device) List(java.util.List) UserDevice(sqlite.kripton209.model1.UserDevice) 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 BindApp1DaoFactory (sqlite.kripton209.model1.BindApp1DaoFactory)1 BindApp1DataSource (sqlite.kripton209.model1.BindApp1DataSource)1 Transaction (sqlite.kripton209.model1.BindApp1DataSource.Transaction)1 Device (sqlite.kripton209.model1.Device)1 User (sqlite.kripton209.model1.User)1 UserDevice (sqlite.kripton209.model1.UserDevice)1