use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties in project components by Talend.
the class SalesforceConnectionMigrationTest method testSalesforceInputPropertiesMigration.
@Test
public void testSalesforceInputPropertiesMigration() throws IOException {
Deserialized<TSalesforceInputProperties> deser = Properties.Helper.fromSerializedPersistent(TestUtils.getResourceAsString(getClass(), "tSalesforceInputProperties_621.json"), TSalesforceInputProperties.class);
assertTrue("the property should be migrated, the migration returned false instead of true", deser.migrated);
TSalesforceInputProperties properties = deser.object;
String apiVersion = properties.connection.apiVersion.getValue();
assertEquals("\"34.0\"", apiVersion);
}
use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties in project components by Talend.
the class ConnectionPropertiesTest method testDeserializeOldReferenceProps.
@Test
public void testDeserializeOldReferenceProps() throws IOException {
String oldPropsStr = TestUtils.getResourceAsString(getClass(), "tSalesforceInputConnectionProperties_old.json");
SerializerDeserializer.Deserialized<TSalesforceInputProperties> fromSerializedPersistent = Properties.Helper.fromSerializedPersistent(oldPropsStr, TSalesforceInputProperties.class);
TSalesforceInputProperties deserializedProps = fromSerializedPersistent.object;
ComponentReferenceProperties deSerRefProps = (ComponentReferenceProperties) deserializedProps.getProperty("connection.referencedComponent");
assertEquals("tSalesforceConnection", deSerRefProps.referenceDefinitionName.getValue());
assertEquals("tSalesforceConnection_1", deSerRefProps.componentInstanceId.getValue());
assertEquals(ComponentReferenceProperties.ReferenceType.COMPONENT_INSTANCE, deSerRefProps.referenceType.getValue());
}
use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties in project components by Talend.
the class SalesforceTestBase method deleteAllAccountTestRows.
public static void deleteAllAccountTestRows(String condition) throws Exception {
TSalesforceInputProperties properties = (TSalesforceInputProperties) new TSalesforceInputProperties("foo").init();
properties.condition.setValue("Name = '" + condition + "'");
BoundedReader<?> salesforceInputReader = new SalesforceTestBase().createSalesforceInputReaderFromModule(EXISTING_MODULE_NAME, properties);
// getting all rows
List<IndexedRecord> rows = new ArrayList<>();
try {
salesforceInputReader.start();
rows.add((IndexedRecord) salesforceInputReader.getCurrent());
while (salesforceInputReader.advance()) {
rows.add((IndexedRecord) salesforceInputReader.getCurrent());
}
} finally {
salesforceInputReader.close();
}
// filtering rows
TSalesforceOutputProperties salesforceoutputProperties = createSalesforceoutputProperties(EXISTING_MODULE_NAME);
setupProps(salesforceoutputProperties.connection, !ADD_QUOTES);
new SalesforceTestBase().deleteRows(rows, salesforceoutputProperties);
}
use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties in project components by Talend.
the class SalesforceTestBase method readRows.
protected List<IndexedRecord> readRows(SalesforceConnectionModuleProperties props) throws IOException {
TSalesforceInputProperties inputProps = (TSalesforceInputProperties) new TSalesforceInputProperties("bar").init();
inputProps.connection = props.connection;
inputProps.module = props.module;
inputProps.batchSize.setValue(200);
inputProps.queryMode.setValue(TSalesforceInputProperties.QueryMode.Query);
List<IndexedRecord> inputRows = readRows(inputProps);
return inputRows;
}
use of org.talend.components.salesforce.tsalesforceinput.TSalesforceInputProperties in project components by Talend.
the class SalesforceTestBase method createSalesforceInputReaderFromModule.
public <T> BoundedReader<T> createSalesforceInputReaderFromModule(String moduleName, TSalesforceInputProperties properties) {
if (null == properties) {
// $NON-NLS-1$
properties = (TSalesforceInputProperties) new TSalesforceInputProperties("foo").init();
}
setupProps(properties.connection, !ADD_QUOTES);
properties.batchSize.setValue(200);
properties.module.moduleName.setValue(moduleName);
properties.module.main.schema.setValue(SchemaBuilder.builder().record("test").prop(SchemaConstants.INCLUDE_ALL_FIELDS, "true").fields().endRecord());
return createBoundedReader(properties);
}
Aggregations