1   /*
2    * $Id: AxisEndpointTestCase.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.config.MuleProperties;
14  import org.mule.impl.endpoint.MuleEndpointURI;
15  import org.mule.tck.AbstractMuleTestCase;
16  import org.mule.umo.endpoint.UMOEndpointURI;
17  
18  /**
19   * @author <a href="mailto:ross.mason@symphonysoft.com">Ross Mason</a>
20   * @version $Revision: 7976 $
21   */
22  public class AxisEndpointTestCase extends AbstractMuleTestCase
23  {
24      public void testEndpoint() throws Exception
25      {
26          String url = "axis:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2";
27          UMOEndpointURI endpointUri = new MuleEndpointURI(url);
28          assertEquals("axis", endpointUri.getSchemeMetaInfo());
29          // it's up to the client to actually strip off the method name if
30          // necessary
31          assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2",
32              endpointUri.getAddress());
33          assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY));
34          assertEquals(3, endpointUri.getParams().size());
35  
36          url = "axis:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2";
37          endpointUri = new MuleEndpointURI(url);
38          assertEquals("axis", endpointUri.getSchemeMetaInfo());
39          assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2",
40              endpointUri.getAddress());
41          assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY));
42          assertEquals(3, endpointUri.getParams().size());
43      }
44  
45      public void testEndpointWithUserInfo() throws Exception
46      {
47          String url = "axis:http://admin:pwd@www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2";
48          UMOEndpointURI endpointUri = new MuleEndpointURI(url);
49          assertEquals("axis", endpointUri.getSchemeMetaInfo());
50          // it's up to the client to actually strip off the method name if
51          // necessary
52          assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2",
53              endpointUri.getAddress());
54          assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY));
55          assertEquals(3, endpointUri.getParams().size());
56          assertEquals("admin:pwd", endpointUri.getUserInfo());
57          assertEquals("admin", endpointUri.getUsername());
58          assertEquals("pwd", endpointUri.getPassword());
59      }
60  
61      public void testEndpointFinder() throws Exception
62      {
63          String url = "soap:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2";
64          UMOEndpointURI endpointUri = new MuleEndpointURI(url);
65          assertEquals("soap", endpointUri.getSchemeMetaInfo());
66          // it's up to the client to actually strip off the method name if
67          // necessary
68          assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2",
69              endpointUri.getAddress());
70          assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY));
71          assertEquals(3, endpointUri.getParams().size());
72      }
73  }