View Javadoc

1   /*
2    * $Id: JmsPropertyScopeTestCase.java 22551 2011-07-25 06:32:00Z mike.schilling $
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.test.integration.message;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.api.client.LocalMuleClient;
16  
17  import java.util.Arrays;
18  import java.util.Collection;
19  
20  import org.junit.Test;
21  import org.junit.runners.Parameterized.Parameters;
22  
23  import static org.junit.Assert.assertEquals;
24  import static org.junit.Assert.assertNotNull;
25  
26  public class JmsPropertyScopeTestCase extends AbstractPropertyScopeTestCase
27  {
28      @Parameters
29      public static Collection<Object[]> parameters()
30      {
31          return Arrays.asList(new Object[][]{
32              { ConfigVariant.SERVICE, "org/mule/test/message/jms-property-scope.xml" } ,
33              { ConfigVariant.FLOW, "org/mule/test/message/jms-property-scope-flow.xml" }
34          });
35      }
36  
37      public JmsPropertyScopeTestCase(ConfigVariant variant, String configResources)
38      {
39          super(variant, configResources);
40      }
41  
42      @Override
43      @Test
44      public void testRequestResponse() throws Exception
45      {
46          LocalMuleClient client = muleContext.getClient();
47          MuleMessage message = new DefaultMuleMessage("test", muleContext);
48          message.setOutboundProperty("foo", "fooValue");
49          message.setReplyTo("jms://reply");
50  
51          client.dispatch("inbound", message);
52          MuleMessage result = client.request("jms://reply", 10000);
53  
54          assertNotNull(result);
55          assertEquals("test bar", result.getPayload());
56          assertEquals("fooValue", result.<Object> getInboundProperty("foo"));
57      }
58  }