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