use of org.teiid.translator.salesforce.execution.DeletedResult in project teiid by teiid.
the class SalesforceConnectionImpl method getDeleted.
public DeletedResult getDeleted(String objectName, Calendar startCalendar, Calendar endCalendar) throws ResourceException {
GetDeletedResult deleted;
try {
deleted = partnerConnection.getDeleted(objectName, startCalendar, endCalendar);
} catch (InvalidSObjectFault e) {
throw new ResourceException(e);
} catch (UnexpectedErrorFault e) {
throw new ResourceException(e);
} catch (ConnectionException e) {
throw new ResourceException(e);
}
DeletedResult result = new DeletedResult();
result.setLatestDateCovered(deleted.getLatestDateCovered());
result.setEarliestDateAvailable(deleted.getEarliestDateAvailable());
DeletedRecord[] records = deleted.getDeletedRecords();
List<DeletedObject> resultRecords = new ArrayList<DeletedObject>();
if (records != null) {
for (DeletedRecord record : records) {
DeletedObject object = new DeletedObject();
object.setID(record.getId());
object.setDeletedDate(record.getDeletedDate());
resultRecords.add(object);
}
}
result.setResultRecords(resultRecords);
return result;
}
use of org.teiid.translator.salesforce.execution.DeletedResult in project teiid by teiid.
the class TestSalesforceConnectionImpl method testGetDeleted.
@Test
public void testGetDeleted() throws Exception {
PartnerConnection pc = Mockito.mock(PartnerConnection.class);
GetDeletedResult gdr = new GetDeletedResult();
Calendar c = Calendar.getInstance();
gdr.setEarliestDateAvailable(c);
gdr.setLatestDateCovered(c);
DeletedRecord dr = new DeletedRecord();
dr.setDeletedDate(c);
dr.setId("id");
gdr.setDeletedRecords(new DeletedRecord[] { dr });
Mockito.stub(pc.getDeleted("x", null, null)).toReturn(gdr);
SalesforceConnectionImpl sfci = new SalesforceConnectionImpl(pc);
DeletedResult result = sfci.getDeleted("x", null, null);
assertEquals(1, result.getResultRecords().size());
}
Aggregations