View Javadoc

1   /*
2    * $Id: MessageContextTestCase.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.exceptions;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.module.client.MuleClient;
16  import org.mule.tck.AbstractServiceAndFlowTestCase;
17  
18  import java.util.Arrays;
19  import java.util.Collection;
20  
21  import org.junit.Test;
22  import org.junit.runners.Parameterized.Parameters;
23  
24  import static org.junit.Assert.assertNotNull;
25  
26  public class MessageContextTestCase extends AbstractServiceAndFlowTestCase
27  {
28      @Parameters
29      public static Collection<Object[]> parameters()
30      {
31          return Arrays.asList(new Object[][]{
32              {ConfigVariant.SERVICE, "org/mule/test/integration/exceptions/message-context-test-service.xml"},
33              {ConfigVariant.FLOW, "org/mule/test/integration/exceptions/message-context-test-flow.xml"}
34          });
35      }
36  
37      public MessageContextTestCase(ConfigVariant variant, String configResources)
38      {
39          super(variant, configResources);
40      }
41  
42      /**
43       * Test for MULE-4361
44       */
45      @Test
46      public void testAlternateExceptionStrategy() throws Exception
47      {
48          MuleClient client = new MuleClient(muleContext);
49          DefaultMuleMessage msg = new DefaultMuleMessage("Hello World", client.getMuleContext());
50          MuleMessage response = client.send("testin", msg, 200000);
51          assertNotNull(response);
52      }
53  }