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.transport.vm;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.module.client.MuleClient;
11  import org.mule.tck.functional.StringAppendTestTransformer;
12  import org.mule.tck.junit4.FunctionalTestCase;
13  
14  import org.junit.Test;
15  
16  import static org.junit.Assert.assertEquals;
17  import static org.junit.Assert.assertNotNull;
18  
19  public class TransformerAttributeTestCase extends FunctionalTestCase
20  {
21  
22      public static final String OUTBOUND_MESSAGE = "Test message";
23  
24      @Override
25      protected String getConfigResources()
26      {
27          return "vm/transformer-attribute-test.xml";
28      }
29  
30      @Test
31      public void testSimple() throws Exception
32      {
33          MuleMessage message = new MuleClient(muleContext).send("vm://simple", OUTBOUND_MESSAGE, null);
34          assertNotNull(message);
35          assertEquals(StringAppendTestTransformer.appendDefault(OUTBOUND_MESSAGE)  + " Received",
36                  message.getPayloadAsString());
37      }
38  
39      @Test
40      public void testThrough() throws Exception
41      {
42          MuleMessage message = new MuleClient(muleContext).send("vm://chained", OUTBOUND_MESSAGE, null);
43          assertNotNull(message);
44          assertEquals(StringAppendTestTransformer.appendDefault(OUTBOUND_MESSAGE)  + " Received",
45                  message.getPayloadAsString());
46      }
47  
48  }