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.test.integration.transformer.response;
8   
9   import static org.junit.Assert.assertEquals;
10  import static org.junit.Assert.assertFalse;
11  import org.mule.api.MuleMessage;
12  import org.mule.api.MuleMessageCollection;
13  import org.mule.api.client.LocalMuleClient;
14  import org.mule.tck.AbstractServiceAndFlowTestCase;
15  
16  import java.util.Arrays;
17  import java.util.Collection;
18  
19  import org.junit.Test;
20  import org.junit.runners.Parameterized;
21  
22  public class ResponseTransformerOnMessageCollectionTestCase extends AbstractServiceAndFlowTestCase
23  {
24  
25      public ResponseTransformerOnMessageCollectionTestCase(ConfigVariant variant, String configResources)
26      {
27          super(variant, configResources);
28      }
29  
30      @Parameterized.Parameters
31      public static Collection<Object[]> parameters()
32      {
33          return Arrays.asList(new Object[][] {
34                  {ConfigVariant.SERVICE, "org/mule/test/integration/transformer/response/response-transformer-on-message-collection-service-config.xml"},
35                  {ConfigVariant.FLOW, "org/mule/test/integration/transformer/response/response-transformer-on-message-collection-flow-config.xml"}
36          });
37      }
38  
39      @Test
40      public void transformedDataIsNotLost() throws Exception
41      {
42          LocalMuleClient client = muleContext.getClient();
43          MuleMessage response = client.send("vm://testInput", TEST_MESSAGE, null);
44  
45          assertEquals("foo", response.getPayload());
46          assertFalse(response instanceof MuleMessageCollection);
47      }
48  }