View Javadoc

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