1   /*
2    * $Id: InboundTransformingCatchAllTestCase.java 10789 2008-02-12 20:04:43Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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  
25      public void testNormal() throws Exception
26      {
27          MuleClient client = new MuleClient();
28          client.dispatch("vm://in1", new DefaultMuleMessage("HELLO!"));
29          MuleMessage msg = client.request("vm://catchall", 3000);
30          assertNotNull(msg);
31          assertTrue(msg.getPayload() instanceof String);
32  
33          client.dispatch("vm://in2", new DefaultMuleMessage("HELLO!"));
34          msg = client.request("vm://catchall", 3000);
35          assertNotNull(msg);
36          assertTrue(msg.getPayload() instanceof byte[]);
37      }
38  
39      protected String getConfigResources()
40      {
41          return "org/mule/test/usecases/routing/inbound-transforming-catchall.xml";
42      }
43  }