1   /*
2    * $Id: TransformerChainMule2063TestCase.java 11159 2008-03-04 16:01:22Z dirk.olmes $
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.issues;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class TransformerChainMule2063TestCase extends FunctionalTestCase
18  {
19  
20      public static final String IN = "in";
21      public static final String TEST1_OUT = IN + "123";
22      public static final String TEST2_OUT = IN + "123";
23      public static final String TEST3_OUT = IN + "123abc";
24      public static final long WAIT_MS = 3000L;
25  
26      protected String getConfigResources()
27      {
28          return "issues/transformer-chain-mule-2063-test.xml";
29      }
30  
31      protected void doTest(String name, String result) throws Exception
32      {
33          MuleClient client = new MuleClient();
34          client.send("vm://" + name + "-in", IN, null);
35          MuleMessage message = client.request("vm://" + name + "-out", WAIT_MS);
36          
37          assertNotNull(message);
38          assertNotNull(message.getPayloadAsString());
39          assertEquals(result, message.getPayloadAsString());
40      }
41  
42  
43      public void testInputTransformers() throws Exception
44      {
45          doTest("test1", TEST1_OUT);
46      }
47  
48      public void testGlobalTransformers() throws Exception
49      {
50          doTest("test2", TEST2_OUT);
51      }
52  
53      public void testOutputTransformers() throws Exception
54      {
55          doTest("test3", TEST3_OUT);
56      }
57  
58  }