View Javadoc

1   /*
2    * $Id: QuartzPersistentQueueEventGeneratorTestCase.java 22498 2011-07-21 13:01:39Z justin.calleja $
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 static org.junit.Assert.assertEquals;
14  import static org.junit.Assert.assertFalse;
15  import static org.junit.Assert.assertNotNull;
16  
17  import java.util.Arrays;
18  import java.util.Collection;
19  
20  import org.junit.Test;
21  import org.junit.runners.Parameterized.Parameters;
22  import org.mule.api.MuleMessage;
23  import org.mule.module.client.MuleClient;
24  import org.mule.tck.AbstractServiceAndFlowTestCase;
25  import org.mule.transport.NullPayload;
26  
27  public class QuartzPersistentQueueEventGeneratorTestCase extends AbstractServiceAndFlowTestCase
28  {
29  
30      private static final long TIMEOUT = 30000;
31  
32      public QuartzPersistentQueueEventGeneratorTestCase(ConfigVariant variant, String configResources)
33      {
34          super(variant, configResources);
35      }
36  
37      @Parameters
38      public static Collection<Object[]> parameters()
39      {
40          return Arrays.asList(new Object[][]{
41              {ConfigVariant.SERVICE, "quartz-persistent-event-generator-service.xml"},
42              {ConfigVariant.FLOW, "quartz-persistent-event-generator-flow.xml"}});
43      }
44  
45      @Test
46      public void testReceiveEvent() throws Exception
47      {
48          MuleClient client = new MuleClient(muleContext);
49  
50          MuleMessage result = client.request("vm://resultQueue", TIMEOUT);
51          assertNotNull(result);
52          assertFalse(result.getPayload() instanceof NullPayload);
53          assertEquals(TEST_MESSAGE, result.getPayload());
54      }
55  }