View Javadoc

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