View Javadoc

1   /*
2    * $Id: WebServiceWrapperWithAxisTestCase.java 19841 2010-10-05 23:17:20Z dzapata $
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.functional;
12  
13  
14  import org.mule.DefaultMuleMessage;
15  import org.mule.api.MuleMessage;
16  import org.mule.module.client.MuleClient;
17  import org.mule.tck.DynamicPortTestCase;
18  
19  import java.util.Properties;
20  
21  public class WebServiceWrapperWithAxisTestCase extends DynamicPortTestCase
22  {
23      private String testString = "test";
24      
25      public void testWsCall() throws Exception
26      {
27          MuleClient client = new MuleClient(muleContext);
28          MuleMessage result = client.send("vm://testin", new DefaultMuleMessage(testString, muleContext));
29          assertNotNull(result.getPayload());
30          assertEquals("Payload", "Received: "+ testString, result.getPayloadAsString());
31      }
32      
33      public void testWsCallWithUrlFromMessage() throws Exception
34      {
35          MuleClient client = new MuleClient(muleContext);
36          Properties props = new Properties();
37          props.setProperty("ws.service.url", "http://localhost:" + getPorts().get(0) + "/services/TestUMO?method=receive");
38          MuleMessage result = client.send("vm://testin2", testString, props);
39          assertNotNull(result.getPayload());
40          assertEquals("Payload", "Received: "+ testString, result.getPayloadAsString());
41      }
42      
43      public void testWsCallWithComplexParameters() throws Exception
44      {
45          MuleClient client = new MuleClient(muleContext);
46          client.dispatch("vm://queue.in", new Object[]{new Long(3), new Long(3)},null);
47          MuleMessage result = client.request("vm://queue.out", RECEIVE_TIMEOUT);
48          assertNotNull(result.getPayload());
49          assertTrue(result.getPayload() instanceof Long);
50          assertEquals("Payload", 6, ((Long)result.getPayload()).intValue());
51      }
52      
53      protected String getConfigResources()
54      {
55          return "mule-ws-wrapper-config.xml";
56      }
57  
58      @Override
59      protected int getNumPortsToFind()
60      {
61          return 1;
62      }
63  }