1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.cxf;
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 ServiceUsingAxisEndpointTestCase extends FunctionalTestCase
27 {
28
29 public void testXFire() throws Exception
30 {
31 MuleClient client = new MuleClient();
32 MuleMessage reply = client.send("vm://xfire.in", new DefaultMuleMessage("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<String, String> props = new HashMap<String, String>();
43 props.put("http.method", "GET");
44 MuleMessage 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
52 List nodes = document.selectNodes("//wsdl:definitions/wsdl:service");
53 assertEquals(((Element) nodes.get(0)).attribute("name").getStringValue(), "XfireService");
54 }
55
56 protected String getConfigResources()
57 {
58 return "using-axis-conf.xml";
59 }
60
61 }