View Javadoc

1   /*
2    * $Id: CxfOverJMSTestCase.java 19191 2010-08-25 21:05:23Z tcarlson $
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.transport.cxf;
12  
13  import org.mule.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.api.transport.PropertyScope;
16  import org.mule.module.client.MuleClient;
17  import org.mule.tck.FunctionalTestCase;
18  
19  public class CxfOverJMSTestCase extends FunctionalTestCase
20  {
21      private static final String req = "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
22                                        + "<soap:Body>"
23                                        + "<ns2:echo xmlns:ns2=\"http://simple.component.mule.org/\">"
24                                        + "<ns2:echo>hello</ns2:echo>"
25                                        + "</ns2:echo>"
26                                        + "</soap:Body>"
27                                        + "</soap:Envelope>";
28  
29      @Override
30      protected String getConfigResources()
31      {
32          return "org/mule/test/integration/transport/cxf/cxf-over-jms-config.xml";
33      }
34  
35      public void testCxf() throws Exception
36      {
37          MuleClient client = new MuleClient(muleContext);
38          client.dispatch("jms://TestComponent", new DefaultMuleMessage(req, muleContext));
39          MuleMessage message = client.request("jms://testout", 10000);
40          assertNotNull(message.getPayload());
41          assertTrue(message.getPayloadAsString().indexOf("return>hello") != -1);
42      }
43  
44      public void testCxfClientOverJMS() throws Exception
45      {
46          MuleClient client = new MuleClient(muleContext);
47          DefaultMuleMessage msg = new DefaultMuleMessage("hello", muleContext);
48          msg.setProperty("method", "echo", PropertyScope.INVOCATION);
49          client.dispatch("cxf:jms://TestComponent2", msg);
50          MuleMessage message = client.request("jms://testout", 10000);
51          assertNotNull(message.getPayload());
52          assertTrue(message.getPayloadAsString().equals("hello"));
53      }
54  
55      // MULE-4677
56      public void XXtestCxfOverJMSSyncProxy() throws Exception
57      {
58          MuleClient client = new MuleClient(muleContext);
59          MuleMessage result = client.send("http://localhost:63081/services/testBridge",
60              new DefaultMuleMessage(req, muleContext));
61          assertNotNull(result.getPayload());
62          assertTrue(result.getPayloadAsString().contains("<ns2:echo>hello</ns2:echo>"));
63      }
64  }