Search in sources :

Example 1 with ASTBitwiseNot

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

the class SelectQueryReturnTypesIT method testSelectBitwiseNot.

@Test
public void testSelectBitwiseNot() throws Exception {
    if (!accessStackAdapter.supportsBitwiseOps()) {
        return;
    }
    createNumericsDataSet();
    // to simplify result checking, do double NOT
    Expression left = new ASTBitwiseNot(new ASTBitwiseNot(new ASTObjPath(ReturnTypesMap1.INTEGER_COLUMN.getName())));
    Expression right = new ASTScalar(2);
    Expression greater = new ASTGreater();
    greater.setOperand(0, left);
    greater.setOperand(1, right);
    List<ReturnTypesMap1> objects = ObjectSelect.query(ReturnTypesMap1.class, greater).select(context);
    assertEquals(2, objects.size());
}
Also used : ASTGreater(org.apache.cayenne.exp.parser.ASTGreater) ASTObjPath(org.apache.cayenne.exp.parser.ASTObjPath) ASTBitwiseNot(org.apache.cayenne.exp.parser.ASTBitwiseNot) ReturnTypesMap1(org.apache.cayenne.testdo.return_types.ReturnTypesMap1) Expression(org.apache.cayenne.exp.Expression) ASTScalar(org.apache.cayenne.exp.parser.ASTScalar) Test(org.junit.Test)

Aggregations

Expression (org.apache.cayenne.exp.Expression)1 ASTBitwiseNot (org.apache.cayenne.exp.parser.ASTBitwiseNot)1 ASTGreater (org.apache.cayenne.exp.parser.ASTGreater)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