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.usecases.sync;
8   
9   import org.mule.api.MuleMessage;
10  import org.mule.module.client.MuleClient;
11  import org.mule.tck.junit4.FunctionalTestCase;
12  
13  import java.util.HashMap;
14  import java.util.Map;
15  
16  import org.junit.Test;
17  
18  import static org.junit.Assert.assertEquals;
19  import static org.junit.Assert.assertNotNull;
20  
21  public class HttpJmsBridgeTestCase extends FunctionalTestCase
22  {
23  
24      @Override
25      protected String getConfigResources()
26      {
27          return "org/mule/test/usecases/sync/http-jms-bridge.xml";
28      }
29  
30      @Test
31      public void testBridge() throws Exception
32      {
33          MuleClient client = new MuleClient(muleContext);
34          String payload = "payload";
35  
36          Map<String, Object> headers = new HashMap<String, Object>();
37          final String customHeader = "X-Custom-Header";
38          headers.put(customHeader, "value");
39  
40          client.sendNoReceive("http://localhost:4444/in", payload, headers);
41  
42          MuleMessage msg = client.request("vm://out", 10000);
43          assertNotNull(msg);
44          assertEquals(payload, msg.getPayloadAsString());
45          assertEquals("value", msg.getInboundProperty(customHeader));
46      }
47  }