View Javadoc

1   /*
2    * $Id: MethodEntryPointWithTransformerTestCase.java 22421 2011-07-15 05:05:06Z dirk.olmes $
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.AbstractServiceAndFlowTestCase;
16  
17  import java.util.Arrays;
18  import java.util.Collection;
19  
20  import org.junit.Test;
21  import org.junit.runners.Parameterized.Parameters;
22  
23  import static org.junit.Assert.assertEquals;
24  import static org.junit.Assert.assertNotNull;
25  
26  public class MethodEntryPointWithTransformerTestCase extends AbstractServiceAndFlowTestCase
27  {
28      @Parameters
29      public static Collection<Object[]> parameters()
30      {
31          return Arrays.asList(new Object[][]{
32              {ConfigVariant.SERVICE,
33                  "org/mule/test/integration/resolvers/method-entrypoint-with-transformer-config-service.xml"},
34              {ConfigVariant.FLOW,
35                  "org/mule/test/integration/resolvers/method-entrypoint-with-transformer-config-flow.xml"}});
36      }
37  
38      public MethodEntryPointWithTransformerTestCase(ConfigVariant variant, String configResources)
39      {
40          super(variant, configResources);
41      }
42  
43      /**
44       * Tests that a MethodEntryPointResolver is able to receive the method property
45       * from a MessagePropertyTransformer, that means that the transformer is applied
46       * before resolving that property.
47       */
48      @Test
49      public void testReceivesMethodPropertyFromAPropertyTransformer() throws Exception
50      {
51          MuleClient client = new MuleClient(muleContext);
52          MuleMessage response = client.send("vm://in", "payload", null);
53          assertNotNull(response);
54          assertNotNull(response.getPayload());
55          assertEquals("Transformed payload", response.getPayloadAsString());
56      }
57  }