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.messaging.meps;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.module.client.MuleClient;
11  import org.mule.tck.junit4.FunctionalTestCase;
12  import org.mule.transport.NullPayload;
13  
14  import java.util.HashMap;
15  import java.util.Map;
16  
17  import org.junit.Test;
18  
19  import static org.junit.Assert.assertEquals;
20  import static org.junit.Assert.assertNotNull;
21  
22  public class InOptionalOutOutOnlyTestCase extends FunctionalTestCase
23  {
24  
25      public static final long TIMEOUT = 3000;
26  
27      @Override
28      protected String getConfigResources()
29      {
30          return "org/mule/test/integration/messaging/meps/pattern_In-Optional-Out_Out-Only.xml";
31      }
32  
33      @Test
34      public void testExchange() throws Exception
35      {
36          MuleClient client = new MuleClient(muleContext);
37  
38          MuleMessage result = client.send("inboundEndpoint", "some data", null);
39          assertNotNull(result);
40          assertEquals(NullPayload.getInstance(), result.getPayload());
41  
42          Map props = new HashMap();
43          props.put("foo", "bar");
44          result = client.send("inboundEndpoint", "some data", props);
45          assertNotNull(result);
46          assertEquals("foo header received", result.getPayload());
47      }
48  }