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.transport.jms.integration;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.module.client.MuleClient;
11  
12  import java.util.HashMap;
13  import java.util.Map;
14  
15  import org.junit.Test;
16  
17  import static org.junit.Assert.assertEquals;
18  import static org.junit.Assert.assertNotNull;
19  import static org.junit.Assert.assertTrue;
20  
21  public class JmsReplyToPropertyTestCase extends AbstractJmsFunctionalTestCase
22  {
23  
24      @Override
25      protected String getConfigResources()
26      {
27          return "integration/jms-replyto-property.xml";
28      }
29  
30      @Test
31      public void testReplyTo() throws Exception
32      {
33          MuleClient client = new MuleClient(muleContext);
34          Map<String, String> props = new HashMap<String, String>();
35          props.put("JMSReplyTo", "middle");
36          client.dispatch("in", DEFAULT_INPUT_MESSAGE, props);
37  
38          // Check that the property is still on the outbound message
39          MuleMessage output = client.request("out", 2000);
40          assertNotNull(output);
41          final Object o = output.getOutboundProperty("JMSReplyTo");
42          assertTrue(o.toString().contains("middle"));
43          
44          // Check that the reply message was generated
45          output = client.request("middle", 2000);
46          assertNotNull(output);
47          assertEquals(DEFAULT_OUTPUT_MESSAGE, output.getPayload());
48      }
49  }