View Javadoc

1   /*
2    * $Id: QuartzEventGeneratorAnnotationTestCase.java 22431 2011-07-18 07:40:35Z dirk.olmes $
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.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.junit4.FunctionalTestCase;
16  import org.mule.transport.NullPayload;
17  
18  import org.junit.Test;
19  
20  import static org.junit.Assert.assertEquals;
21  import static org.junit.Assert.assertFalse;
22  import static org.junit.Assert.assertNotNull;
23  
24  public class QuartzEventGeneratorAnnotationTestCase extends FunctionalTestCase
25  {
26  
27      @Override
28      protected String getConfigResources()
29      {
30          return "quartz-event-generator-with-annotation.xml";
31      }
32  
33      @Test
34      public void testReceiveEvent() throws Exception
35      {
36          MuleClient client = new MuleClient(muleContext);
37  
38          MuleMessage result = client.request("vm://intervalQueue", RECEIVE_TIMEOUT * 2);
39          assertNotNull(result);
40          assertFalse(result.getPayload() instanceof NullPayload);
41          assertEquals("pinged! (interval)", result.getPayload());
42  
43          result = client.request("vm://cronQueue", RECEIVE_TIMEOUT);
44          assertNotNull(result);
45          assertFalse(result.getPayload() instanceof NullPayload);
46          assertEquals("pinged! (cron)", result.getPayload());
47      }
48  }