Search in sources :

Example 1 with SalesforceDatastoreDefinition

use of org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition 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;
}
Also used : SalesforceDatastoreProperties(org.talend.components.salesforce.datastore.SalesforceDatastoreProperties) SalesforceDatastoreDefinition(org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition) SalesforceDatasetProperties(org.talend.components.salesforce.dataset.SalesforceDatasetProperties)

Example 2 with SalesforceDatastoreDefinition

use of org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition 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"));
}
Also used : SalesforceDatastoreProperties(org.talend.components.salesforce.datastore.SalesforceDatastoreProperties) IndexedRecord(org.apache.avro.generic.IndexedRecord) Consumer(org.talend.daikon.java8.Consumer) SalesforceDatastoreDefinition(org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition) SalesforceDatasetProperties(org.talend.components.salesforce.dataset.SalesforceDatasetProperties) Test(org.junit.Test)

Example 3 with SalesforceDatastoreDefinition

use of org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition in project components by Talend.

the class SalesforceDatasetRuntimeTestIT method createDatasetPropertiesForModule.

private SalesforceDatasetProperties createDatasetPropertiesForModule() {
    SalesforceDatastoreDefinition def = new SalesforceDatastoreDefinition();
    SalesforceDatastoreProperties datastore = new SalesforceDatastoreProperties("datastore");
    CommonTestUtils.setValueForDatastoreProperties(datastore);
    SalesforceDatasetProperties dataset = (SalesforceDatasetProperties) def.createDatasetProperties(datastore);
    dataset.moduleName.setValue("Account");
    return dataset;
}
Also used : SalesforceDatastoreProperties(org.talend.components.salesforce.datastore.SalesforceDatastoreProperties) SalesforceDatastoreDefinition(org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition) SalesforceDatasetProperties(org.talend.components.salesforce.dataset.SalesforceDatasetProperties)

Example 4 with SalesforceDatastoreDefinition

use of org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition in project components by Talend.

the class SalesforceInputTestIT method createCommonSalesforceInputPropertiesForModule.

private SalesforceInputProperties createCommonSalesforceInputPropertiesForModule() {
    SalesforceDatastoreDefinition datastore_def = new SalesforceDatastoreDefinition();
    SalesforceDatastoreProperties datastore_props = new SalesforceDatastoreProperties("datastore");
    CommonTestUtils.setValueForDatastoreProperties(datastore_props);
    SalesforceDatasetProperties dataset = (SalesforceDatasetProperties) datastore_def.createDatasetProperties(datastore_props);
    dataset.moduleName.setValue("Account");
    SalesforceInputDefinition input_def = new SalesforceInputDefinition();
    SalesforceInputProperties input_props = (SalesforceInputProperties) input_def.createRuntimeProperties();
    input_props.setDatasetProperties(dataset);
    List<String> products = input_def.getSupportedProducts();
    assertNotNull(products);
    assertEquals(1, products.size());
    assertEquals(SupportedProduct.DATAPREP, products.get(0));
    return input_props;
}
Also used : SalesforceDatastoreProperties(org.talend.components.salesforce.datastore.SalesforceDatastoreProperties) SalesforceDatastoreDefinition(org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition) SalesforceInputProperties(org.talend.components.salesforce.dataprep.SalesforceInputProperties) SalesforceInputDefinition(org.talend.components.salesforce.dataprep.SalesforceInputDefinition) SalesforceDatasetProperties(org.talend.components.salesforce.dataset.SalesforceDatasetProperties)

Example 5 with SalesforceDatastoreDefinition

use of org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition in project components by Talend.

the class SalesforceInputTestIT method createCommonSalesforceInputPropertiesForQuery.

private SalesforceInputProperties createCommonSalesforceInputPropertiesForQuery() {
    SalesforceDatastoreDefinition datastore_def = new SalesforceDatastoreDefinition();
    SalesforceDatastoreProperties datastore_props = new SalesforceDatastoreProperties("datastore");
    CommonTestUtils.setValueForDatastoreProperties(datastore_props);
    SalesforceDatasetProperties dataset = (SalesforceDatasetProperties) datastore_def.createDatasetProperties(datastore_props);
    dataset.sourceType.setValue(SalesforceDatasetProperties.SourceType.SOQL_QUERY);
    dataset.query.setValue("SELECT Id, Name FROM Account");
    SalesforceInputDefinition input_def = new SalesforceInputDefinition();
    SalesforceInputProperties input_props = (SalesforceInputProperties) input_def.createRuntimeProperties();
    input_props.setDatasetProperties(dataset);
    return input_props;
}
Also used : SalesforceDatastoreProperties(org.talend.components.salesforce.datastore.SalesforceDatastoreProperties) SalesforceDatastoreDefinition(org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition) SalesforceInputProperties(org.talend.components.salesforce.dataprep.SalesforceInputProperties) SalesforceInputDefinition(org.talend.components.salesforce.dataprep.SalesforceInputDefinition) SalesforceDatasetProperties(org.talend.components.salesforce.dataset.SalesforceDatasetProperties)

Aggregations

SalesforceDatasetProperties (org.talend.components.salesforce.dataset.SalesforceDatasetProperties)5 SalesforceDatastoreDefinition (org.talend.components.salesforce.datastore.SalesforceDatastoreDefinition)5 SalesforceDatastoreProperties (org.talend.components.salesforce.datastore.SalesforceDatastoreProperties)5 SalesforceInputDefinition (org.talend.components.salesforce.dataprep.SalesforceInputDefinition)2 SalesforceInputProperties (org.talend.components.salesforce.dataprep.SalesforceInputProperties)2 IndexedRecord (org.apache.avro.generic.IndexedRecord)1 Test (org.junit.Test)1 Consumer (org.talend.daikon.java8.Consumer)1