use of org.teiid.query.sql.lang.SetCriteria in project teiid by teiid.
the class TestDependentCriteriaProcessor method testEvaluatedSetCriteria.
@Test
public void testEvaluatedSetCriteria() throws Exception {
DependentAccessNode dan = new DependentAccessNode(0);
CommandContext cc = new CommandContext();
dan.setContext(cc);
List<Reference> references = Arrays.asList(new Reference(1), new Reference(2));
for (Reference reference : references) {
cc.getVariableContext().setGlobalValue(reference.getContextSymbol(), 1);
}
// $NON-NLS-1$
SetCriteria sc = new SetCriteria(new ElementSymbol("e1"), references);
sc.setAllConstants(true);
DependentCriteriaProcessor dcp = new DependentCriteriaProcessor(1, -1, dan, sc);
Criteria result = dcp.prepareCriteria();
// $NON-NLS-1$
assertEquals(new CompareCriteria(new ElementSymbol("e1"), CompareCriteria.EQ, new Constant(1)), result);
assertFalse(dcp.hasNextCommand());
}
use of org.teiid.query.sql.lang.SetCriteria in project teiid by teiid.
the class TestExpressionMappingVisitor method testSetCriteria.
@Test
public void testSetCriteria() {
// $NON-NLS-1$
ElementSymbol e1 = new ElementSymbol("e1");
// $NON-NLS-1$
ElementSymbol e2 = new ElementSymbol("e2");
// $NON-NLS-1$
Constant c1 = new Constant("xyz");
// $NON-NLS-1$
Constant c2 = new Constant("abc");
// $NON-NLS-1$
Constant c3 = new Constant("def");
List<Expression> values = new ArrayList<Expression>();
values.add(c1);
values.add(c2);
List<Expression> mappedValues = new ArrayList<Expression>();
mappedValues.add(c1);
mappedValues.add(c3);
Map<Expression, Expression> map = new HashMap<Expression, Expression>();
map.put(e1, e2);
map.put(c2, c3);
SetCriteria before = new SetCriteria(e1, values);
SetCriteria after = new SetCriteria(e2, mappedValues);
helpTest(before, map, after);
}
Aggregations