1   /*
2    * $Id: SoapActionTemplateTestCase.java 7963 2007-08-21 08:53:15Z 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  public class SoapActionTemplateTestCase extends AbstractMuleTestCase
21  {
22  
23      public void testHostInfoReplace() throws Exception
24      {
25          UMOImmutableEndpoint ep = new ImmutableMuleEndpoint(
26              "axis:http://mycompany.com:8080/services/myService?method=foo", false);
27          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
28          UMOEvent event = getTestEvent("test,", ep);
29          String result = dispatcher.parseSoapAction("${hostInfo}/${method}", new QName("foo"), event);
30  
31          assertEquals("http://mycompany.com:8080/foo", result);
32      }
33  
34      public void testHostReplace() throws Exception
35      {
36          UMOImmutableEndpoint ep = new ImmutableMuleEndpoint(
37              "axis:http://mycompany.com:8080/services/myService?method=foo", false);
38  
39          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
40          UMOEvent event = getTestEvent("test,", ep);
41          event.getComponent().getDescriptor().setName("myService");
42          String result = dispatcher.parseSoapAction("${scheme}://${host}:${port}/${serviceName}/${method}",
43              new QName("foo"), event);
44  
45          assertEquals("http://mycompany.com:8080/myService/foo", result);
46      }
47  }