1
2
3
4
5
6
7 package org.mule.module.xml.functional;
8
9 import org.mule.DefaultMuleMessage;
10 import org.mule.api.MuleMessage;
11 import org.mule.api.client.MuleClient;
12 import org.mule.tck.junit4.FunctionalTestCase;
13
14 import org.junit.Test;
15 import org.w3c.dom.Node;
16
17 import static org.junit.Assert.assertNotNull;
18 import static org.junit.Assert.assertTrue;
19
20 public class W3CDocumentXPathNodeEvaluatorTestCase extends FunctionalTestCase
21 {
22 private static final String XML_INPUT =
23 "<root>" +
24 " <table>" +
25 " <name>African Coffee Table</name>" +
26 " <width>80</width>" +
27 " <length>120</length>" +
28 " </table>" +
29 "</root>";
30
31 @Override
32 protected String getConfigResources()
33 {
34 return "org/mule/module/xml/w3c-dom-xpath-node-config.xml";
35 }
36
37 @Test
38 public void testW3CDocument() throws Exception
39 {
40 MuleClient client = muleContext.getClient();
41
42 MuleMessage message = new DefaultMuleMessage(XML_INPUT, muleContext);
43 MuleMessage response = client.send("vm://test", message);
44 assertNotNull(response);
45 assertNotNull(response.getPayload());
46 assertTrue(response.getPayload() instanceof Node);
47 }
48 }