use of org.talend.components.salesforce.datastore.SalesforceDatastoreProperties in project components by Talend.
the class SalesforceDatastoreRuntimeTestIT method testDoHealthChecksWithFail.
/*
* If the logic changes for this test please specify appropriate timeout.
* The average execution time for this test less than 1 sec.
*/
@Test(timeout = 30_000)
public void testDoHealthChecksWithFail() {
SalesforceDatastoreProperties datastore = new SalesforceDatastoreProperties("datastore");
CommonTestUtils.setValueForDatastoreProperties(datastore);
datastore.password.setValue("wrongone");
SalesforceDatastoreRuntime runtime = new SalesforceDatastoreRuntime();
runtime.initialize(null, datastore);
Iterable<ValidationResult> results = runtime.doHealthChecks(null);
Assert.assertNotNull(results);
for (ValidationResult result : results) {
Assert.assertTrue(result.getMessage(), result.getStatus() == ValidationResult.Result.ERROR);
Assert.assertNotNull(result.getMessage());
}
}
use of org.talend.components.salesforce.datastore.SalesforceDatastoreProperties in project components by Talend.
the class SalesforceDatasetPropertiesTestIT method testAfterModuleName.
@Test
public void testAfterModuleName() {
SalesforceDatasetProperties dataset = new SalesforceDatasetProperties("dataset");
dataset.init();
SalesforceDatastoreProperties datastore = new SalesforceDatastoreProperties("datastore");
datastore.init();
dataset.sourceType.setValue(SourceType.SOQL_QUERY);
dataset.setDatastoreProperties(datastore);
datastore.userId.setValue(userId);
datastore.password.setValue(password);
datastore.securityKey.setValue(securityKey);
dataset.sourceType.setValue(SourceType.MODULE_SELECTION);
dataset.moduleName.setValue("Account");
List modules = dataset.selectColumnIds.getPossibleValues();
Assert.assertTrue("the module list is not empty before calling 'afterSourceType' method, not right", modules == null || modules.isEmpty());
try {
dataset.afterModuleName();
} catch (IOException e) {
Assert.fail(e.getMessage());
}
modules = dataset.selectColumnIds.getPossibleValues();
Assert.assertTrue("the module list is empty after calling 'afterSourceType' method, not right", modules != null && !modules.isEmpty());
Assert.assertTrue("the list of selected columns or fields must be null or empty", dataset.selectColumnIds.getValue() == null || dataset.selectColumnIds.getValue().isEmpty());
Assert.assertTrue("the query value must be empty", StringUtils.isEmpty(dataset.query.getValue()));
}
use of org.talend.components.salesforce.datastore.SalesforceDatastoreProperties in project components by Talend.
the class SalesforceDatasetPropertiesTest method setUp.
@Before
public void setUp() {
propertiesService = new PropertiesServiceImpl();
datastoreProperties = new SalesforceDatastoreProperties("datastore");
properties = spy(new SalesforceDatasetProperties("dataset"));
}
use of org.talend.components.salesforce.datastore.SalesforceDatastoreProperties in project components by Talend.
the class SalesforceDatasetPropertiesTestIT method testAfterSourceType.
@Test
public void testAfterSourceType() {
SalesforceDatasetProperties dataset = new SalesforceDatasetProperties("dataset");
dataset.init();
SalesforceDatastoreProperties datastore = new SalesforceDatastoreProperties("datastore");
datastore.init();
dataset.sourceType.setValue(SourceType.SOQL_QUERY);
dataset.setDatastoreProperties(datastore);
datastore.userId.setValue(userId);
datastore.password.setValue(password);
datastore.securityKey.setValue(securityKey);
dataset.sourceType.setValue(SourceType.MODULE_SELECTION);
List modules = dataset.moduleName.getPossibleValues();
Assert.assertTrue("the module list is not empty before calling 'afterSourceType' method, not right", modules == null || modules.isEmpty());
try {
dataset.afterSourceType();
} catch (IOException e) {
Assert.fail(e.getMessage());
}
modules = dataset.moduleName.getPossibleValues();
for (Object object : modules) {
if (SalesforceDatasetProperties.MODULE_LIST_WHICH_NOT_SUPPORT_BULK_API.contains((String) object)) {
Assert.fail(object + " is not supported by Bulk API");
}
}
Assert.assertTrue("the module list is empty after calling 'afterSourceType' method, not right", modules != null && !modules.isEmpty());
Assert.assertTrue("the module value must be empty at this point", StringUtils.isEmpty(dataset.moduleName.getValue()));
Assert.assertTrue("the list of selected columns or fields must be null or empty", dataset.selectColumnIds.getValue() == null || dataset.selectColumnIds.getValue().isEmpty());
Assert.assertTrue("the query value must be empty", StringUtils.isEmpty(dataset.query.getValue()));
}
use of org.talend.components.salesforce.datastore.SalesforceDatastoreProperties in project components by Talend.
the class SalesforceDatastoreRuntimeTestIT method testDoHealthChecksWithSuccess.
@Test
public void testDoHealthChecksWithSuccess() {
SalesforceDatastoreProperties datastore = new SalesforceDatastoreProperties("datastore");
CommonTestUtils.setValueForDatastoreProperties(datastore);
SalesforceDatastoreRuntime runtime = new SalesforceDatastoreRuntime();
runtime.initialize(null, datastore);
Iterable<ValidationResult> results = runtime.doHealthChecks(null);
Assert.assertNotNull(results);
for (ValidationResult result : results) {
Assert.assertTrue(result.getMessage(), result.getStatus() == ValidationResult.Result.OK);
}
}
Aggregations