Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. global String query;
  2.  
  3. global my_ProcessPurge_Batch() {
  4. //initialize query string here
  5. }
  6.  
  7. global Database.QueryLocator start(Database.BatchableContext BC) {
  8. return Database.getQueryLocator(query);
  9. }
  10.  
  11. global void execute(Database.BatchableContext BC, List<sObject> scope) {
  12. //some DML statements here
  13. }
  14.  
  15. global void finish(Database.BatchableContext BC) {
  16. //send email of the result
  17. //schedule next batch
  18. my_ProcessPurge_Batch nextBatch = new my_ProcessPurge_Batch();
  19. //job should start executing after 24 hrs
  20. //scope is 1000
  21. System.scheduleBatch(nextBatch, 'my_ProcessPurge_Batch', 1440, 1000);
  22. }
  23.  
  24. @isTest static void testProcessPurge() {
  25. Test.startTest();
  26. //populate test data
  27. //start batch
  28. my_ProcessPurge_Batch purgeBatch = new my_ProcessPurge_Batch();
  29. database.executeBatch(purgeBatch);
  30. Test.stopTest();
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement