public void testGetSelectSymbols() throws Exception { List symbols = example(false).getDerivedColumns(); assertNotNull(symbols); assertEquals(4, symbols.size()); for (Iterator i = symbols.iterator(); i.hasNext();) { assertTrue(i.next() instanceof DerivedColumn); } }
public void testIsDistinct() throws Exception { assertTrue(example(true).isDistinct()); assertFalse(example(false).isDistinct()); }
public void testGetSelect() throws Exception { assertNotNull(example(true).getDerivedColumns()); }
public static Select example(boolean distinct) throws Exception { return TstLanguageBridgeFactory.factory.translate(helpExample(distinct)); }
public void testGetColumnTypes() throws Exception { Class[] expected = {String.class, String.class, String.class, String.class}; Class[] types = example(true).getColumnTypes(); assertTrue(EquivalenceUtil.areEquivalent(expected, types)); }
public static Query helpExample(boolean distinct) { return new Query(helpExampleSelect(distinct), TestQueryImpl.helpExampleFrom(), TestCompoundCriteriaImpl.helpExample(CompoundCriteria.AND), TestGroupByImpl.helpExample(), TestCompoundCriteriaImpl.helpExample(CompoundCriteria.AND), TestOrderByImpl.helpExample(), null); }
public void testGetHaving() throws Exception { assertNotNull(example(true).getHaving()); }
public static SubqueryFromClause helpExample() { return new SubqueryFromClause("xyz", TestQueryImpl.helpExample(true)); //$NON-NLS-1$ }
public void testGetColumnNames() throws Exception { String[] expected = new String[4]; String[] names = example(true).getColumnNames(); assertTrue(EquivalenceUtil.areEquivalent(expected, names)); }
public void testGetFrom() throws Exception { assertNotNull(example(true).getFrom()); }
public static SubqueryCompareCriteria helpExample() { ElementSymbol element = TestElementImpl.helpExample("g1", "e1"); //$NON-NLS-1$ //$NON-NLS-2$ Query query = TestQueryImpl.helpExample(true); SubqueryCompareCriteria scc = new SubqueryCompareCriteria(element, query, AbstractCompareCriteria.GT, SubqueryCompareCriteria.ANY); return scc; }
public void testGetWhere() throws Exception { assertNotNull(example(true).getWhere()); }
public static ExistsCriteria helpExample(boolean negated) { ExistsCriteria crit = new ExistsCriteria(TestQueryImpl.helpExample(true)); crit.setNegated(negated); return crit; }
public void testGetGroupBy() throws Exception { assertNotNull(example(true).getGroupBy()); }
public static SubquerySetCriteria helpExample() { ElementSymbol element = TestElementImpl.helpExample("g1", "e1"); //$NON-NLS-1$ //$NON-NLS-2$ Query query = TestQueryImpl.helpExample(true); SubquerySetCriteria ssc = new SubquerySetCriteria(element, query); ssc.setNegated(true); return ssc; }
public void testGetOrderBy() throws Exception { assertNotNull(example(true).getOrderBy()); }
public static org.teiid.query.sql.lang.SetQuery helpExampleSetQuery() { org.teiid.query.sql.lang.SetQuery setQuery = new org.teiid.query.sql.lang.SetQuery(Operation.UNION); setQuery.setAll(false); setQuery.setLeftQuery(TestQueryImpl.helpExample(true)); setQuery.setRightQuery(TestQueryImpl.helpExample(true)); setQuery.setOrderBy(TestOrderByImpl.helpExample()); return setQuery; }
public static org.teiid.query.sql.symbol.ScalarSubquery helpExample() { Query query = TestQueryImpl.helpExample(true); org.teiid.query.sql.symbol.ScalarSubquery ss = new org.teiid.query.sql.symbol.ScalarSubquery(query); ss.setType(((Expression)query.getProjectedSymbols().get(0)).getType()); return ss; }
public void testGetType() throws Exception { Select query = TstLanguageBridgeFactory.factory.translate(TestQueryImpl.helpExample(true)); Class<?> firstSymbolType = query.getDerivedColumns().get(0).getExpression().getType(); assertEquals("Got incorrect type", firstSymbolType, example().getType()); //$NON-NLS-1$ }