View Javadoc

1   /*
2    * $Id: JmsReplyToPropertyTestCase.java 22431 2011-07-18 07:40:35Z dirk.olmes $
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  import static org.junit.Assert.assertEquals;
22  import static org.junit.Assert.assertNotNull;
23  import static org.junit.Assert.assertTrue;
24  
25  public class JmsReplyToPropertyTestCase extends AbstractJmsFunctionalTestCase
26  {
27  
28      @Override
29      protected String getConfigResources()
30      {
31          return "integration/jms-replyto-property.xml";
32      }
33  
34      @Test
35      public void testReplyTo() throws Exception
36      {
37          MuleClient client = new MuleClient(muleContext);
38          Map<String, String> props = new HashMap<String, String>();
39          props.put("JMSReplyTo", "middle");
40          client.dispatch("in", DEFAULT_INPUT_MESSAGE, props);
41  
42          // Check that the property is still on the outbound message
43          MuleMessage output = client.request("out", 2000);
44          assertNotNull(output);
45          final Object o = output.getOutboundProperty("JMSReplyTo");
46          assertTrue(o.toString().contains("middle"));
47          
48          // Check that the reply message was generated
49          output = client.request("middle", 2000);
50          assertNotNull(output);
51          assertEquals(DEFAULT_OUTPUT_MESSAGE, output.getPayload());
52      }
53  }