View Javadoc

1   /*
2    * $Id: QuartzDispatchJobTestCase.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
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  }