Search in sources :

Example 1 with SalesforceBulkRuntime

use of org.talend.components.salesforce.runtime.SalesforceBulkRuntime in project components by Talend.

the class SalesforceBulkRuntimeTest method setUp.

@Before
public void setUp() throws Exception {
    inputProperties = new TSalesforceInputProperties("input");
    conn = mock(BulkConnection.class);
    runtime = new SalesforceBulkRuntime(conn);
    assertTrue(conn == runtime.getBulkConnection());
}
Also used : SalesforceBulkRuntime(org.talend.components.salesforce.runtime.SalesforceBulkRuntime) TSalesforceInputProperties(org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties) BulkConnection(com.sforce.async.BulkConnection) Before(org.junit.Before)

Example 2 with SalesforceBulkRuntime

use of org.talend.components.salesforce.runtime.SalesforceBulkRuntime in project components by Talend.

the class SalesforceBulkQueryReader method start.

@Override
public boolean start() throws IOException {
    try {
        if (bulkRuntime == null) {
            ConnectionHolder connectionHolder = ((SalesforceDataprepSource) getCurrentSource()).getConnectionHolder();
            bulkRuntime = new SalesforceBulkRuntime(connectionHolder.bulkConnection);
        }
        executeSalesforceBulkQuery();
        bulkResultSet = bulkRuntime.getQueryResultSet(bulkRuntime.nextResultId());
        currentRecord = bulkResultSet.next();
        boolean start = currentRecord != null;
        if (start) {
            dataCount++;
        }
        return start;
    } catch (ConnectionException | AsyncApiException e) {
        // Wrap the exception in an IOException.
        throw new IOException(e);
    }
}
Also used : SalesforceBulkRuntime(org.talend.components.salesforce.runtime.SalesforceBulkRuntime) IOException(java.io.IOException) ConnectionException(com.sforce.ws.ConnectionException) AsyncApiException(com.sforce.async.AsyncApiException) ConnectionHolder(org.talend.components.salesforce.runtime.common.ConnectionHolder)

Aggregations

SalesforceBulkRuntime (org.talend.components.salesforce.runtime.SalesforceBulkRuntime)2 AsyncApiException (com.sforce.async.AsyncApiException)1 BulkConnection (com.sforce.async.BulkConnection)1 ConnectionException (com.sforce.ws.ConnectionException)1 IOException (java.io.IOException)1 Before (org.junit.Before)1 ConnectionHolder (org.talend.components.salesforce.runtime.common.ConnectionHolder)1 TSalesforceInputProperties (org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties)1