use of org.talend.components.salesforce.tsalesforceconnection.TSalesforceConnectionDefinition in project components by Talend.
the class SalesforceProxyTestIT method testProxy.
@Test
public void testProxy() {
TSalesforceConnectionDefinition definition = (TSalesforceConnectionDefinition) getComponentService().getComponentDefinition(TSalesforceConnectionDefinition.COMPONENT_NAME);
SalesforceConnectionProperties properties = (SalesforceConnectionProperties) definition.createRuntimeProperties();
properties.bulkConnection.setValue(true);
properties.userPassword.userId.setValue(userId);
properties.userPassword.password.setValue(password);
properties.userPassword.securityKey.setValue(securityKey);
SourceOrSink sourceOrSink = new SalesforceSourceOrSink();
sourceOrSink.initialize(null, properties);
org.talend.daikon.properties.ValidationResult vr = sourceOrSink.validate(null);
Assert.assertEquals(ValidationResult.Result.OK, vr.getStatus());
}
use of org.talend.components.salesforce.tsalesforceconnection.TSalesforceConnectionDefinition in project components by Talend.
the class SalesforceComponentTestIT method testConnectionProps.
@Test
public void testConnectionProps() throws Throwable {
SalesforceConnectionProperties props = (SalesforceConnectionProperties) new TSalesforceConnectionDefinition().createProperties();
assertTrue(props.userPassword.userId.isRequired());
assertTrue(props.userPassword.password.isRequired());
assertFalse(props.userPassword.securityKey.isRequired());
assertFalse(props.proxy.userPassword.userId.isRequired());
assertFalse(props.proxy.userPassword.password.isRequired());
Form mainForm = props.getForm(Form.MAIN);
Form advancedForm = props.getForm(Form.ADVANCED);
assertTrue(advancedForm.getWidget(props.reuseSession.getName()).isVisible());
assertFalse(advancedForm.getWidget(props.sessionDirectory).isVisible());
// Check "loginType" value changes influence "reuseSession"/"sessionDirectory" visible
props.loginType.setValue(LoginType.OAuth);
checkAndAfter(mainForm, "loginType", props);
assertFalse(advancedForm.getWidget(props.reuseSession.getName()).isVisible());
assertFalse(advancedForm.getWidget(props.sessionDirectory).isVisible());
props.loginType.setValue(LoginType.Basic);
checkAndAfter(mainForm, "loginType", props);
assertTrue(advancedForm.getWidget(props.reuseSession.getName()).isVisible());
assertFalse(advancedForm.getWidget(props.sessionDirectory).isVisible());
// Check "bulkConnection" value changes influence "reuseSession"/"sessionDirectory" visible
props.bulkConnection.setValue(true);
checkAndAfter(advancedForm, "bulkConnection", props);
assertFalse(advancedForm.getWidget(props.reuseSession.getName()).isVisible());
assertFalse(advancedForm.getWidget(props.sessionDirectory).isVisible());
props.bulkConnection.setValue(false);
checkAndAfter(advancedForm, "bulkConnection", props);
assertTrue(advancedForm.getWidget(props.reuseSession.getName()).isVisible());
assertFalse(advancedForm.getWidget(props.sessionDirectory).isVisible());
// Check "reuseSession" value changes influence "sessionDirectory" visible
props.reuseSession.setValue(true);
checkAndAfter(advancedForm, "reuseSession", props);
assertTrue(advancedForm.getWidget(props.sessionDirectory).isVisible());
props.reuseSession.setValue(false);
checkAndAfter(advancedForm, "reuseSession", props);
assertFalse(advancedForm.getWidget(props.sessionDirectory).isVisible());
}
use of org.talend.components.salesforce.tsalesforceconnection.TSalesforceConnectionDefinition in project components by Talend.
the class SalesforceComponentTestIT method testAfterLoginType.
@Test
public void testAfterLoginType() throws Throwable {
ComponentProperties props;
props = new TSalesforceConnectionDefinition().createProperties();
ComponentTestUtils.checkSerialize(props, errorCollector);
Property<LoginType> loginType = (Property<LoginType>) props.getProperty("loginType");
LOGGER.debug(loginType.getPossibleValues().toString());
assertEquals(SalesforceConnectionProperties.LoginType.Basic, loginType.getPossibleValues().get(0));
assertEquals(SalesforceConnectionProperties.LoginType.OAuth, loginType.getPossibleValues().get(1));
assertEquals(SalesforceConnectionProperties.LoginType.Basic, loginType.getValue());
Form mainForm = props.getForm(Form.MAIN);
assertEquals("Salesforce Connection Settings", mainForm.getTitle());
assertFalse(mainForm.getWidget(SalesforceUserPasswordProperties.class).isHidden());
loginType.setValue(SalesforceConnectionProperties.LoginType.OAuth);
props = checkAndAfter(mainForm, "loginType", props);
mainForm = props.getForm(Form.MAIN);
assertTrue(mainForm.isRefreshUI());
assertTrue(mainForm.getWidget(SalesforceUserPasswordProperties.class).isHidden());
}
use of org.talend.components.salesforce.tsalesforceconnection.TSalesforceConnectionDefinition in project components by Talend.
the class SalesforceComponentTestIT method testGetProps.
@Test
public void testGetProps() {
ComponentProperties props = new TSalesforceConnectionDefinition().createProperties();
Form f = props.getForm(Form.MAIN);
ComponentTestUtils.checkSerialize(props, errorCollector);
LOGGER.debug(f.toString());
LOGGER.debug(props.toString());
assertEquals(Form.MAIN, f.getName());
}
Aggregations