View Javadoc

1   /*
2    * $Id: GroovyBindingFunctionalTestCase.java 22518 2011-07-22 07:00:22Z claude.mamo $
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 static org.junit.Assert.assertEquals;
14  import static org.junit.Assert.assertNotNull;
15  
16  import org.mule.api.MuleMessage;
17  import org.mule.module.client.MuleClient;
18  import org.mule.tck.AbstractServiceAndFlowTestCase;
19  
20  import java.util.Arrays;
21  import java.util.Collection;
22  
23  import org.junit.Test;
24  import org.junit.runners.Parameterized.Parameters;
25  
26  
27  public class GroovyBindingFunctionalTestCase extends AbstractServiceAndFlowTestCase
28  {
29      public GroovyBindingFunctionalTestCase(ConfigVariant variant, String configResources)
30      {
31          super(variant, configResources);
32      }
33  
34      @Parameters
35      public static Collection<Object[]> parameters()
36      {
37          return Arrays.asList(new Object[][]{
38              {ConfigVariant.SERVICE, "groovy-binding-config-service.xml"},
39              {ConfigVariant.FLOW, "groovy-binding-config-flow.xml"}
40          });
41      }      
42      
43      @Test
44      public void testBindingCallout() throws Exception
45      {
46          MuleClient client = new MuleClient(muleContext);
47          client.dispatch("client_request", "Important Message", null);
48          MuleMessage response = client.request("client_response", 2000);
49          assertNotNull(response);
50          assertEquals("Important Message Received by Callout1 Received by Callout2", response.getPayloadAsString());
51      }
52  
53  }