1
2
3
4
5
6
7
8
9
10
11 package org.mule.issues;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.api.config.MuleProperties;
15 import org.mule.module.client.MuleClient;
16 import org.mule.tck.junit4.FunctionalTestCase;
17
18 import java.util.HashMap;
19 import java.util.Map;
20
21 import org.junit.Test;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNotNull;
25
26 public class PropertyScribblingMule893TestCase extends FunctionalTestCase
27 {
28
29 @Override
30 protected String getConfigResources()
31 {
32 return "issues/property-scribbling-mule-893-test.xml";
33 }
34
35 @Test
36 public void testSingleMessage() throws Exception
37 {
38 MuleClient client = new MuleClient(muleContext);
39 Map<String, Object> properties = new HashMap<String, Object>();
40 properties.put(MuleProperties.MULE_REPLY_TO_PROPERTY, "receive");
41
42 client.dispatch("dispatch", "Message", properties);
43 MuleMessage response = client.request("receive", 3000L);
44 assertNotNull("Response is null", response);
45 assertEquals("Message Received", response.getPayload());
46 }
47
48 @Test
49 public void testManyMessages() throws Exception
50 {
51 for (int i = 0; i < 1000; i++)
52 {
53 testSingleMessage();
54 }
55 }
56
57 }