1   /*
2    * $Id: SoapActionTemplateTestCase.java 7976 2007-08-21 14:26:13Z dirk.olmes $
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.providers.soap.axis;
12  
13  import org.mule.impl.ImmutableMuleEndpoint;
14  import org.mule.tck.AbstractMuleTestCase;
15  import org.mule.umo.UMOEvent;
16  import org.mule.umo.endpoint.UMOImmutableEndpoint;
17  
18  import javax.xml.namespace.QName;
19  
20  /**
21   * @author <a href="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
22   * @version $Revision: 7976 $
23   */
24  public class SoapActionTemplateTestCase extends AbstractMuleTestCase
25  {
26      public void testHostInfoReplace() throws Exception
27      {
28          UMOImmutableEndpoint ep = new ImmutableMuleEndpoint(
29              "axis:http://mycompany.com:8080/services/myService?method=foo", false);
30          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
31          UMOEvent event = getTestEvent("test,", ep);
32          String result = dispatcher.parseSoapAction("${hostInfo}/${method}", new QName("foo"), event);
33  
34          assertEquals("http://mycompany.com:8080/foo", result);
35      }
36  
37      public void testHostReplace() throws Exception
38      {
39          UMOImmutableEndpoint ep = new ImmutableMuleEndpoint(
40              "axis:http://mycompany.com:8080/services/myService?method=foo", false);
41  
42          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
43          UMOEvent event = getTestEvent("test,", ep);
44          event.getComponent().getDescriptor().setName("myService");
45          String result = dispatcher.parseSoapAction("${scheme}://${host}:${port}/${serviceName}/${method}",
46              new QName("foo"), event);
47  
48          assertEquals("http://mycompany.com:8080/myService/foo", result);
49      }
50  }