use of org.teiid.query.sql.symbol.ElementSymbol in project teiid by teiid.
the class TestSelect method testGetProjectedWithStar.
public void testGetProjectedWithStar() {
List symbols = new ArrayList();
// $NON-NLS-1$
symbols.add(new ElementSymbol("a"));
// $NON-NLS-1$
symbols.add(new ElementSymbol("b"));
Select select = new Select();
MultipleElementSymbol all = new MultipleElementSymbol();
all.setElementSymbols(symbols);
select.addSymbol(all);
List projectedSymbols = select.getProjectedSymbols();
// $NON-NLS-1$
assertEquals("Did not get correct list for select *: ", symbols, projectedSymbols);
}
use of org.teiid.query.sql.symbol.ElementSymbol in project teiid by teiid.
the class TestSetCriteria method sample1.
public static final SetCriteria sample1() {
SetCriteria c1 = new SetCriteria();
// $NON-NLS-1$
c1.setExpression(new ElementSymbol("e1"));
List vals = new ArrayList();
// $NON-NLS-1$
vals.add(new Constant("a"));
// $NON-NLS-1$
vals.add(new Constant("b"));
c1.setValues(vals);
return c1;
}
use of org.teiid.query.sql.symbol.ElementSymbol in project teiid by teiid.
the class TestSetCriteria method testNonHashableClone.
@Test
public void testNonHashableClone() {
SetCriteria c1 = new SetCriteria();
// $NON-NLS-1$
c1.setExpression(new ElementSymbol("e1"));
TreeSet vals = new TreeSet();
vals.add(new Constant(BigDecimal.valueOf(1.1)));
vals.add(new Constant(BigDecimal.valueOf(1.2)));
c1.setValues(vals);
c1.setAllConstants(true);
SetCriteria c2 = (SetCriteria) c1.clone();
assertTrue(c2.getValues() instanceof TreeSet);
}
use of org.teiid.query.sql.symbol.ElementSymbol in project teiid by teiid.
the class TestSetCriteria method sample2.
public static final SetCriteria sample2() {
SetCriteria c1 = new SetCriteria();
// $NON-NLS-1$
c1.setExpression(new ElementSymbol("e2"));
List vals = new ArrayList();
// $NON-NLS-1$
vals.add(new Constant("c"));
// $NON-NLS-1$
vals.add(new Constant("d"));
c1.setValues(vals);
return c1;
}
use of org.teiid.query.sql.symbol.ElementSymbol in project teiid by teiid.
the class TestSetQuery method test2.
public void test2() {
Query q1 = new Query();
Select select = new Select();
// $NON-NLS-1$
select.addSymbol(new ElementSymbol("x"));
q1.setSelect(select);
From from = new From();
// $NON-NLS-1$
from.addGroup(new GroupSymbol("g"));
q1.setFrom(from);
Query q2 = new Query();
select = new Select();
// $NON-NLS-1$
select.addSymbol(new ElementSymbol("y"));
q2.setSelect(select);
from = new From();
// $NON-NLS-1$
from.addGroup(new GroupSymbol("h"));
q2.setFrom(from);
SetQuery sq = new SetQuery(Operation.INTERSECT);
sq.setAll(false);
sq.setLeftQuery(q1);
sq.setRightQuery(q2);
assertEquals(// $NON-NLS-1$
"Query combiner string doesn't match expected: ", // $NON-NLS-1$
"SELECT x FROM g INTERSECT SELECT y FROM h", sq.toString());
}
Aggregations