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 UnscheduleJobTest extends TestCase { 13 14 public static class MockScheduler implements OddjobScheduler { 15 String id; 16 public boolean canSchedule(Object component) { 17 return false; 18 } 19 public void schedule(ScheduleInstruction scheduleInstruction) { 20 } 21 public ScheduleSummary[] summariesFor(Object object) { 22 return null; 23 } 24 public void unSchedule(String id) { 25 this.id = id; 26 } 27 } 28 29 public void testSimple() { 30 MockScheduler scheduler = new MockScheduler(); 31 32 UnscheduleJob job = new UnscheduleJob(); 33 job.setScheduler(scheduler); 34 job.setScheduleId("test"); 35 36 job.run(); 37 38 assertEquals("test", scheduler.id); 39 } 40 41 public void testInOddjob() { 42 String xml="<oddjob><sequential>" + 43 "<mock class='" + MockScheduler.class.getName() + "' id='sched'/>" + 44 "<unschedule scheduler='${sched}' scheduleId='test'/>" + 45 "</sequential></oddjob>"; 46 47 Oddjob oj = new Oddjob(); 48 oj.setInput(new ByteArrayInputStream (xml.getBytes())); 49 oj.run(); 50 51 MockScheduler scheduler = (MockScheduler) oj.lookup("sched"); 52 53 assertEquals("test", scheduler.id); 54 } 55 } 56
| Popular Tags
|