1   /*
2    * $Id: GroovyScriptTransformerFunctionalTestCase.java 11778 2008-05-15 19:22:58Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.module.scripting.transformer;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class GroovyScriptTransformerFunctionalTestCase extends FunctionalTestCase
18  {
19      //@Override
20      protected String getConfigResources()
21      {
22          return "groovy-transformer-config.xml";
23      }
24  
25      public void testInlineScript() throws Exception
26      {
27          MuleClient client = new MuleClient();
28          client.send("vm://in1", "hello", null);
29          MuleMessage response = client.request("vm://out1", 1000);
30          assertNotNull(response);
31          assertEquals("hexxo", response.getPayload());
32      }
33  
34      public void testFileBasedScript() throws Exception
35      {
36          MuleClient client = new MuleClient();
37          client.send("vm://in2", "hello", null);
38          MuleMessage response = client.request("vm://out2", 1000);
39          assertNotNull(response);
40          assertEquals("hexxo", response.getPayload());
41      }
42  
43      public void testReferencedTransformer() throws Exception
44      {
45          MuleClient client = new MuleClient();
46          client.send("vm://in3", "hello", null);
47          MuleMessage response = client.request("vm://out3", 1000);
48          assertNotNull(response);
49          assertEquals("hexxo", response.getPayload());
50      }
51  
52      public void testReferencedTransformerWithParameters() throws Exception
53      {
54          MuleClient client = new MuleClient();
55          client.send("vm://in4", "hello", null);
56          MuleMessage response = client.request("vm://out4", 1000);
57          assertNotNull(response);
58          assertEquals("hexxo", response.getPayload());
59      }
60  }