1
2
3
4
5
6
7 package org.mule.test.integration.endpoints;
8
9 import org.mule.DefaultMuleMessage;
10 import org.mule.api.MuleMessage;
11 import org.mule.api.transformer.DataType;
12 import org.mule.tck.junit4.FunctionalTestCase;
13
14 import org.junit.Test;
15
16 import static org.junit.Assert.assertEquals;
17 import static org.junit.Assert.assertNotNull;
18 import static org.junit.Assert.assertNull;
19
20 public class DynamicEndpointConfigTestCase extends FunctionalTestCase
21 {
22
23 @Override
24 protected String getConfigResources()
25 {
26 return "org/mule/test/integration/endpoints/dynamic-endpoint-config.xml";
27 }
28
29 @Test
30 public void testName() throws Exception
31 {
32
33 MuleMessage msg = new DefaultMuleMessage("Data", muleContext);
34 msg.setOutboundProperty("testProp", "testPath");
35 MuleMessage response = muleContext.getClient().send("vm://in1", msg);
36 assertNotNull(response);
37 assertNull(response.getExceptionPayload());
38 assertEquals("Data Received", response.getPayload(DataType.STRING_DATA_TYPE));
39
40 response = muleContext.getClient().send("vm://in2", msg);
41 assertNotNull(response);
42 assertNull(response.getExceptionPayload());
43 assertEquals("Data Received", response.getPayload(DataType.STRING_DATA_TYPE));
44
45 response = muleContext.getClient().send("vm://in3", msg);
46 assertNotNull(response);
47 assertNull(response.getExceptionPayload());
48 String payload = response.getPayload(DataType.STRING_DATA_TYPE);
49 assertEquals("Data Also Received", payload);
50 }
51 }