Your browser does not support JavaScript and this site utilizes JavaScript to build content and provide links to additional information. You should either enable JavaScript in your browser settings or use a browser that supports JavaScript in order to take full advantage of this site.
1 4 package org.oddjob.scheduling; 5 6 import java.io.ByteArrayInputStream ; 7 8 import junit.framework.TestCase; 9 10 import org.oddjob.Oddjob; 11 12 public class ScheduleJobTest extends TestCase { 13 14 public static class MockScheduler implements OddjobScheduler { 15 String id; 16 public boolean canSchedule(Object component) { 17 return true; 18 } 19 public void schedule(ScheduleInstruction scheduleInstruction) { 20 id = scheduleInstruction.getId(); 21 } 22 public ScheduleSummary[] summariesFor(Object object) { 23 return null; 25 } 26 public void unSchedule(String id) { 27 29 } 30 } 31 32 public void test1() { 33 String xml = "<oddjob><sequential><class id='mysched' class='" 34 + MockScheduler.class.getName() + "'/>" 35 + "<schedule scheduler='${mysched}'><schedules>" 36 + "<cron id='foo'/></schedules>" 37 + "</schedule></sequential></oddjob>"; 38 39 Oddjob oj = new Oddjob(); 40 oj.setInput(new ByteArrayInputStream (xml.getBytes())); 41 oj.run(); 42 43 MockScheduler ms = (MockScheduler) oj.lookup("mysched"); 44 assertEquals("foo", ms.id); 45 } 46 } 47
| Popular Tags
|