View Javadoc

1   /*
2    * $Id: AxisServiceUsingCxfEndpointTestCase.java 20321 2010-11-24 15:21:24Z dfeist $
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.DefaultMuleMessage;
14  import org.mule.api.MuleMessage;
15  import org.mule.module.client.MuleClient;
16  import org.mule.tck.FunctionalTestCase;
17  
18  import java.util.HashMap;
19  import java.util.List;
20  import java.util.Map;
21  
22  import org.dom4j.Document;
23  import org.dom4j.DocumentHelper;
24  import org.dom4j.Element;
25  
26  public class AxisServiceUsingCxfEndpointTestCase extends FunctionalTestCase
27  {
28  
29      public void testAxis() throws Exception
30      {
31          MuleClient client = new MuleClient(muleContext);
32          MuleMessage reply = client.send("vm://axis.in", new DefaultMuleMessage("Test String", muleContext));
33  
34          assertNotNull(reply);
35          assertNotNull(reply.getPayload());
36          assertEquals(reply.getPayloadAsString(), "Received: Test String");
37          logger.info(reply.getPayloadAsString());
38      }
39  
40      public void testRequestWsdl() throws Exception
41      {
42          MuleClient client = new MuleClient(muleContext);
43          Map props = new HashMap();
44          props.put("http.method", "GET");
45          MuleMessage reply = client.send("http://localhost:63381/services/AxisService?WSDL", "", props);
46  
47          assertNotNull(reply);
48          assertNotNull(reply.getPayload());
49  
50          Document document = DocumentHelper.parseText(reply.getPayloadAsString());
51          List nodes;
52  
53          nodes = document.selectNodes("//wsdl:definitions/wsdl:service");
54          assertEquals(((Element)nodes.get(0)).attribute("name").getStringValue(), "AxisService");
55      }
56  
57      protected String getConfigResources()
58      {
59          return "axis-using-cxf-config.xml";
60      }
61  
62  }