View Javadoc

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