use of org.talend.components.salesforce.SalesforceGetDeletedUpdatedProperties 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.SalesforceGetDeletedUpdatedProperties in project components by Talend.
the class SalesforceGetDeletedUpdatedReaderTestIT method createSalesforceGetDeletedUpdatedProperties.
protected SalesforceGetDeletedUpdatedProperties createSalesforceGetDeletedUpdatedProperties(boolean emptySchema) throws Throwable {
SalesforceGetDeletedUpdatedProperties props = (SalesforceGetDeletedUpdatedProperties) new SalesforceGetDeletedUpdatedProperties("foo").init();
props.connection.timeout.setValue(120000);
setupProps(props.connection, !ADD_QUOTES);
if (emptySchema) {
setupModuleWithEmptySchema(props.module, EXISTING_MODULE_NAME);
} else {
props.module.moduleName.setValue(EXISTING_MODULE_NAME);
props.module.main.schema.setValue(getMakeRowSchema(false));
}
props.startDate.setValue(Calendar.getInstance().getTime());
props.endDate.setValue(Calendar.getInstance().getTime());
ComponentTestUtils.checkSerialize(props, errorCollector);
return props;
}
Aggregations