View Javadoc

1   /*
2    * $Id: GroovyMessageBuilderTestCase.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.components.script;
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  public class GroovyMessageBuilderTestCase extends AbstractServiceAndFlowTestCase
27  {    
28      public GroovyMessageBuilderTestCase(ConfigVariant variant, String configResources)
29      {
30          super(variant, configResources);
31      }
32  
33      @Parameters
34      public static Collection<Object[]> parameters()
35      {
36          return Arrays.asList(new Object[][]{
37              {ConfigVariant.SERVICE, "groovy-messagebuilder-config-service.xml"},
38              {ConfigVariant.FLOW, "groovy-messagebuilder-config-flow.xml"}
39          });
40      }      
41      
42      @Test
43      public void testFunctionBehaviour() throws Exception
44      {
45          MuleClient client = new MuleClient(muleContext);
46          MuleMessage m = client.send("groovy1.endpoint", "Test:", null);
47          assertNotNull(m);
48          assertEquals("Test: A B Received", m.getPayloadAsString());
49      }
50  
51  }