use of sqlite.feature.typeadapter.kripton180.bean.BindKripton180BeanDataSource in project kripton by xcesco.
the class TestKripton180Runtime method testRun.
@Test
public void testRun() {
final Employee bean = new Employee();
bean.birthDate = new java.sql.Date((new java.util.Date()).getTime());
bean.fieldBoolean = "true";
bean.fieldByte = "42";
bean.fieldByteArray = "42";
bean.fieldCharacter = "a";
bean.fieldDouble = "120";
bean.fieldFloat = "120";
bean.fieldInteger = "11";
bean.fieldLong = "13";
bean.fieldShort = "2";
bean.fieldString = "a";
bean.hireDate = new java.sql.Date((new java.util.Date()).getTime());
BindKripton180BeanDataSource dataSource = BindKripton180BeanDataSource.instance();
dataSource.execute(new BindKripton180BeanDataSource.Transaction() {
@Override
public TransactionResult onExecute(BindKripton180BeanDaoFactory daoFactory) {
EmployeeBeanDaoImpl dao = daoFactory.getEmployeeBeanDao();
dao.insert(bean);
Assert.assertTrue(bean.id > 0);
Employee readResult = dao.selectById(bean);
Assert.assertTrue(readResult.fieldBoolean.equals(bean.fieldBoolean));
Assert.assertTrue(readResult.birthDate.toString().equals(bean.birthDate.toString()));
dao.update(bean);
readResult = dao.selectById(bean);
Assert.assertTrue(Double.valueOf(readResult.fieldDouble).equals(Double.valueOf(bean.fieldDouble)));
Assert.assertTrue(readResult.fieldString.equals(bean.fieldString));
long result = dao.deleteById(bean);
Assert.assertTrue(result == 1);
return TransactionResult.ROLLBACK;
}
});
}
use of sqlite.feature.typeadapter.kripton180.bean.BindKripton180BeanDataSource in project kripton by xcesco.
the class TestKripton180Runtime method testRunJQL.
@Test
public void testRunJQL() {
final Employee bean = new Employee();
bean.birthDate = new java.sql.Date((new java.util.Date()).getTime());
bean.fieldBoolean = "true";
bean.fieldByte = "42";
bean.fieldByteArray = "42";
bean.fieldCharacter = "a";
bean.fieldDouble = "120";
bean.fieldFloat = "120";
bean.fieldInteger = "11";
bean.fieldLong = "13";
bean.fieldShort = "2";
bean.fieldString = "a";
bean.hireDate = new java.sql.Date((new java.util.Date()).getTime());
BindKripton180BeanDataSource dataSource = BindKripton180BeanDataSource.instance();
dataSource.execute(new BindKripton180BeanDataSource.Transaction() {
@Override
public TransactionResult onExecute(BindKripton180BeanDaoFactory daoFactory) {
EmployeeBeanDaoImpl dao = daoFactory.getEmployeeBeanDao();
dao.insertJQL(bean);
Assert.assertTrue(bean.id > 0);
Employee readResult = dao.selectByIdJQL(bean);
Assert.assertTrue(readResult.fieldBoolean.equals(bean.fieldBoolean));
Assert.assertTrue(readResult.fieldLong.toString().equals(bean.fieldLong.toString()));
dao.update(bean);
readResult = dao.selectByIdJQL(bean);
Assert.assertTrue(Double.valueOf(readResult.fieldDouble).equals(Double.valueOf(bean.fieldDouble)));
Assert.assertTrue(readResult.fieldString.equals(bean.fieldString));
long result = dao.deleteById(bean);
Assert.assertTrue(result == 1);
return TransactionResult.ROLLBACK;
}
});
}
Aggregations