Search in sources :

Example 11 with QueryResult

use of com.sforce.soap.partner.QueryResult in project teiid by teiid.

the class TestVisitors method helpTest.

private void helpTest(String sql, String expected) throws Exception {
    Command command = translationUtility.parseCommand(sql);
    SalesForceExecutionFactory factory = new SalesForceExecutionFactory();
    ExecutionContext ec = Mockito.mock(ExecutionContext.class);
    RuntimeMetadata rm = Mockito.mock(RuntimeMetadata.class);
    SalesforceConnection connection = Mockito.mock(SalesforceConnection.class);
    ArgumentCaptor<String> queryArgument = ArgumentCaptor.forClass(String.class);
    QueryResult qr = Mockito.mock(QueryResult.class);
    Mockito.stub(connection.query(queryArgument.capture(), Mockito.anyInt(), Mockito.anyBoolean())).toReturn(qr);
    Execution execution = factory.createExecution(command, ec, rm, connection);
    execution.execute();
    Mockito.verify(connection, Mockito.times(1)).query(queryArgument.capture(), Mockito.anyInt(), Mockito.anyBoolean());
    assertEquals(expected, queryArgument.getValue().trim());
}
Also used : QueryResult(com.sforce.soap.partner.QueryResult) ExecutionContext(org.teiid.translator.ExecutionContext) Execution(org.teiid.translator.Execution) Command(org.teiid.language.Command) SalesForceExecutionFactory(org.teiid.translator.salesforce.SalesForceExecutionFactory) RuntimeMetadata(org.teiid.metadata.RuntimeMetadata) SalesforceConnection(org.teiid.translator.salesforce.SalesforceConnection)

Aggregations

QueryResult (com.sforce.soap.partner.QueryResult)11 Test (org.junit.Test)6 SObject (com.sforce.soap.partner.sobject.SObject)5 RuntimeMetadata (org.teiid.metadata.RuntimeMetadata)5 ExecutionContext (org.teiid.translator.ExecutionContext)5 SalesforceConnection (org.teiid.translator.salesforce.SalesforceConnection)5 SalesForceExecutionFactory (org.teiid.translator.salesforce.SalesForceExecutionFactory)4 Command (org.teiid.language.Command)2 Select (org.teiid.language.Select)2 ArrayList (java.util.ArrayList)1 ResourceException (javax.resource.ResourceException)1 TranslationUtility (org.teiid.cdk.api.TranslationUtility)1 Delete (org.teiid.language.Delete)1 DataNotAvailableException (org.teiid.translator.DataNotAvailableException)1 Execution (org.teiid.translator.Execution)1 TranslatorException (org.teiid.translator.TranslatorException)1 SalesForce41ExecutionFactory (org.teiid.translator.salesforce.SalesForce41ExecutionFactory)1 SalesForce34ExecutionFactory (org.teiid.translator.salesforce34.SalesForce34ExecutionFactory)1