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  import org.mule.tck.junit4.FunctionalTestCase;
13  import org.mule.tck.junit4.rule.DynamicPort;
14  
15  import org.junit.Rule;
16  import org.junit.Test;
17  
18  import static org.junit.Assert.assertEquals;
19  
20  public abstract class AbstractPropertyScopeTestCase extends FunctionalTestCase
21  {
22  
23      @Rule
24      public DynamicPort dynamicPort = new DynamicPort("port1");
25  
26      @Test
27      public void testRequestResponse() throws Exception
28      {
29          LocalMuleClient client = muleContext.getClient();
30          MuleMessage message = new DefaultMuleMessage("test", muleContext);
31          message.setOutboundProperty("foo", "fooValue");
32  
33          MuleMessage result = client.send("inbound", message);
34          assertEquals("test bar", result.getPayloadAsString());
35          assertEquals("fooValue", result.<Object> getInboundProperty("foo"));
36      }
37  
38  }