use of org.talend.components.salesforce.SalesforceConnectionModuleProperties in project components by Talend.
the class SalesforceGetDeletedUpdatedReaderTestIT method runGetDeletedTest.
protected void runGetDeletedTest(boolean emptySchema) throws Throwable {
SalesforceGetDeletedUpdatedProperties sgduProperties = createSalesforceGetDeletedUpdatedProperties(emptySchema);
SalesforceConnectionModuleProperties connProperties = new SalesforceConnectionModuleProperties("foo") {
@Override
protected Set<PropertyPathConnector> getAllSchemaPropertiesConnectors(boolean isOutputConnection) {
// TODO Auto-generated method stub
return null;
}
};
connProperties.copyValuesFrom(sgduProperties);
SalesforceServerTimeStampReaderTestIT timeStampReaderTestIT = new SalesforceServerTimeStampReaderTestIT();
Calendar startDate = timeStampReaderTestIT.getServerTimestamp();
String randomInsert = createNewRandom();
int count = 10;
// Prepare test data
List<IndexedRecord> outputRowsInsert = makeRows(randomInsert, count, emptySchema);
outputRowsInsert = writeRows(randomInsert, connProperties, outputRowsInsert, SalesforceOutputProperties.OutputAction.INSERT);
checkRows(randomInsert, outputRowsInsert, count);
// Generate updated record
String randomUpdate = String.valueOf(Integer.parseInt(randomInsert) + 100);
List<IndexedRecord> outputRowsUpdate = makeUpdateRows(randomUpdate, emptySchema, outputRowsInsert);
outputRowsUpdate = writeRows(randomUpdate, connProperties, outputRowsUpdate, SalesforceOutputProperties.OutputAction.UPDATE);
checkRows(randomUpdate, outputRowsUpdate, count);
try {
List<IndexedRecord> rows = readRows(connProperties);
checkRows(randomUpdate, rows, count);
} finally {
deleteRows(outputRowsUpdate, connProperties);
}
Calendar endDate = timeStampReaderTestIT.getServerTimestamp();
// Long ms = 60000 - (endDate.getTimeInMillis() - startDate.getTimeInMillis());
// System.out.println(ms);
// if (ms > 0) {
// endDate.setTimeInMillis(startDate.getTimeInMillis()+120000);
// }
endDate.setTimeInMillis(endDate.getTimeInMillis() + 180000);
System.out.println(endDate.getTimeInMillis() - startDate.getTimeInMillis());
sgduProperties.startDate.setValue(startDate.getTime());
sgduProperties.endDate.setValue(endDate.getTime());
// Test get deleted records
TSalesforceGetDeletedProperties sgdProperties = new TSalesforceGetDeletedProperties("foo");
sgdProperties.copyValuesFrom(sgduProperties);
List<IndexedRecord> deletedRows = readDeletedUpdatedRows(sgdProperties);
checkRows(randomUpdate, deletedRows, count);
// Test get updated records (Can't be test here)
// (Can't be test here)
// TSalesforceGetUpdatedProperties sguProperties = (TSalesforceGetUpdatedProperties)new
// TSalesforceGetUpdatedProperties("foo").init();
// sgdProperties.copyValuesFrom(connProperties);
// List<IndexedRecord> updatedRows = readRows(sgdProperties);
// checkRows(randomUpdate, updatedRows, count);
}
use of org.talend.components.salesforce.SalesforceConnectionModuleProperties in project components by Talend.
the class SalesforceSourceOrSinkTestIT method testGetConnectionProperties.
@Test
public void testGetConnectionProperties() {
// using SalesforceConnectionProperties
SalesforceConnectionProperties scp = setupProps(null, !ADD_QUOTES);
SalesforceSourceOrSink salesforceSourceOrSink = new SalesforceSourceOrSink();
salesforceSourceOrSink.initialize(null, scp);
assertEquals(scp, salesforceSourceOrSink.getConnectionProperties());
// using SalesforceConnectionProperties
SalesforceConnectionModuleProperties scmp = new SalesforceConnectionModuleProperties(null) {
@Override
protected Set<PropertyPathConnector> getAllSchemaPropertiesConnectors(boolean isOutputConnection) {
// TODO Auto-generated method stub
return null;
}
};
salesforceSourceOrSink.initialize(null, scmp);
assertEquals(scmp.connection, salesforceSourceOrSink.getConnectionProperties());
}
Aggregations