use of org.apache.cayenne.exp.parser.ASTObjPath in project cayenne by apache.
the class SelectQueryReturnTypesIT method testSelectBitwiseAnd.
@Test
public void testSelectBitwiseAnd() throws Exception {
if (!accessStackAdapter.supportsBitwiseOps()) {
return;
}
createNumericsDataSet();
// to simplify result checking, do double NOT
Expression left = new ASTBitwiseAnd(new Object[] { new ASTObjPath(ReturnTypesMap1.INTEGER_COLUMN.getName()), new ASTScalar(1) });
Expression right = new ASTScalar(0);
Expression equal = new ASTEqual();
equal.setOperand(0, left);
equal.setOperand(1, right);
SelectQuery query = new SelectQuery(ReturnTypesMap1.class);
query.setQualifier(equal);
List<ReturnTypesMap1> objects = context.performQuery(query);
assertEquals(3, objects.size());
}
use of org.apache.cayenne.exp.parser.ASTObjPath in project cayenne by apache.
the class SelectQueryReturnTypesIT method testSelectBitwiseOr.
@Test
public void testSelectBitwiseOr() throws Exception {
if (!accessStackAdapter.supportsBitwiseOps()) {
return;
}
createNumericsDataSet();
// to simplify result checking, do double NOT
Expression left = new ASTBitwiseOr(new Object[] { new ASTObjPath(ReturnTypesMap1.INTEGER_COLUMN.getName()), new ASTScalar(1) });
Expression right = new ASTScalar(1);
Expression equal = new ASTEqual();
equal.setOperand(0, left);
equal.setOperand(1, right);
SelectQuery query = new SelectQuery(ReturnTypesMap1.class);
query.setQualifier(equal);
List<ReturnTypesMap1> objects = context.performQuery(query);
assertEquals(2, objects.size());
}
use of org.apache.cayenne.exp.parser.ASTObjPath in project cayenne by apache.
the class LikeExpressionHelperTest method testEscape_OneChar.
@Test
public void testEscape_OneChar() {
PatternMatchNode node = new ASTLike(new ASTObjPath("x"), "ab_c");
LikeExpressionHelper.escape(node);
assertEquals("ab!_c", node.getOperand(1));
assertEquals('!', node.getEscapeChar());
}
use of org.apache.cayenne.exp.parser.ASTObjPath in project cayenne by apache.
the class LikeExpressionHelperTest method testEscape_NoEscapeChars.
@Test
public void testEscape_NoEscapeChars() {
PatternMatchNode node = new ASTLike(new ASTObjPath("x"), "abc");
LikeExpressionHelper.escape(node);
assertEquals("abc", node.getOperand(1));
assertEquals(0, node.getEscapeChar());
}
use of org.apache.cayenne.exp.parser.ASTObjPath in project cayenne by apache.
the class LikeExpressionHelperTest method testEscape_TwoChars.
@Test
public void testEscape_TwoChars() {
PatternMatchNode node = new ASTLike(new ASTObjPath("x"), "ab_c_");
LikeExpressionHelper.escape(node);
assertEquals("ab!_c!_", node.getOperand(1));
assertEquals('!', node.getEscapeChar());
}
Aggregations