1
2
3
4
5
6
7 package org.mule.module.xml.functional;
8
9 import javax.xml.parsers.DocumentBuilder;
10 import javax.xml.parsers.DocumentBuilderFactory;
11 import javax.xml.parsers.ParserConfigurationException;
12
13 import org.w3c.dom.Document;
14 import org.w3c.dom.Element;
15
16 public class W3CDomPropertyExtractorStaticTestCase extends AbstractXmlPropertyExtractorTestCase
17 {
18
19 public W3CDomPropertyExtractorStaticTestCase()
20 {
21 super(true);
22 }
23
24 @Override
25 protected String getConfigResources()
26 {
27 return "org/mule/module/xml/property-extractor-static-test.xml";
28 }
29
30 @Override
31 protected Object getMatchMessage() throws ParserConfigurationException
32 {
33 return documentFor("matchingEndpoint1");
34 }
35
36 @Override
37 protected Object getErrorMessage() throws ParserConfigurationException
38 {
39 return documentFor("missingEndpoint");
40 }
41
42 protected Document documentFor(String name) throws ParserConfigurationException
43 {
44 DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
45 Document doc = builder.newDocument();
46 Element endpoint = doc.createElement("endpoint");
47 endpoint.appendChild(doc.createTextNode(name));
48 doc.appendChild(endpoint);
49 return doc;
50 }
51
52 }