1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.quartz;
12
13 import org.mule.module.client.MuleClient;
14 import org.mule.tck.FunctionalTestCase;
15 import org.mule.tck.functional.CountdownCallback;
16 import org.mule.tck.functional.FunctionalTestComponent;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 public class QuartzDispatchJobTestCase extends FunctionalTestCase
22 {
23 @Override
24 protected String getConfigResources()
25 {
26 return "quartz-dispatch.xml";
27 }
28
29 public void testMuleClientDispatchJob() throws Exception
30 {
31 FunctionalTestComponent component = getFunctionalTestComponent("scheduledService");
32 assertNotNull(component);
33 CountdownCallback count = new CountdownCallback(3);
34 component.setEventCallback(count);
35
36 new MuleClient(muleContext).send("vm://quartz.scheduler", "quartz test", null);
37 assertTrue(count.await(5000));
38 }
39
40 public void testMuleClientDispatchJobWithExpressionAddress() throws Exception
41 {
42 FunctionalTestComponent component = getFunctionalTestComponent("expressionScheduledService");
43 assertNotNull(component);
44 CountdownCallback count = new CountdownCallback(3);
45 component.setEventCallback(count);
46
47 Map<String,String> props = new HashMap<String,String>();
48 props.put("ENDPOINT_NAME", "quartz.expression.in");
49
50 new MuleClient(muleContext).send("vm://quartz.expression.scheduler", "quartz test", props);
51 assertTrue(count.await(5000));
52 }
53 }