View Javadoc

1   /*
2    * $Id: SoapActionTemplateTestCase.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.transport.soap.axis;
12  
13  import org.mule.api.MuleEvent;
14  import org.mule.api.endpoint.OutboundEndpoint;
15  import org.mule.tck.AbstractMuleTestCase;
16  
17  import javax.xml.namespace.QName;
18  
19  public class SoapActionTemplateTestCase extends AbstractMuleTestCase
20  {
21      public void testHostInfoReplace() throws Exception
22      {
23          OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(
24              "axis:http://mycompany.com:8080/services/myService?method=foo");
25          
26          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
27          MuleEvent event = getTestEvent("test,", ep);
28          String result = dispatcher.parseSoapAction("#[hostInfo]/#[method]", new QName("foo"), event);
29  
30          assertEquals("http://mycompany.com:8080/foo", result);
31      }
32  
33      public void testHostReplace() throws Exception
34      {
35          OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(
36              "axis:http://mycompany.com:8080/services/myService?method=foo");
37          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
38          MuleEvent event = getTestEvent("test,", ep);
39          String name = event.getFlowConstruct().getName();
40          String result = dispatcher.parseSoapAction("#[scheme]://#[host]:#[port]/#[serviceName]/#[method]",
41              new QName("foo"), event);
42  
43          assertEquals("http://mycompany.com:8080/" + name + "/foo", result);
44      }
45  }