1
2
3
4
5
6
7 package org.mule.module.scripting.filter;
8
9 import org.mule.api.MuleMessage;
10 import org.mule.module.client.MuleClient;
11 import org.mule.tck.junit4.FunctionalTestCase;
12
13 import org.junit.Test;
14
15 import static org.junit.Assert.assertEquals;
16 import static org.junit.Assert.assertNotNull;
17 import static org.junit.Assert.assertNull;
18
19 public class GroovyScriptFilterFunctionalTestCase extends FunctionalTestCase
20 {
21
22 public GroovyScriptFilterFunctionalTestCase()
23 {
24
25
26 setDisposeContextPerClass(true);
27 }
28
29 @Override
30 protected String getConfigResources()
31 {
32 return "groovy-filter-config.xml";
33 }
34
35 @Test
36 public void testFilterScript() throws Exception
37 {
38 MuleClient client = new MuleClient(muleContext);
39 client.dispatch("vm://in1", "hello", null);
40 MuleMessage response = client.request("vm://out1", RECEIVE_TIMEOUT);
41 assertNotNull(response);
42 assertEquals("hello", response.getPayload());
43
44 client.dispatch("vm://in1", "1", null);
45 response = client.request("vm://out1", RECEIVE_TIMEOUT);
46 assertNull(response);
47 }
48 }