use of org.talend.components.salesforce.dataprep.SalesforceInputProperties in project components by Talend.
the class SalesforceInputTestIT method testTypeForQuery.
@Test
public void testTypeForQuery() throws Exception {
SalesforceInputProperties properties = createCommonSalesforceInputPropertiesForQuery();
SalesforceDataprepSource source = new SalesforceDataprepSource();
source.initialize(null, properties);
source.validate(null);
try (Reader reader = source.createReader(null)) {
int count = 3;
for (boolean available = reader.start(); available; available = reader.advance()) {
IndexedRecord record = (IndexedRecord) reader.getCurrent();
assertEquals(String.class, record.get(0).getClass());
assertEquals(String.class, record.get(1).getClass());
if ((count--) < 1) {
break;
}
}
}
}
use of org.talend.components.salesforce.dataprep.SalesforceInputProperties in project components by Talend.
the class SalesforceDatasetRuntime method getSample.
@Override
public void getSample(int limit, Consumer<IndexedRecord> consumer) {
SalesforceDataprepSource sds = new SalesforceDataprepSource();
SalesforceInputProperties properties = new SalesforceInputProperties("model");
properties.setDatasetProperties(dataset);
throwExceptionIfValidationResultIsError(sds.initialize(container, properties));
throwExceptionIfValidationResultIsError(sds.validate(container));
SalesforceBulkQueryReader reader = (SalesforceBulkQueryReader) sds.createReader(container);
reader.setLimit(limit);
ReaderDataProvider<IndexedRecord> readerDataProvider = new ReaderDataProvider<>(reader, limit, consumer);
readerDataProvider.retrieveData();
}
use of org.talend.components.salesforce.dataprep.SalesforceInputProperties in project components by Talend.
the class TSalesforceInputDefinitionTest method setUp.
@Before
public void setUp() {
definition = new TSalesforceInputDefinition();
properties = new SalesforceInputProperties("root");
properties.init();
}
use of org.talend.components.salesforce.dataprep.SalesforceInputProperties in project components by Talend.
the class SalesforceDatasetProperties method runtimeTask.
private void runtimeTask(Consumer task) throws IOException {
try (SandboxedInstance sandboxedInstance = getSandboxedInstance(DATAPREP_SOURCE_CLASS)) {
SalesforceRuntimeSourceOrSink runtime = (SalesforceRuntimeSourceOrSink) sandboxedInstance.getInstance();
SalesforceInputProperties properties = new SalesforceInputProperties("model");
properties.setDatasetProperties(this);
throwExceptionIfValidationResultIsError(runtime.initialize(null, properties));
throwExceptionIfValidationResultIsError(runtime.validate(null));
task.accept(runtime);
}
}
use of org.talend.components.salesforce.dataprep.SalesforceInputProperties 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);
}
Aggregations