use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties in project components by Talend.
the class SalesforceComponentTestIT method testUseExistingConnection.
@Test
public void testUseExistingConnection() throws Throwable {
SalesforceConnectionProperties connProps = (SalesforceConnectionProperties) getComponentService().getComponentProperties(TSalesforceConnectionDefinition.COMPONENT_NAME);
setupProps(connProps, !ADD_QUOTES);
final String currentComponentName = TSalesforceConnectionDefinition.COMPONENT_NAME + "_1";
RuntimeContainer connContainer = new DefaultComponentRuntimeContainerImpl() {
@Override
public String getCurrentComponentId() {
return currentComponentName;
}
};
SalesforceSourceOrSink salesforceSourceOrSink = new SalesforceSourceOrSink();
salesforceSourceOrSink.initialize(connContainer, connProps);
assertEquals(ValidationResult.Result.OK, salesforceSourceOrSink.validate(connContainer).getStatus());
// Input component get connection from the tSalesforceConnection
ComponentDefinition inputDefinition = getComponentService().getComponentDefinition(TSalesforceInputDefinition.COMPONENT_NAME);
TSalesforceInputProperties inProps = (TSalesforceInputProperties) getComponentService().getComponentProperties(TSalesforceInputDefinition.COMPONENT_NAME);
inProps.connection.referencedComponent.componentInstanceId.setValue(currentComponentName);
SalesforceSourceOrSink salesforceInputSourceOrSink = new SalesforceSourceOrSink();
salesforceInputSourceOrSink.initialize(connContainer, inProps);
assertEquals(ValidationResult.Result.OK, salesforceInputSourceOrSink.validate(connContainer).getStatus());
}
use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties in project components by Talend.
the class SalesforceComponentTestIT method testModuleNames.
@Test
public void testModuleNames() throws Throwable {
TSalesforceInputProperties props = (TSalesforceInputProperties) getComponentService().getComponentProperties(TSalesforceInputDefinition.COMPONENT_NAME);
setupProps(props.connection, !ADD_QUOTES);
ComponentTestUtils.checkSerialize(props, errorCollector);
assertEquals(2, props.getForms().size());
Form f = props.module.getForm(Form.REFERENCE);
assertTrue(f.getWidget("moduleName").isCallBeforeActivate());
// The Form is bound to a Properties object that created it. The Forms might not always be associated with the
// properties object
// they came from.
ComponentProperties moduleProps = (ComponentProperties) f.getProperties();
moduleProps = (ComponentProperties) PropertiesTestUtils.checkAndBeforeActivate(getComponentService(), f, "moduleName", moduleProps);
Property prop = (Property) f.getWidget("moduleName").getContent();
assertTrue(prop.getPossibleValues().size() > 100);
LOGGER.debug(prop.getPossibleValues().toString());
LOGGER.debug(moduleProps.getValidationResult().toString());
}
use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties in project components by Talend.
the class SalesforceComponentTestIT method testSchemaWithAPIVersion.
protected void testSchemaWithAPIVersion(String version) throws Throwable {
TSalesforceInputProperties props = (TSalesforceInputProperties) getComponentService().getComponentProperties(TSalesforceInputDefinition.COMPONENT_NAME);
props.connection.endpoint.setValue("https://login.salesforce.com/services/Soap/u/" + version);
setupProps(props.connection, !ADD_QUOTES);
Form f = props.module.getForm(Form.REFERENCE);
SalesforceModuleProperties moduleProps = (SalesforceModuleProperties) f.getProperties();
moduleProps = (SalesforceModuleProperties) PropertiesTestUtils.checkAndBeforeActivate(getComponentService(), f, "moduleName", moduleProps);
moduleProps.moduleName.setValue("Account");
moduleProps = (SalesforceModuleProperties) checkAndAfter(f, "moduleName", moduleProps);
Schema schema = moduleProps.main.schema.getValue();
LOGGER.debug(schema.toString());
for (Schema.Field child : schema.getFields()) {
LOGGER.debug(child.name());
}
assertEquals("Id", schema.getFields().get(0).name());
LOGGER.debug("Endpoint:" + props.connection.endpoint.getValue());
LOGGER.debug("Module \"Account\" column size:" + schema.getFields().size());
assertTrue(schema.getFields().size() > 40);
}
use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties in project components by Talend.
the class SalesforceTestBase method readRows.
protected List<IndexedRecord> readRows(SalesforceConnectionModuleProperties props) throws IOException {
TSalesforceInputProperties inputProps = (TSalesforceInputProperties) new TSalesforceInputProperties("bar").init();
inputProps.connection = props.connection;
inputProps.module = props.module;
inputProps.batchSize.setValue(200);
inputProps.queryMode.setValue(TSalesforceInputProperties.QueryMode.Query);
List<IndexedRecord> inputRows = readRows(inputProps);
return inputRows;
}
use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties 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());
}
Aggregations