1
2
3
4
5
6
7
8
9
10
11 package org.mule.providers.soap.xfire;
12
13 import org.mule.extras.client.MuleClient;
14 import org.mule.tck.providers.soap.AbstractSoapUrlEndpointFunctionalTestCase;
15 import org.mule.umo.UMOMessage;
16
17 import java.util.HashMap;
18 import java.util.Iterator;
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 XFireConnectorHttpFunctionalTestCase extends AbstractSoapUrlEndpointFunctionalTestCase
27 {
28
29 protected String getTransportProtocol()
30 {
31 return "http";
32 }
33
34 protected String getSoapProvider()
35 {
36 return "xfire";
37 }
38
39 public void testBinding() throws Exception
40 {
41 String url = "http://localhost:62108/";
42 String folder = "mule/";
43 String componentName = "mycomponent";
44 String fullPath = url + folder + componentName;
45
46 MuleClient client = new MuleClient();
47 Map props = new HashMap();
48 props.put("http.method", "GET");
49 UMOMessage reply = client.send(fullPath+"?wsdl", folder+componentName+"?wsdl", props);
50
51 assertNotNull(reply);
52 assertNotNull(reply.getPayload());
53
54 Document document = DocumentHelper.parseText(reply.getPayloadAsString());
55 List nodes;
56
57
58 nodes = document.selectNodes("//wsdl:definitions/wsdl:service");
59
60 Element element = (Element)nodes.get(0);
61 assertEquals(componentName, element.attribute("name").getStringValue());
62
63 nodes = document.selectNodes("//wsdl:definitions/wsdl:service/wsdl:port");
64
65 for(Iterator i = nodes.iterator(); i.hasNext();)
66 {
67 element = (Element) i.next();
68
69 if ((element.attribute("name").getStringValue().compareTo(componentName + "MulePort") == 0)
70 || (element.attribute("name").getStringValue().compareTo(componentName + "LocalPort") == 0))
71 {
72 Element tempElement = (Element) element.elements().get(0);
73 String mulePort = tempElement.attribute("location").getStringValue();
74 assertEquals(fullPath, mulePort);
75 }
76 }
77
78 }
79
80 public String getConfigResources()
81 {
82 return "xfire-" + getTransportProtocol() + "-mule-config.xml";
83 }
84
85 }