View Javadoc

1   /*
2    * $Id: InboundTransformingCatchAllTestCase.java 19191 2010-08-25 21:05:23Z tcarlson $
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.usecases.routing;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.module.client.MuleClient;
16  import org.mule.tck.FunctionalTestCase;
17  
18  /*
19   * In this Test Case we make use of a Custom Catch All Strategy in order to show how
20   * to send the transformed message instead of the non-transformed message.
21   */
22  public class InboundTransformingCatchAllTestCase extends FunctionalTestCase
23  {
24      public void testNormal() throws Exception
25      {
26          MuleClient client = new MuleClient(muleContext);
27          client.dispatch("vm://in1", new DefaultMuleMessage("HELLO!", muleContext));
28          MuleMessage msg = client.request("vm://catchall", 3000);
29          assertNotNull(msg);
30          assertTrue(msg.getPayload() instanceof String);
31  
32          client.dispatch("vm://in2", new DefaultMuleMessage("HELLO!", muleContext));
33          msg = client.request("vm://catchall", 3000);
34          assertNotNull(msg);
35          assertTrue(msg.getPayload() instanceof byte[]);
36      }
37  
38      @Override
39      protected String getConfigResources()
40      {
41          return "org/mule/test/usecases/routing/inbound-transforming-catchall.xml";
42      }
43  }