use of sqlite.kripton209.model2.BindApp2DataSource in project kripton by xcesco.
the class Test209Model2Runtime method testRunSqlite1.
@Test
public void testRunSqlite1() {
BindApp2DataSource ds = BindApp2DataSource.instance();
ds.execute(new Transaction() {
@Override
public TransactionResult onExecute(BindApp2DaoFactory 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;
}
});
}
Aggregations