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;
}
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());
}
}
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);
}
Aggregations