1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.quartz;
12
13 import static org.junit.Assert.assertNotNull;
14 import static org.junit.Assert.assertTrue;
15
16 import java.util.Arrays;
17 import java.util.Collection;
18
19 import org.junit.Test;
20 import org.junit.runners.Parameterized.Parameters;
21 import org.mule.tck.AbstractServiceAndFlowTestCase;
22 import org.mule.tck.functional.CountdownCallback;
23 import org.mule.tck.functional.FunctionalTestComponent;
24
25 public class QuartzFunctionalTestCase extends AbstractServiceAndFlowTestCase
26 {
27
28 public QuartzFunctionalTestCase(ConfigVariant variant, String configResources)
29 {
30 super(variant, configResources);
31 }
32
33 @Parameters
34 public static Collection<Object[]> parameters()
35 {
36 return Arrays.asList(new Object[][]{
37 {ConfigVariant.SERVICE, "quartz-functional-test-service.xml"},
38 {ConfigVariant.FLOW, "quartz-functional-test-flow.xml"}
39 });
40 }
41
42 @Test
43 public void testMuleReceiverJob() throws Exception
44 {
45 FunctionalTestComponent component = (FunctionalTestComponent) getComponent("quartzService1");
46 assertNotNull(component);
47 CountdownCallback count1 = new CountdownCallback(4);
48 component.setEventCallback(count1);
49
50 component = (FunctionalTestComponent) getComponent("quartzService2");
51 assertNotNull(component);
52 CountdownCallback count2 = new CountdownCallback(2);
53 component.setEventCallback(count2);
54
55
56
57
58 assertTrue("Count 1 timed out: expected 0, value is: " + count1.getCount(), count1.await(60000));
59 assertTrue("Count 2 timed out: expected 0, value is: " + count2.getCount(), count2.await(5000));
60 }
61
62 }