View Javadoc

1   /*
2    * $Id: MethodEntryPointWithTransformerTestCase.java 19692 2010-09-21 23:50:35Z aperepel $
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.integration.resolvers;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class MethodEntryPointWithTransformerTestCase extends FunctionalTestCase
18  {
19      @Override
20      protected String getConfigResources()
21      {
22          return "org/mule/test/integration/resolvers/method-entrypoint-with-transformer-config.xml";
23      }
24  
25      /**
26       * Tests that a MethodEntryPointResolver is able to receive the method property
27       * from a MessagePropertyTransformer, that means that the transformer is applied
28       * before resolving that property.
29       */
30      public void testReceivesMethodPropertyFromAPropertyTransformer() throws Exception
31      {
32          MuleClient client = new MuleClient(muleContext);
33          MuleMessage response = client.send("vm://in", "payload", null);
34          assertNotNull(response);
35          assertNotNull(response.getPayload());
36          assertEquals("Transformed payload", response.getPayloadAsString());
37      }
38  
39      /**
40       * Transforms a message for testing purposes. 
41       * <p> Is referenced by the test configuration because it implements the test component method which should be call by the MethodEntryPointResolver.
42       */
43      public String transformMessage(String message)
44      {
45          return "Transformed " + message;
46      }
47  }