Search in sources :

Example 1 with TranslatedCommand

use of org.teiid.translator.jdbc.TranslatedCommand in project teiid by teiid.

the class TestHiveExecutionFactory method helpTestVisitor.

private void helpTestVisitor(QueryMetadataInterface metadata, String input, String expectedOutput) throws TranslatorException {
    // Convert from sql to objects
    CommandBuilder commandBuilder = new CommandBuilder(metadata);
    Command obj = commandBuilder.getCommand(input);
    // Convert back to SQL
    TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), hiveTranslator);
    tc.translateCommand(obj);
    // Check stuff
    // $NON-NLS-1$
    assertEquals("Did not get correct sql", expectedOutput, tc.getSql());
}
Also used : ExecutionContext(org.teiid.translator.ExecutionContext) Command(org.teiid.language.Command) TranslatedCommand(org.teiid.translator.jdbc.TranslatedCommand) TranslatedCommand(org.teiid.translator.jdbc.TranslatedCommand) CommandBuilder(org.teiid.cdk.CommandBuilder)

Example 2 with TranslatedCommand

use of org.teiid.translator.jdbc.TranslatedCommand in project teiid by teiid.

the class TestSybaseIQTranslator method helpTestVisitor.

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) {
        throw new RuntimeException(e);
    }
    // $NON-NLS-1$
    assertEquals("Did not get correct sql", expectedOutput, tc.getSql());
}
Also used : ExecutionContext(org.teiid.translator.ExecutionContext) Command(org.teiid.language.Command) TranslatedCommand(org.teiid.translator.jdbc.TranslatedCommand) TranslatedCommand(org.teiid.translator.jdbc.TranslatedCommand) TranslatorException(org.teiid.translator.TranslatorException)

Example 3 with TranslatedCommand

use of org.teiid.translator.jdbc.TranslatedCommand in project teiid by teiid.

the class TestSybaseSQLConversionVisitor method helpTestVisitor.

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) {
        throw new RuntimeException(e);
    }
    // $NON-NLS-1$
    assertEquals("Did not get correct sql", expectedOutput, tc.getSql());
}
Also used : ExecutionContext(org.teiid.translator.ExecutionContext) Command(org.teiid.language.Command) TranslatedCommand(org.teiid.translator.jdbc.TranslatedCommand) TranslatedCommand(org.teiid.translator.jdbc.TranslatedCommand) TranslatorException(org.teiid.translator.TranslatorException)

Example 4 with TranslatedCommand

use of org.teiid.translator.jdbc.TranslatedCommand in project teiid by teiid.

the class TestAccessSQLTranslator method helpTestVisitor.

public void helpTestVisitor(String input, String expectedOutput) throws TranslatorException {
    // Convert from sql to objects
    Command obj = FakeTranslationFactory.getInstance().getBQTTranslationUtility().parseCommand(input);
    TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), TRANSLATOR);
    tc.translateCommand(obj);
    // Check stuff
    // $NON-NLS-1$
    assertEquals("Did not get correct sql", expectedOutput, tc.getSql());
}
Also used : ExecutionContext(org.teiid.translator.ExecutionContext) Command(org.teiid.language.Command) TranslatedCommand(org.teiid.translator.jdbc.TranslatedCommand) TranslatedCommand(org.teiid.translator.jdbc.TranslatedCommand)

Example 5 with TranslatedCommand

use of org.teiid.translator.jdbc.TranslatedCommand in project teiid by teiid.

the class TestDB2SqlTranslator method helpTestVisitor.

public void helpTestVisitor(TranslationUtility util, String input, String expectedOutput) throws TranslatorException {
    // Convert from sql to objects
    Command obj = util.parseCommand(input);
    TranslatedCommand tc = new TranslatedCommand(Mockito.mock(ExecutionContext.class), TRANSLATOR);
    tc.translateCommand(obj);
    // $NON-NLS-1$
    assertEquals("Did not get correct sql", expectedOutput, tc.getSql());
}
Also used : ExecutionContext(org.teiid.translator.ExecutionContext) Command(org.teiid.language.Command) TranslatedCommand(org.teiid.translator.jdbc.TranslatedCommand) TranslatedCommand(org.teiid.translator.jdbc.TranslatedCommand)

Aggregations

TranslatedCommand (org.teiid.translator.jdbc.TranslatedCommand)7 Command (org.teiid.language.Command)6 ExecutionContext (org.teiid.translator.ExecutionContext)6 TranslatorException (org.teiid.translator.TranslatorException)2 CommandBuilder (org.teiid.cdk.CommandBuilder)1