1   /*
2    * $Id: AxisMessageDispatcherTestCase.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.impl.ImmutableMuleEndpoint;
14  import org.mule.tck.AbstractMuleTestCase;
15  import org.mule.umo.UMOEvent;
16  import org.mule.umo.UMOMessage;
17  import org.mule.umo.endpoint.UMOImmutableEndpoint;
18  
19  import java.util.List;
20  import java.util.Map;
21  
22  import org.apache.axis.client.Call;
23  import org.apache.axis.client.Service;
24  
25  /**
26   * @author <a href="mailto:aperepel@gmail.com">Andrew Perepelytsya</a>
27   */
28  public class AxisMessageDispatcherTestCase extends AbstractMuleTestCase
29  {
30  
31      public void testNullParametersInCallAllowed() throws Exception
32      {
33          UMOImmutableEndpoint ep = new ImmutableMuleEndpoint(
34              "axis:http://www.muleumo.org/services/myService?method=myTestMethod", false);
35          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
36          dispatcher.service = new Service();
37          UMOEvent event = getTestEvent("testPayload", ep);
38          // there should be no NullPointerException
39          Call call = dispatcher.getCall(event, new Object[]{null});
40  
41          assertNotNull(call);
42  
43          UMOMessage msg = event.getMessage();
44          assertNotNull(msg);
45          final Map soapMethods = (Map)msg.getProperty("soapMethods");
46          assertEquals(1, soapMethods.size());
47          final List values = (List)soapMethods.get("myTestMethod");
48          assertNotNull(values);
49          assertEquals(1, values.size());
50          assertEquals("value0;qname{:anyType:http://www.w3.org/2001/XMLSchema};in", values.get(0));
51      }
52  
53  }