Search in sources :

Example 1 with ASTBitwiseXor

use of org.apache.cayenne.exp.parser.ASTBitwiseXor in project cayenne by apache.

the class SelectQueryReturnTypesIT method testSelectBitwiseXor.

@Test
public void testSelectBitwiseXor() throws Exception {
    if (!accessStackAdapter.supportsBitwiseOps()) {
        return;
    }
    createNumericsDataSet();
    // to simplify result checking, do double NOT
    Expression left = new ASTBitwiseXor(new Object[] { new ASTObjPath(ReturnTypesMap1.INTEGER_COLUMN.getName()), new ASTScalar(1) });
    Expression right = new ASTScalar(5);
    Expression equal = new ASTEqual();
    equal.setOperand(0, left);
    equal.setOperand(1, right);
    List<ReturnTypesMap1> objects = ObjectSelect.query(ReturnTypesMap1.class, equal).select(context);
    assertEquals(1, objects.size());
    assertEquals(4, objects.get(0).getIntegerColumn().intValue());
}
Also used : ASTObjPath(org.apache.cayenne.exp.parser.ASTObjPath) ReturnTypesMap1(org.apache.cayenne.testdo.return_types.ReturnTypesMap1) Expression(org.apache.cayenne.exp.Expression) ASTEqual(org.apache.cayenne.exp.parser.ASTEqual) ASTBitwiseXor(org.apache.cayenne.exp.parser.ASTBitwiseXor) ASTScalar(org.apache.cayenne.exp.parser.ASTScalar) Test(org.junit.Test)

Aggregations

Expression (org.apache.cayenne.exp.Expression)1 ASTBitwiseXor (org.apache.cayenne.exp.parser.ASTBitwiseXor)1 ASTEqual (org.apache.cayenne.exp.parser.ASTEqual)1 ASTObjPath (org.apache.cayenne.exp.parser.ASTObjPath)1 ASTScalar (org.apache.cayenne.exp.parser.ASTScalar)1 ReturnTypesMap1 (org.apache.cayenne.testdo.return_types.ReturnTypesMap1)1 Test (org.junit.Test)1