use of org.apache.cayenne.testdo.table_primitives.ClientTablePrimitives in project cayenne by apache.
the class CayenneContextPrimitiveIT method testSelectEmptyPrimitives.
@Test
public void testSelectEmptyPrimitives() throws Exception {
tTablePrimitives.insert(1, accessStackAdapter.supportsBoolean() ? true : 1, null);
ClientTablePrimitives object = ObjectSelect.query(ClientTablePrimitives.class).selectFirst(context);
assertTrue(object.isBooleanColumn());
assertEquals(0, object.getIntColumn());
}
use of org.apache.cayenne.testdo.table_primitives.ClientTablePrimitives in project cayenne by apache.
the class CayenneContextPrimitiveIT method testCommitChangesPrimitives.
@Test
public void testCommitChangesPrimitives() throws Exception {
ClientTablePrimitives object = context.newObject(ClientTablePrimitives.class);
object.setBooleanColumn(true);
object.setIntColumn(3);
context.commitChanges();
assertTrue(tTablePrimitives.getBoolean("BOOLEAN_COLUMN"));
assertEquals(3, tTablePrimitives.getInt("INT_COLUMN"));
object.setBooleanColumn(false);
object.setIntColumn(8);
context.commitChanges();
assertFalse(tTablePrimitives.getBoolean("BOOLEAN_COLUMN"));
assertEquals(8, tTablePrimitives.getInt("INT_COLUMN"));
}
use of org.apache.cayenne.testdo.table_primitives.ClientTablePrimitives in project cayenne by apache.
the class CayenneContextPrimitiveIT method testSelectPrimitives.
@Test
public void testSelectPrimitives() throws Exception {
createTwoPrimitivesDataSet();
SelectQuery query = new SelectQuery(ClientTablePrimitives.class);
query.addOrdering("db:" + TablePrimitives.ID_PK_COLUMN, SortOrder.ASCENDING);
List<ClientTablePrimitives> results = context.performQuery(query);
assertTrue(results.get(0).isBooleanColumn());
assertFalse(results.get(1).isBooleanColumn());
assertEquals(0, results.get(0).getIntColumn());
assertEquals(5, results.get(1).getIntColumn());
}
use of org.apache.cayenne.testdo.table_primitives.ClientTablePrimitives in project cayenne by apache.
the class CayenneContextPrimitiveIT method testCommitEmptyChangesPrimitives.
@Test
public void testCommitEmptyChangesPrimitives() throws Exception {
ClientTablePrimitives object = context.newObject(ClientTablePrimitives.class);
context.commitChanges();
assertFalse(tTablePrimitives.getBoolean("BOOLEAN_COLUMN"));
assertEquals(0, tTablePrimitives.getInt("INT_COLUMN"));
object.setBooleanColumn(true);
object.setIntColumn(8);
context.commitChanges();
assertTrue(tTablePrimitives.getBoolean("BOOLEAN_COLUMN"));
assertEquals(8, tTablePrimitives.getInt("INT_COLUMN"));
}
Aggregations