use of org.talend.components.salesforce.dataset.SalesforceDatasetProperties in project components by Talend.
the class SalesforceDatastoreDefinition method createDatasetProperties.
@SuppressWarnings("rawtypes")
@Override
public DatasetProperties createDatasetProperties(SalesforceDatastoreProperties storeProp) {
SalesforceDatasetProperties datasetProperties = new SalesforceDatasetProperties("dataset");
datasetProperties.init();
datasetProperties.setDatastoreProperties(storeProp);
return datasetProperties;
}
use of org.talend.components.salesforce.dataset.SalesforceDatasetProperties in project components by Talend.
the class SalesforceDatastoreRuntime method doHealthChecks.
@Override
public Iterable<ValidationResult> doHealthChecks(RuntimeContainer container) {
SalesforceDataprepSource sds = new SalesforceDataprepSource();
SalesforceInputProperties properties = new SalesforceInputProperties("model");
SalesforceDatasetProperties dataset = new SalesforceDatasetProperties("dataset");
// set the sourcetype to soql to prevent loading of all modules during health check
dataset.sourceType.setValue(SalesforceDatasetProperties.SourceType.SOQL_QUERY);
properties.setDatasetProperties(dataset);
dataset.setDatastoreProperties(datastore);
sds.initialize(container, properties);
ValidationResult result = sds.validate(container);
return Arrays.asList(result);
}
use of org.talend.components.salesforce.dataset.SalesforceDatasetProperties in project components by Talend.
the class SalesforceDatasetRuntimeTestIT method testGetSampleForQuery.
@Test
public void testGetSampleForQuery() {
SalesforceDatasetProperties dataset = createDatasetPropertiesForQuery();
getSampleAction(dataset);
}
use of org.talend.components.salesforce.dataset.SalesforceDatasetProperties in project components by Talend.
the class SalesforceDatasetRuntimeTestIT method createDatasetPropertiesForQuery.
private SalesforceDatasetProperties createDatasetPropertiesForQuery() {
SalesforceDatastoreDefinition def = new SalesforceDatastoreDefinition();
SalesforceDatastoreProperties datastore = new SalesforceDatastoreProperties("datastore");
CommonTestUtils.setValueForDatastoreProperties(datastore);
SalesforceDatasetProperties dataset = (SalesforceDatasetProperties) def.createDatasetProperties(datastore);
dataset.sourceType.setValue(SalesforceDatasetProperties.SourceType.SOQL_QUERY);
dataset.query.setValue("SELECT Id, Name FROM Account");
return dataset;
}
use of org.talend.components.salesforce.dataset.SalesforceDatasetProperties in project components by Talend.
the class SalesforceDatasetRuntimeTestIT method testGetSampleWithRelationshipQuery.
@Test
public void testGetSampleWithRelationshipQuery() {
SalesforceDatastoreDefinition def = new SalesforceDatastoreDefinition();
SalesforceDatastoreProperties datastore = new SalesforceDatastoreProperties("datastore");
CommonTestUtils.setValueForDatastoreProperties(datastore);
SalesforceDatasetProperties dataset = (SalesforceDatasetProperties) def.createDatasetProperties(datastore);
dataset.sourceType.setValue(SalesforceDatasetProperties.SourceType.SOQL_QUERY);
dataset.query.setValue("SELECT Account.Name from Contact");
SalesforceDatasetRuntime runtime = new SalesforceDatasetRuntime();
runtime.initialize(null, dataset);
final IndexedRecord[] record = new IndexedRecord[1];
Consumer<IndexedRecord> storeTheRecords = new Consumer<IndexedRecord>() {
@Override
public void accept(IndexedRecord data) {
record[0] = data;
}
};
runtime.getSample(1, storeTheRecords);
Assert.assertTrue("empty result", record.length > 0);
Assert.assertNotNull(record[0].getSchema().getField("Account_Name"));
}
Aggregations