use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputDefinition in project components by Talend.
the class SalesforceInputReaderTestIT method testBulkQueryNullValue.
protected void testBulkQueryNullValue(SalesforceConnectionModuleProperties props, String random) throws Throwable {
ComponentDefinition sfInputDef = new TSalesforceInputDefinition();
TSalesforceInputProperties sfInputProps = (TSalesforceInputProperties) sfInputDef.createRuntimeProperties();
sfInputProps.copyValuesFrom(props);
sfInputProps.manualQuery.setValue(false);
sfInputProps.module.main.schema.setValue(SCHEMA_QUERY_ACCOUNT);
sfInputProps.queryMode.setValue(TSalesforceInputProperties.QueryMode.Bulk);
sfInputProps.condition.setValue("BillingPostalCode = '" + random + "'");
List<IndexedRecord> inpuRecords = readRows(sfInputProps);
for (IndexedRecord record : inpuRecords) {
assertNull(record.get(5));
assertNull(record.get(6));
}
}
use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputDefinition in project components by Talend.
the class SalesforceComponentTestIT method testInputProps.
@Test
public void testInputProps() throws Throwable {
TSalesforceInputProperties props = (TSalesforceInputProperties) new TSalesforceInputDefinition().createProperties();
assertEquals(2, props.queryMode.getPossibleValues().size());
Property[] returns = new TSalesforceInputDefinition().getReturnProperties();
assertEquals(ComponentDefinition.RETURN_TOTAL_RECORD_COUNT, returns[1].getName());
// Default query mode
Form queryAdvancedForm = props.getForm(Form.ADVANCED);
assertTrue(queryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.bulkConnection.getName()).isHidden());
assertFalse(queryAdvancedForm.getWidget(props.normalizeDelimiter.getName()).isHidden());
assertFalse(queryAdvancedForm.getWidget(props.columnNameDelimiter.getName()).isHidden());
assertFalse(queryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.httpChunked.getName()).isHidden());
assertTrue(queryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.httpTraceMessage.getName()).isHidden());
// Change to bulk query mode
props.queryMode.setValue(TSalesforceInputProperties.QueryMode.Bulk);
props.afterQueryMode();
Form bulkQueryAdvancedForm = props.getForm(Form.ADVANCED);
assertTrue(bulkQueryAdvancedForm.getWidget(props.normalizeDelimiter.getName()).isHidden());
assertTrue(bulkQueryAdvancedForm.getWidget(props.columnNameDelimiter.getName()).isHidden());
assertTrue(bulkQueryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.httpChunked.getName()).isHidden());
assertFalse(bulkQueryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.httpTraceMessage.getName()).isHidden());
assertTrue(bulkQueryAdvancedForm.getChildForm(props.connection.getName()).getWidget(props.connection.bulkConnection.getName()).isHidden());
}
use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputDefinition in project components by Talend.
the class SalesforceProxyTestIT method testProxyWithBulkQuery.
@Test
public void testProxyWithBulkQuery() {
TSalesforceInputDefinition definition = (TSalesforceInputDefinition) getComponentService().getComponentDefinition(TSalesforceInputDefinition.COMPONENT_NAME);
TSalesforceInputProperties properties = (TSalesforceInputProperties) definition.createRuntimeProperties();
properties.connection.bulkConnection.setValue(true);
properties.queryMode.setValue(QueryMode.Bulk);
SalesforceRuntimeTestUtil util = new SalesforceRuntimeTestUtil();
properties.module.moduleName.setValue(util.getTestModuleName());
properties.module.main.schema.setValue(util.getTestSchema1());
properties.connection.userPassword.userId.setValue(userId);
properties.connection.userPassword.password.setValue(password);
properties.connection.userPassword.securityKey.setValue(securityKey);
Source source = new SalesforceSource();
source.initialize(null, properties);
org.talend.daikon.properties.ValidationResult vr = source.validate(null);
Assert.assertEquals(ValidationResult.Result.OK, vr.getStatus());
Reader reader = source.createReader(null);
try {
reader.start();
do {
reader.getCurrent();
} while (reader.advance());
reader.close();
} catch (Exception e) {
Assert.fail(e.getMessage());
}
}
Aggregations