1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.quartz;
12
13 import org.mule.tck.FunctionalTestCase;
14
15 import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
16 import edu.emory.mathcs.backport.java.util.concurrent.TimeUnit;
17
18 import org.quartz.Job;
19 import org.quartz.JobExecutionContext;
20 import org.quartz.JobExecutionException;
21
22 public class QuartzCustomJobTestCase extends FunctionalTestCase
23 {
24 @Override
25 protected String getConfigResources()
26 {
27 return "quartz-custom-job.xml";
28 }
29
30 public void testCustomJob() throws Exception
31 {
32 CountDownLatch eventLatch = (CountDownLatch) muleContext.getRegistry().lookupObject("latch");
33
34
35
36
37 assertTrue(eventLatch.await(60000, TimeUnit.MILLISECONDS));
38 }
39
40 public static class MockJob implements Job
41 {
42 private CountDownLatch eventLatch;
43
44 public MockJob(CountDownLatch latch)
45 {
46 eventLatch = latch;
47 }
48
49 public void execute(JobExecutionContext context) throws JobExecutionException
50 {
51 eventLatch.countDown();
52 }
53 }
54 }
55
56