View Javadoc

1   /*
2    * $Id: AsyncExceptionHandlingTestCase.java 23248 2011-10-24 18:28:17Z evangelinamrm $
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  import org.mule.tck.junit4.rule.DynamicPort;
18  
19  import java.util.Arrays;
20  import java.util.Collection;
21  
22  import org.junit.Rule;
23  import org.junit.Test;
24  import org.junit.runners.Parameterized.Parameters;
25  
26  import static org.junit.Assert.assertNotNull;
27  
28  public class AsyncExceptionHandlingTestCase extends AbstractServiceAndFlowTestCase
29  {
30  
31      @Rule
32      public DynamicPort dynamicPort1 = new DynamicPort("port1");
33      @Rule
34      public DynamicPort dynamicPort2 = new DynamicPort("port2");
35  
36      @Parameters
37      public static Collection<Object[]> parameters()
38      {
39          return Arrays.asList(new Object[][]{
40              {ConfigVariant.SERVICE, "org/mule/test/integration/exceptions/async-exception-handling-service.xml"},
41              {ConfigVariant.FLOW, "org/mule/test/integration/exceptions/async-exception-handling-flow.xml"}
42          });
43      }
44  
45      public AsyncExceptionHandlingTestCase(ConfigVariant variant, String configResources)
46      {
47          super(variant, configResources);
48      }
49  
50      @Test
51      public void testAsyncExceptionHandlingTestCase() throws Exception
52      {
53          MuleClient client1 = new MuleClient(muleContext);
54          DefaultMuleMessage msg1 = new DefaultMuleMessage("Hello World", muleContext);
55          MuleMessage response1 = client1.send("search.inbound.endpoint", msg1, 300000);
56          assertNotNull(response1);
57      }
58  }