1   /*
2    * $Id: TriggerNoArgsServiceMethodTestCase.java 11830 2008-05-21 17:44:00Z rossmason $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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  package org.mule.test.cookbook.quartz;
11  
12  import org.mule.tck.FunctionalTestCase;
13  import org.mule.module.client.MuleClient;
14  import org.mule.api.MuleMessage;
15  
16  // START SNIPPET: documentation
17  /**
18   * The Quartz transport can be used to trigger an event to be received by the component based on the endpoint
19   * configuration.  In Mule an event is usually expected, however in this example we have a service component who's
20   * service method doesn't take any parameters. The {@link org.mule.transport.quartz.jobs.EventGeneratorJob} can be used to trigger a service method,
21   * and by not specifying a 'payload' element there is no data to try and match to the service method, so Mule will
22   * match a method with no arguments.
23   */
24  // END SNIPPET: documentation
25  // START SNIPPET: full-class
26  public class TriggerNoArgsServiceMethodTestCase extends FunctionalTestCase
27  {
28      protected String getConfigResources()
29      {
30          return "org/mule/test/cookbook/quartz/trigger-no-args-method-config.xml";
31      }
32  
33      public void testTrigger() throws Exception
34      {
35          MuleClient client = new MuleClient();
36  
37          //Our method should have fired and we can pick up the result
38          MuleMessage result = client.request("resultQueue", 2000);
39  
40          //Always check method is not null. It wuld be rude not to!
41          assertNotNull(result);
42  
43          //Check we have a hit
44          assertEquals("Bullseye!", result.getPayloadAsString());
45      }
46  }
47  // END SNIPPET: full-class