View Javadoc

1   /*
2    * $Id: QuartzReceiveAndDispatchJobTestCase.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  public class QuartzReceiveAndDispatchJobTestCase extends FunctionalTestCase
19  {
20      protected String getConfigResources()
21      {
22          return "quartz-receive-dispatch.xml";
23      }
24  
25      public void testMuleClientReceiveAndDispatchJob() throws Exception
26      {
27          FunctionalTestComponent component = getFunctionalTestComponent("scheduledService");
28          assertNotNull(component);
29          CountdownCallback count = new CountdownCallback(3);
30          component.setEventCallback(count);
31  
32          MuleClient client = new MuleClient(muleContext);
33          client.dispatch("vm://event.queue", "quartz test", null);
34          client.dispatch("vm://event.queue", "quartz test", null);
35          client.dispatch("vm://event.queue", "quartz test", null);
36  
37          client.dispatch("vm://quartz.scheduler", "test", null);
38          Thread.sleep(5000);
39          assertEquals(0, count.getCount());
40      }
41  }