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.test.integration.message;
8   
9   import org.mule.DefaultMuleMessage;
10  import org.mule.api.MuleMessage;
11  import org.mule.api.client.LocalMuleClient;
12  
13  import org.junit.Test;
14  
15  import static org.junit.Assert.assertEquals;
16  import static org.junit.Assert.assertNotNull;
17  
18  public class JmsPropertyScopeTestCase extends AbstractPropertyScopeTestCase
19  {
20  
21      @Override
22      protected String getConfigResources()
23      {
24          return "org/mule/test/message/jms-property-scope.xml";
25      }
26  
27      @Test
28      public void testRequestResponse() throws Exception
29      {
30          LocalMuleClient client = muleContext.getClient();
31          MuleMessage message = new DefaultMuleMessage("test", muleContext);
32          message.setOutboundProperty("foo", "fooValue");
33          message.setReplyTo("jms://reply");
34  
35          client.dispatch("inbound", message);
36          MuleMessage result = client.request("jms://reply", 10000);
37  
38          assertNotNull(result);
39          assertEquals("test bar", result.getPayload());
40          assertEquals("fooValue", result.<Object>getInboundProperty("foo"));
41      }
42  }