View Javadoc

1   /*
2    * $Id: JmsReplyToPropertyTestCase.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.transport.jms.integration;
12  
13  import org.mule.api.MuleMessage;
14  import org.mule.module.client.MuleClient;
15  
16  import java.util.HashMap;
17  import java.util.Map;
18  
19  import org.junit.Test;
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  }