View Javadoc

1   /*
2    * $Id: CxfSoapEndpointTestCase.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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.module.cxf;
12  
13  import org.mule.api.config.MuleProperties;
14  import org.mule.api.endpoint.EndpointURI;
15  import org.mule.endpoint.MuleEndpointURI;
16  import org.mule.tck.AbstractMuleTestCase;
17  
18  public class CxfSoapEndpointTestCase extends AbstractMuleTestCase
19  {
20      public void testEndpoint() throws Exception
21      {
22          String url = "cxf:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2";
23          EndpointURI endpointUri = new MuleEndpointURI(url, muleContext);
24          endpointUri.initialise();
25  
26          assertEquals("cxf", endpointUri.getSchemeMetaInfo());
27          // it's up to the client to actually strip off the method name if 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 = "cxf:http://www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2";
34          endpointUri = new MuleEndpointURI(url, muleContext);
35          endpointUri.initialise();
36  
37          assertEquals("cxf", endpointUri.getSchemeMetaInfo());
38          assertEquals("http://www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2",
39              endpointUri.getAddress());
40          assertEquals("getSomething", endpointUri.getParams().getProperty(MuleProperties.MULE_METHOD_PROPERTY));
41          assertEquals(3, endpointUri.getParams().size());
42      }
43  
44      public void testEndpointWithUserInfo() throws Exception
45      {
46          String url = "cxf:http://admin:pwd@www.xmethods.net/wsdl/query.wsdl?method=getSomething&param1=1&param2=2";
47          EndpointURI endpointUri = new MuleEndpointURI(url, muleContext);
48          endpointUri.initialise();
49  
50          assertEquals("cxf", endpointUri.getSchemeMetaInfo());
51          // it's up to the client to actually strip off the method name if 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.getUser());
58          assertEquals("pwd", endpointUri.getPassword());
59      }
60  
61  }