View Javadoc

1   /*
2    * $Id: GroovyRegistryLookupTestCase.java 21599 2011-03-22 02:06:16Z 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.module.scripting;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  import org.mule.tck.FunctionalTestCase;
16  
17  
18  public class GroovyRegistryLookupTestCase extends FunctionalTestCase
19  {
20      @Override
21      protected String getConfigResources()
22      {
23          return "groovy-registry-lookup-config.xml";
24      }
25  
26      @Override
27      protected void doSetUp() throws Exception
28      {
29          super.doSetUp();
30          
31          muleContext.getRegistry().registerObject("hello", new Hello());
32      }
33  
34      public void testBindingCallout() throws Exception
35      {
36          MuleClient client = new MuleClient(muleContext);
37          MuleMessage response = client.send("vm://test", "", null);
38          assertNotNull(response);
39          assertEquals("hello", response.getPayloadAsString());
40      }
41  
42      public static class Hello
43      {
44          public String sayHello() 
45          {
46              return "hello";
47          }
48      }
49  
50  }