1
2
3
4
5
6
7 package org.mule.transport.quartz;
8
9 import org.mule.api.MuleMessage;
10 import org.mule.module.client.MuleClient;
11 import org.mule.tck.junit4.FunctionalTestCase;
12 import org.mule.transport.quartz.jobs.ScheduledDispatchJobConfig;
13
14 import org.junit.Test;
15
16 import static org.junit.Assert.assertNotNull;
17 import static org.junit.Assert.assertTrue;
18
19 public class QuartzPersistentCustomJobFromMessageTestCase extends FunctionalTestCase
20 {
21
22 private static final long TIMEOUT = 30000;
23
24 @Override
25 protected String getConfigResources()
26 {
27 return "quartz-persistent-custom-job-generator.xml";
28 }
29
30 @Test
31 public void testSendToCustomEventScheduler() throws Exception
32 {
33 MuleClient client = new MuleClient(muleContext);
34
35 ScheduledDispatchJobConfig jobConfig = new ScheduledDispatchJobConfig();
36 jobConfig.setMuleContext(muleContext);
37 jobConfig.setEndpointRef("vm://resultQueue");
38 client.dispatch("vm://customJobQueue", jobConfig, null);
39
40 MuleMessage result = client.request("vm://resultQueue", TIMEOUT);
41 assertNotNull(result);
42 assertTrue(result.getPayload() instanceof ScheduledDispatchJobConfig);
43 }
44 }