View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.issues;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.api.config.MuleProperties;
11  import org.mule.module.client.MuleClient;
12  import org.mule.tck.junit4.FunctionalTestCase;
13  
14  import java.util.HashMap;
15  import java.util.Map;
16  
17  import org.junit.Test;
18  
19  import static org.junit.Assert.assertEquals;
20  import static org.junit.Assert.assertNotNull;
21  
22  public class PropertyScribblingMule893TestCase extends FunctionalTestCase
23  {
24  
25      @Override
26      protected String getConfigResources()
27      {
28          return "issues/property-scribbling-mule-893-test.xml";
29      }
30  
31      @Test
32      public void testSingleMessage() throws Exception
33      {
34          MuleClient client = new MuleClient(muleContext);
35          Map<String, Object> properties = new HashMap<String, Object>();
36          properties.put(MuleProperties.MULE_REPLY_TO_PROPERTY, "receive");
37          
38          client.dispatch("dispatch", "Message", properties);
39          MuleMessage response = client.request("receive", 3000L);
40          assertNotNull("Response is null", response);
41          assertEquals("Message Received", response.getPayload());
42      }
43  
44      @Test
45      public void testManyMessages() throws Exception
46      {
47          for (int i = 0; i < 1000; i++)
48          {
49              testSingleMessage();
50          }
51      }
52  
53  }