1
2
3
4
5
6
7
8
9
10 package org.mule.test.integration.components;
11
12 import org.mule.api.MuleMessage;
13 import org.mule.module.client.MuleClient;
14 import org.mule.tck.FunctionalTestCase;
15
16
17
18
19
20 public class NoArgsCallComponentTestCase extends FunctionalTestCase
21 {
22
23 public static final String INPUT_DC_QUEUE_NAME = "vm://in";
24 public static final String OUTPUT_DC_QUEUE_NAME = "vm://out";
25 public static final String INPUT_DI_QUEUE_NAME = "vm://invokeWithInjected";
26 public static final String OUTPUT_DI_QUEUE_NAME = "vm://outWithInjected";
27
28 public static final String DEFAULT_INPUT_MESSAGE = "test";
29 public static final String DEFUALT_OUTPUT_MESSAGE = "Just an apple.";
30
31 public static final String SERVICE_DC_NAME="WORMS";
32 public static final String SERVICE_DI_NAME="TIRANA";
33
34 public static final String DELEGATE_DC_METHOD_NAME="toString";
35 public static final String DELEGATE_DI_METHOD_NAME="wash";
36
37 public static final int TIMEOUT = 5000;
38
39 protected String getConfigResources()
40 {
41 return "org/mule/test/integration/components/no-args-call-component-functional-test.xml";
42 }
43
44 public void testDelegateClass() throws Exception
45 {
46 MuleClient client = new MuleClient();
47 client.dispatch(INPUT_DC_QUEUE_NAME, "test", null);
48 MuleMessage message = client.request(OUTPUT_DC_QUEUE_NAME, TIMEOUT);
49 assertNotNull(message);
50 assertEquals(message.getPayload(), DEFUALT_OUTPUT_MESSAGE);
51 client.dispose();
52
53 }
54
55 public void testWithInjectedDelegate() throws Exception
56 {
57 MuleClient client = new MuleClient();
58 client.dispatch(INPUT_DI_QUEUE_NAME, DEFAULT_INPUT_MESSAGE, null);
59 MuleMessage reply = client.request(OUTPUT_DI_QUEUE_NAME, TIMEOUT);
60 assertNotNull(reply);
61 assertNull(reply.getExceptionPayload());
62
63 assertEquals(DEFAULT_INPUT_MESSAGE, reply.getPayload());
64 }
65
66
67
68 }