1
2
3
4
5
6
7
8
9
10
11 package org.mule.test;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.module.client.MuleClient;
15 import org.mule.tck.AbstractServiceAndFlowTestCase;
16
17 import java.util.Arrays;
18 import java.util.Collection;
19
20 import org.junit.Test;
21 import org.junit.runners.Parameterized.Parameters;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25 import static org.junit.Assert.assertNull;
26
27
28
29
30 public class NoArgsCallWrapperFunctionalTestCase extends AbstractServiceAndFlowTestCase
31 {
32 private static final int RECEIVE_TIMEOUT = 5000;
33
34 @Parameters
35 public static Collection<Object[]> parameters()
36 {
37 return Arrays.asList(new Object[][]{
38 {ConfigVariant.SERVICE, "no-args-call-wrapper-config-service.xml"},
39 {ConfigVariant.FLOW, "no-args-call-wrapper-config-flow.xml"}});
40 }
41
42 public NoArgsCallWrapperFunctionalTestCase(ConfigVariant variant, String configResources)
43 {
44 super(variant, configResources);
45 }
46
47 @Test
48 public void testNoArgsCallWrapper() throws Exception
49 {
50 MuleClient client = new MuleClient(muleContext);
51 client.dispatch("vm://invoke", "test", null);
52 MuleMessage reply = client.request("vm://out", RECEIVE_TIMEOUT);
53 assertNotNull(reply);
54 assertNull(reply.getExceptionPayload());
55 assertEquals("Just an apple.", reply.getPayload());
56 }
57
58 @Test
59 public void testWithInjectedDelegate() throws Exception
60 {
61 MuleClient client = new MuleClient(muleContext);
62 client.dispatch("vm://invokeWithInjected", "test", null);
63 MuleMessage reply = client.request("vm://outWithInjected", RECEIVE_TIMEOUT);
64 assertNotNull(reply);
65 assertNull(reply.getExceptionPayload());
66
67 assertEquals("test", reply.getPayload());
68 }
69 }