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