Search in sources :

Example 6 with ClientMtTable1Subclass1

use of org.apache.cayenne.testdo.mt.ClientMtTable1Subclass1 in project cayenne by apache.

the class ValueInjectorIT method testClient.

@Test
public void testClient() {
    ObjectContext context = createROPContext();
    ObjEntity entity = context.getEntityResolver().getObjEntity(ClientMtTable1Subclass1.class);
    Expression qualifier = entity.getDeclaredQualifier();
    try {
        ClientMtTable1Subclass1 ee = context.newObject(ClientMtTable1Subclass1.class);
        assertEquals(ee.getGlobalAttribute1(), "sub1");
        // check AND
        entity.setDeclaredQualifier(qualifier.andExp(ExpressionFactory.exp("serverAttribute1 = 'sa'")));
        ee = context.newObject(ClientMtTable1Subclass1.class);
        assertEquals(ee.getGlobalAttribute1(), "sub1");
        assertEquals(ee.getServerAttribute1(), "sa");
    } finally {
        entity.setDeclaredQualifier(qualifier);
    }
}
Also used : ClientMtTable1Subclass1(org.apache.cayenne.testdo.mt.ClientMtTable1Subclass1) ObjEntity(org.apache.cayenne.map.ObjEntity) Expression(org.apache.cayenne.exp.Expression) ObjectContext(org.apache.cayenne.ObjectContext) Test(org.junit.Test)

Aggregations

ClientMtTable1Subclass1 (org.apache.cayenne.testdo.mt.ClientMtTable1Subclass1)6 Test (org.junit.Test)6 SelectQuery (org.apache.cayenne.query.SelectQuery)4 ClientMtTable1 (org.apache.cayenne.testdo.mt.ClientMtTable1)2 ObjectContext (org.apache.cayenne.ObjectContext)1 QueryResponse (org.apache.cayenne.QueryResponse)1 Expression (org.apache.cayenne.exp.Expression)1 ObjEntity (org.apache.cayenne.map.ObjEntity)1