View Javadoc

1   /*
2    * $Id: AxisMessageDispatcherTestCase.java 22387 2011-07-12 03:53:36Z dirk.olmes $
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.junit4.AbstractMuleContextTestCase;
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  import org.junit.Test;
24  
25  import static org.junit.Assert.assertEquals;
26  import static org.junit.Assert.assertNotNull;
27  
28  public class AxisMessageDispatcherTestCase extends AbstractMuleContextTestCase
29  {
30  
31      @Test
32      public void testNullParametersInCallAllowed() throws Exception
33      {
34          OutboundEndpoint ep = muleContext.getEndpointFactory().getOutboundEndpoint(
35              "axis:http://www.muleumo.org/services/myService?method=myTestMethod");
36          AxisMessageDispatcher dispatcher = new AxisMessageDispatcher(ep);
37          dispatcher.service = new Service();
38          MuleEvent event = getTestEvent("testPayload");
39          // there should be no NullPointerException
40          Call call = dispatcher.getCall(event, new Object[]{null});
41  
42          assertNotNull(call);
43  
44          MuleMessage msg = event.getMessage();
45          assertNotNull(msg);
46          final Map soapMethods = msg.getOutboundProperty(AxisConnector.SOAP_METHODS);
47          assertEquals(1, soapMethods.size());
48          final List values = (List)soapMethods.get("myTestMethod");
49          assertNotNull(values);
50          assertEquals(1, values.size());
51          assertEquals("value0;qname{:anyType:http://www.w3.org/2001/XMLSchema};in", values.get(0));
52      }
53  }