Search in sources :

Example 1 with TSalesforceOutputBulkExecProperties

use of org.talend.components.salesforce.tsalesforceoutputbulkexec.TSalesforceOutputBulkExecProperties in project components by Talend.

the class SalesforceBulkExecReaderTestIT method createAccountSalesforceOutputBulkExecProperties.

/**
 * The configuration of tSalesforceOutputBulkExec
 */
protected TSalesforceOutputBulkExecProperties createAccountSalesforceOutputBulkExecProperties() throws Throwable {
    TSalesforceOutputBulkExecProperties props = (TSalesforceOutputBulkExecProperties) new TSalesforceOutputBulkExecProperties("foo").init();
    props.connection.timeout.setValue(1200000);
    props.connection.bulkConnection.setValue(true);
    props.outputAction.setValue(SalesforceOutputProperties.OutputAction.INSERT);
    String bulkFilePath = this.getClass().getResource("").getPath() + "/test_outputbulk_1.csv";
    System.out.println("Bulk file path: " + bulkFilePath);
    props.bulkFilePath.setValue(bulkFilePath);
    props.bulkProperties.bytesToCommit.setValue(10 * 1024 * 1024);
    props.bulkProperties.rowsToCommit.setValue(10000);
    props.bulkProperties.concurrencyMode.setValue(Concurrency.Parallel);
    props.bulkProperties.waitTimeCheckBatchState.setValue(10000);
    props.module.main.schema.setValue(getMakeRowSchema(false));
    props.schemaFlow.schema.setValue(getMakeRowSchema(false));
    setupProps(props.connection, !ADD_QUOTES);
    props.module.moduleName.setValue(EXISTING_MODULE_NAME);
    ComponentTestUtils.checkSerialize(props, errorCollector);
    return props;
}
Also used : TSalesforceOutputBulkExecProperties(org.talend.components.salesforce.tsalesforceoutputbulkexec.TSalesforceOutputBulkExecProperties)

Example 2 with TSalesforceOutputBulkExecProperties

use of org.talend.components.salesforce.tsalesforceoutputbulkexec.TSalesforceOutputBulkExecProperties in project components by Talend.

the class SalesforceBulkExecReaderTestIT method testOutputBulkExec.

/**
 * This test for tSalesforceOutputBulk and tSalesforceBulkExec The runtime of tSalesforceOutputBulkExec should be
 * work like this.
 */
private void testOutputBulkExec(int count) throws Throwable {
    String random = createNewRandom();
    List<IndexedRecord> rows = makeRows(random, count, false);
    TSalesforceOutputBulkExecProperties outputBulkExecProperties = createAccountSalesforceOutputBulkExecProperties();
    // Prepare the bulk file
    TSalesforceOutputBulkProperties outputBulkProperties = (TSalesforceOutputBulkProperties) outputBulkExecProperties.getInputComponentProperties();
    generateBulkFile(outputBulkProperties, rows);
    // Test append
    outputBulkProperties.append.setValue(true);
    generateBulkFile(outputBulkProperties, rows);
    // Execute the bulk action
    TSalesforceBulkExecProperties bulkExecProperties = (TSalesforceBulkExecProperties) outputBulkExecProperties.getOutputComponentProperties();
    try {
        executeBulkInsert(bulkExecProperties, random, count * 2);
    } finally {
        // Delete the generated bulk file
        delete(outputBulkProperties);
        List<IndexedRecord> inputRows = readRows(bulkExecProperties);
        List<IndexedRecord> allReadTestRows = filterAllTestRows(random, inputRows);
        deleteRows(allReadTestRows, bulkExecProperties);
        inputRows = readRows(bulkExecProperties);
        assertEquals(0, filterAllTestRows(random, inputRows).size());
    }
}
Also used : TSalesforceOutputBulkProperties(org.talend.components.salesforce.tsalesforceoutputbulk.TSalesforceOutputBulkProperties) IndexedRecord(org.apache.avro.generic.IndexedRecord) TSalesforceOutputBulkExecProperties(org.talend.components.salesforce.tsalesforceoutputbulkexec.TSalesforceOutputBulkExecProperties) TSalesforceBulkExecProperties(org.talend.components.salesforce.tsalesforcebulkexec.TSalesforceBulkExecProperties)

Example 3 with TSalesforceOutputBulkExecProperties

use of org.talend.components.salesforce.tsalesforceoutputbulkexec.TSalesforceOutputBulkExecProperties in project components by Talend.

the class SalesforceSchemaTest method testOutputSchemaForTSalesforceOutputBulkExec.

@Test
public void testOutputSchemaForTSalesforceOutputBulkExec() throws Throwable {
    TSalesforceOutputBulkExecDefinition defin = (TSalesforceOutputBulkExecDefinition) getComponentService().getComponentDefinition(TSalesforceOutputBulkExecDefinition.COMPONENT_NAME);
    TSalesforceOutputBulkExecProperties modelProps = (TSalesforceOutputBulkExecProperties) defin.createProperties();
    assertBulk(modelProps);
}
Also used : TSalesforceOutputBulkExecDefinition(org.talend.components.salesforce.tsalesforceoutputbulkexec.TSalesforceOutputBulkExecDefinition) TSalesforceOutputBulkExecProperties(org.talend.components.salesforce.tsalesforceoutputbulkexec.TSalesforceOutputBulkExecProperties) Test(org.junit.Test)

Aggregations

TSalesforceOutputBulkExecProperties (org.talend.components.salesforce.tsalesforceoutputbulkexec.TSalesforceOutputBulkExecProperties)3 IndexedRecord (org.apache.avro.generic.IndexedRecord)1 Test (org.junit.Test)1 TSalesforceBulkExecProperties (org.talend.components.salesforce.tsalesforcebulkexec.TSalesforceBulkExecProperties)1 TSalesforceOutputBulkProperties (org.talend.components.salesforce.tsalesforceoutputbulk.TSalesforceOutputBulkProperties)1 TSalesforceOutputBulkExecDefinition (org.talend.components.salesforce.tsalesforceoutputbulkexec.TSalesforceOutputBulkExecDefinition)1