1   /*
2    * $Id: GroovyScriptFunctionalTestCase.java 11746 2008-05-14 04:19:44Z 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;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  public class GroovyScriptFunctionalTestCase extends FunctionalTestCase
18  {
19      //@Override
20      protected String getConfigResources()
21      {
22          return "groovy-component-config.xml";
23      }
24  
25      public void testInlineScript() throws Exception
26      {
27          MuleClient client = new MuleClient();
28          client.send("vm://in1", "Important Message", null);
29          MuleMessage response = client.request("vm://out1", 1000);
30          assertNotNull(response);
31          assertEquals("Important Message Received", response.getPayloadAsString());
32      }
33      
34      public void testFileBasedScript() throws Exception
35      {
36          MuleClient client = new MuleClient();
37          client.send("vm://in2", "Important Message", null);
38          MuleMessage response = client.request("vm://out2", 1000);
39          assertNotNull(response);
40          assertEquals("Important Message Received", response.getPayloadAsString());
41      }
42      
43      public void testReferencedScript() throws Exception
44      {
45          MuleClient client = new MuleClient();
46          client.send("vm://in3", "Important Message", null);
47          MuleMessage response = client.request("vm://out3", 1000);
48          assertNotNull(response);
49          assertEquals("Important Message Received", response.getPayloadAsString());
50      }    
51  
52      public void testScriptVariables() throws Exception
53      {
54          MuleClient client = new MuleClient();
55          client.send("vm://in4", "Important Message", null);
56          MuleMessage response = client.request("vm://out4", 1000);
57          assertNotNull(response);
58          assertEquals("Important Message Received A-OK", response.getPayloadAsString());
59      }    
60  }
61  
62