1
2
3
4
5
6
7
8
9
10
11 package org.mule.transport.cxf;
12
13 import org.mule.api.MuleMessage;
14 import org.mule.module.client.MuleClient;
15 import org.mule.module.xml.util.XMLUtils;
16 import org.mule.tck.FunctionalTestCase;
17 import org.mule.util.IOUtils;
18
19 import javax.xml.transform.TransformerFactoryConfigurationError;
20
21 import org.custommonkey.xmlunit.XMLUnit;
22
23 public class CxfBasicTestCase extends FunctionalTestCase
24 {
25 private String echoWsdl;
26
27 @Override
28 protected void doSetUp() throws Exception
29 {
30 super.doSetUp();
31 echoWsdl = IOUtils.getResourceAsString("xfire-echo-service.wsdl", getClass());
32 XMLUnit.setIgnoreWhitespace(true);
33 try
34 {
35 XMLUnit.getTransformerFactory();
36 }
37 catch (TransformerFactoryConfigurationError e)
38 {
39 XMLUnit.setTransformerFactory(XMLUtils.TRANSFORMER_FACTORY_JDK5);
40 }
41 }
42
43 public void testEchoService() throws Exception
44 {
45 MuleClient client = new MuleClient();
46 MuleMessage result = client.send("cxf:http://localhost:63081/services/Echo?method=echo", "Hello!",
47 null);
48 assertEquals("Hello!", result.getPayload());
49 }
50
51 public void testEchoServiceSynchronous() throws Exception
52 {
53 MuleClient client = new MuleClient();
54 MuleMessage result = client.send("cxf:http://localhost:63083/services/Echo3?method=echo", "Hello!",
55 null);
56 assertEquals("Hello!", result.getPayload());
57 }
58
59 public void testEchoWsdl() throws Exception
60 {
61 MuleClient client = new MuleClient();
62 MuleMessage result = client.request("http://localhost:63081/services/Echo?wsdl", 5000);
63 assertNotNull(result.getPayload());
64 XMLUnit.compareXML(echoWsdl, result.getPayloadAsString());
65 }
66
67 protected String getConfigResources()
68 {
69 return "basic-conf.xml";
70 }
71
72 }