1
2
3
4
5
6
7 package org.mule.test;
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
20
21
22 public class NoArgsCallWrapperFunctionalTestCase extends FunctionalTestCase
23 {
24
25 private static final int RECEIVE_TIMEOUT = 5000;
26
27 @Override
28 protected String getConfigResources()
29 {
30 return "no-args-call-wrapper-config.xml";
31 }
32
33 @Test
34 public void testNoArgsCallWrapper() throws Exception
35 {
36 MuleClient client = new MuleClient(muleContext);
37 client.dispatch("vm://invoke", "test", null);
38 MuleMessage reply = client.request("vm://out", RECEIVE_TIMEOUT);
39 assertNotNull(reply);
40 assertNull(reply.getExceptionPayload());
41 assertEquals("Just an apple.", reply.getPayload());
42 }
43
44 @Test
45 public void testWithInjectedDelegate() throws Exception
46 {
47 MuleClient client = new MuleClient(muleContext);
48 client.dispatch("vm://invokeWithInjected", "test", null);
49 MuleMessage reply = client.request("vm://outWithInjected", RECEIVE_TIMEOUT);
50 assertNotNull(reply);
51 assertNull(reply.getExceptionPayload());
52
53 assertEquals("test", reply.getPayload());
54 }
55 }