1   /*
2    * $Id: XFireServiceUsingAxisEndpointTestCase.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.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.providers.soap.xfire;
12  
13  import org.mule.extras.client.MuleClient;
14  import org.mule.impl.MuleMessage;
15  import org.mule.tck.FunctionalTestCase;
16  import org.mule.umo.UMOMessage;
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 XFireServiceUsingAxisEndpointTestCase extends FunctionalTestCase
27  {
28  
29      public void testXFire() throws Exception
30      {
31          MuleClient client = new MuleClient();
32          UMOMessage reply = client.send("vm://xfire.in", new MuleMessage("Testing String"));
33  
34          assertNotNull(reply);
35          assertNotNull(reply.getPayload());
36          assertEquals(reply.getPayloadAsString(), "Received: Testing String");
37      }
38  
39      public void testRequestWsdl() throws Exception
40      {
41          MuleClient client = new MuleClient();
42          Map props = new HashMap();
43          props.put("http.method", "GET");
44          UMOMessage reply = client.send("http://localhost:33382/services/XfireService?wsdl",
45              "/services/Hello_Xfire?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(), "XfireService");
55      }
56  
57      protected String getConfigResources()
58      {
59          return "xfire-using-axis-conf.xml";
60      }
61  
62  }