View Javadoc

1   /*
2    * $Id: AxisMessageDispatcherTestCase.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.transport.soap.axis;
12  
13  import org.mule.api.MuleEvent;
14  import org.mule.api.MuleMessage;
15  import org.mule.api.endpoint.OutboundEndpoint;
16  import org.mule.tck.AbstractMuleTestCase;
17  
18  import java.util.List;
19  import java.util.Map;
20  
21  import org.apache.axis.client.Call;
22  import org.apache.axis.client.Service;
23  
24  public class AxisMessageDispatcherTestCase extends AbstractMuleTestCase
25  {
26      public void testNullParametersInCallAllowed() throws Exception
27      {
28          OutboundEndpoint ep = muleContext.getRegistry().lookupEndpointFactory().getOutboundEndpoint(
29              "axis:http://www.muleumo.org/services/myService?method=myTestMethod");
30          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
31          dispatcher.service = new Service();
32          MuleEvent event = getTestEvent("testPayload", ep);
33          // there should be no NullPointerException
34          Call call = dispatcher.getCall(event, new Object[]{null});
35  
36          assertNotNull(call);
37  
38          MuleMessage msg = event.getMessage();
39          assertNotNull(msg);
40          final Map soapMethods = msg.getOutboundProperty(AxisConnector.SOAP_METHODS);
41          assertEquals(1, soapMethods.size());
42          final List values = (List)soapMethods.get("myTestMethod");
43          assertNotNull(values);
44          assertEquals(1, values.size());
45          assertEquals("value0;qname{:anyType:http://www.w3.org/2001/XMLSchema};in", values.get(0));
46      }
47  }