View Javadoc

1   /*
2    * $Id: VmXaTransactionsPersistentQueueTestCase.java 22421 2011-07-15 05:05:06Z 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.test.integration.transaction;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.AbstractServiceAndFlowTestCase;
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  
23  import static org.junit.Assert.assertEquals;
24  import static org.junit.Assert.assertNotNull;
25  import static org.junit.Assert.assertNull;
26  
27  public class VmXaTransactionsPersistentQueueTestCase extends AbstractServiceAndFlowTestCase
28  {
29      private static final String TEST_MESSAGE = "TEST_MESSAGE";
30  
31      private final long timeout = getTestTimeoutSecs() * 1000 / 30;
32  
33      @Parameters
34      public static Collection<Object[]> parameters()
35      {
36          return Arrays.asList(new Object[][]{
37              {ConfigVariant.SERVICE,
38                  "org/mule/test/integration/transaction/vm-xa-transaction-persistent-queue-service.xml"},
39              {ConfigVariant.FLOW,
40                  "org/mule/test/integration/transaction/vm-xa-transaction-persistent-queue-flow.xml"}});
41      }
42  
43      public VmXaTransactionsPersistentQueueTestCase(ConfigVariant variant, String configResources)
44      {
45          super(variant, configResources);
46      }
47  
48      @Test
49      public void testOutboundRouterTransactions() throws Exception
50      {
51          MuleClient client = new MuleClient(muleContext);
52          MuleMessage msg = client.send("vm://in", TEST_MESSAGE, null, (int) timeout);
53  
54          assertNotNull(msg);
55          assertNull(msg.getExceptionPayload());
56          assertEquals("Wrong message returned", TEST_MESSAGE + " Received", msg.getPayload());
57      }
58  }