use of org.talend.components.salesforce.dataprep.SalesforceInputProperties in project components by Talend.
the class SalesforceInputTestIT method testReaderForModule.
@Test
public void testReaderForModule() {
Reader reader = null;
try {
SalesforceInputProperties properties = createCommonSalesforceInputPropertiesForModule();
properties.getDatasetProperties().selectColumnIds.setValue(Arrays.asList("IsDeleted", "Id"));
SalesforceDataprepSource source = new SalesforceDataprepSource();
source.initialize(null, properties);
source.validate(null);
reader = source.createReader(null);
reader.start();
IndexedRecord row = (IndexedRecord) reader.getCurrent();
String id = (String) row.get(0);
Assert.assertNotNull("id is null", id);
reader.advance();
row = (IndexedRecord) reader.getCurrent();
Assert.assertNotNull("id is null", id);
reader.close();
// Map<String, Object> returnMap = reader.getReturnValues();
// Assert.assertEquals(3, returnMap.get(ComponentDefinition.RETURN_TOTAL_RECORD_COUNT));
} catch (Exception e) {
Assert.fail(e.getMessage());
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
Assert.fail(e.getMessage());
}
}
}
}
use of org.talend.components.salesforce.dataprep.SalesforceInputProperties in project components by Talend.
the class SalesforceDatasetRuntime method getSchema.
@Override
public Schema getSchema() {
SalesforceDataprepSource sds = new SalesforceDataprepSource();
SalesforceInputProperties properties = new SalesforceInputProperties("model");
properties.setDatasetProperties(dataset);
sds.initialize(container, properties);
sds.validate(container);
try {
// TODO the UI will be a radio, need to adjust here
return SalesforceSchemaUtils.getSchema(dataset, sds, container);
} catch (IOException e) {
throw new ComponentException(e);
}
}
Aggregations