1   /*
2    * $Id: SoapActionTemplateTestCase.java 10961 2008-02-22 19:01:02Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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  /**
20   * TODO document me
21   */
22  public class SoapActionTemplateTestCase extends AbstractMuleTestCase
23  {
24      public void testHostInfoReplace() throws Exception
25      {
26          OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(
27              "axis:http://mycompany.com:8080/services/myService?method=foo");
28          
29          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
30          MuleEvent event = getTestEvent("test,", ep);
31          String result = dispatcher.parseSoapAction("[hostInfo]/[method]", new QName("foo"), event);
32  
33          assertEquals("http://mycompany.com:8080/foo", result);
34      }
35  
36      public void testHostReplace() throws Exception
37      {
38          OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(
39              "axis:http://mycompany.com:8080/services/myService?method=foo");
40          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
41          MuleEvent event = getTestEvent("test,", ep);
42          event.getService().setName("myService");
43          String result = dispatcher.parseSoapAction("[scheme]://[host]:[port]/[serviceName]/[method]",
44              new QName("foo"), event);
45  
46          assertEquals("http://mycompany.com:8080/myService/foo", result);
47      }
48  }