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