View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.issues;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.module.client.MuleClient;
11  import org.mule.tck.junit4.FunctionalTestCase;
12  
13  import org.junit.Test;
14  
15  import static org.junit.Assert.assertEquals;
16  import static org.junit.Assert.assertNotNull;
17  
18  public class TransformerChainMule2063TestCase extends FunctionalTestCase
19  {
20  
21      public static final String IN = "in";
22      public static final String TEST1_OUT = IN + "123";
23      public static final String TEST2_OUT = IN + "123";
24      public static final String TEST3_OUT = IN + "123abc";
25      public static final long WAIT_MS = 3000L;
26  
27      @Override
28      protected String getConfigResources()
29      {
30          return "issues/transformer-chain-mule-2063-test.xml";
31      }
32  
33      protected void doTest(String name, String result) throws Exception
34      {
35          MuleClient client = new MuleClient(muleContext);
36          client.send("vm://" + name + "-in", IN, null);
37          MuleMessage message = client.request("vm://" + name + "-out", WAIT_MS);
38          
39          assertNotNull(message);
40          assertNotNull(message.getPayloadAsString());
41          assertEquals(result, message.getPayloadAsString());
42      }
43  
44      @Test
45      public void testInputTransformers() throws Exception
46      {
47          doTest("test1", TEST1_OUT);
48      }
49  
50      @Test
51      public void testGlobalTransformers() throws Exception
52      {
53          doTest("test2", TEST2_OUT);
54      }
55  
56      @Test
57      public void testOutputTransformers() throws Exception
58      {
59          doTest("test3", TEST3_OUT);
60      }
61  
62  }