View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.transport.soap.axis;
8   
9   import org.mule.api.MuleEvent;
10  import org.mule.api.MuleMessage;
11  import org.mule.api.endpoint.OutboundEndpoint;
12  import org.mule.tck.junit4.AbstractMuleContextTestCase;
13  
14  import java.util.List;
15  import java.util.Map;
16  
17  import org.apache.axis.client.Call;
18  import org.apache.axis.client.Service;
19  import org.junit.Test;
20  
21  import static org.junit.Assert.assertEquals;
22  import static org.junit.Assert.assertNotNull;
23  
24  public class AxisMessageDispatcherTestCase extends AbstractMuleContextTestCase
25  {
26  
27      @Test
28      public void testNullParametersInCallAllowed() throws Exception
29      {
30          OutboundEndpoint ep = muleContext.getEndpointFactory().getOutboundEndpoint(
31              "axis:http://www.muleumo.org/services/myService?method=myTestMethod");
32          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
33          dispatcher.service = new Service();
34          MuleEvent event = getTestEvent("testPayload", ep);
35          // there should be no NullPointerException
36          Call call = dispatcher.getCall(event, new Object[]{null});
37  
38          assertNotNull(call);
39  
40          MuleMessage msg = event.getMessage();
41          assertNotNull(msg);
42          final Map soapMethods = msg.getOutboundProperty(AxisConnector.SOAP_METHODS);
43          assertEquals(1, soapMethods.size());
44          final List values = (List)soapMethods.get("myTestMethod");
45          assertNotNull(values);
46          assertEquals(1, values.size());
47          assertEquals("value0;qname{:anyType:http://www.w3.org/2001/XMLSchema};in", values.get(0));
48      }
49  }