Package org.teiid.language

Examples of org.teiid.language.Command



public class TestYahooTranslation extends TestCase {
 
    public void helpTestTranslation(String sql, String expectedUrl) throws Exception {
        Command command = FakeTranslationFactory.getInstance().getYahooTranslationUtility().parseCommand(sql);
       
        String url = YahooExecution.translateIntoUrl((Select) command);
        assertEquals("Did not get expected url", expectedUrl, url); //$NON-NLS-1$
    }
View Full Code Here


    helpTestVisitor(vdb,null,input, expectedOutput, translator);
  }
 
  public static void helpTestVisitor(String vdb, String udf, String input, String expectedOutput, JDBCExecutionFactory translator) throws TranslatorException {
      // Convert from sql to objects
      Command obj = helpTranslate(vdb, udf, translator.getPushDownFunctions(), input);
     
      helpTestVisitor(expectedOutput, translator, obj);
 
View Full Code Here

    cols.get(2).setNameInSource("\"jcr:primaryType\"");
      return RealMetadataFactory.createTransformationMetadata(store, "modeshape");
    }

  public void helpTestVisitor(String input, String expectedOutput) throws TranslatorException {
    Command obj = UTIL.parseCommand(input, true, true);
    TranslationHelper.helpTestVisitor(expectedOutput, TRANSLATOR, obj);
  }
View Full Code Here

        return TranslationHelper.BQT_VDB;
    }
   
    public void helpTestVisitor(String vdb, String input, String expectedOutput) {
        // Convert from sql to objects
        Command obj = TranslationHelper.helpTranslate(vdb, input);
       
        TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), trans);
    try {
      tc.translateCommand(obj);
    } catch (TranslatorException e) {
View Full Code Here

    }

    private void helpTestVisitor(String vdb, String input, ExecutionContext context, String dbmsTimeZone, String expectedOutput, boolean correctNaming) throws TranslatorException {
        // Convert from sql to objects
        TranslationUtility util = new TranslationUtility(vdb);
        Command obj =  util.parseCommand(input, correctNaming, true);       
    this.helpTestVisitor(obj, context, dbmsTimeZone, expectedOutput);
    }
View Full Code Here

     * @throws TranslatorException
     */
    private void helpTestVisitor(QueryMetadataInterface metadata, String input, ExecutionContext context, String dbmsTimeZone, String expectedOutput) throws TranslatorException {
        // Convert from sql to objects
        CommandBuilder commandBuilder = new CommandBuilder(metadata);
        Command obj = commandBuilder.getCommand(input);
    this.helpTestVisitor(obj, context, dbmsTimeZone, expectedOutput);
    }
View Full Code Here

    @Test public void testRowLimitWithUnionOrderBy() throws Exception {
        String input = "(select intkey from bqt1.smalla limit 50, 100) union select intnum from bqt1.smalla order by intkey"; //$NON-NLS-1$
        String output = "SELECT c_0 FROM (SELECT VIEW_FOR_LIMIT.*, ROWNUM ROWNUM_ FROM (SELECT g_1.IntKey AS c_0 FROM SmallA g_1) VIEW_FOR_LIMIT WHERE ROWNUM <= 150) WHERE ROWNUM_ > 50 UNION SELECT g_0.IntNum AS c_0 FROM SmallA g_0 ORDER BY c_0"; //$NON-NLS-1$
              
    CommandBuilder commandBuilder = new CommandBuilder(FakeMetadataFactory.exampleBQTCached());
        Command obj = commandBuilder.getCommand(input, true, true);
    this.helpTestVisitor(obj, EMPTY_CONTEXT, null, output);
    }
View Full Code Here

    }
   
    @Test public void testTimestampAddFunction() throws Exception {
      String sql = "select timestampadd(" +NonReserved.SQL_TSI_DAY+ ", 2, timestampvalue) from bqt1.smalla"; //$NON-NLS-1$ //$NON-NLS-2$
     
      Command command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql);
      assertEquals("SELECT timestampadd(SQL_TSI_DAY, 2, SmallA.TimestampValue) FROM SmallA", command.toString()); //$NON-NLS-1$
    }
View Full Code Here

    }
   
    @Test public void testUnrelatedOrderBy() throws Exception {
      String sql = "select intkey from bqt1.smalla order by stringkey"; //$NON-NLS-1$
     
      Command command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql, true, true);
      assertEquals("SELECT g_0.IntKey AS c_0 FROM SmallA AS g_0 ORDER BY g_0.StringKey", command.toString()); //$NON-NLS-1$
    }
View Full Code Here

    }
   
    @Test public void testOrderByDerivedColumn() throws Exception {
      String sql = "select intkey as x from bqt1.smalla order by intkey"; //$NON-NLS-1$
     
      Command command = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(sql, true, true);
      assertEquals("SELECT g_0.IntKey AS c_0 FROM SmallA AS g_0 ORDER BY c_0", command.toString()); //$NON-NLS-1$
    }
View Full Code Here

TOP

Related Classes of org.teiid.language.Command

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.