1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.xml.functional;
12
13 import java.text.MessageFormat;
14 import java.util.Properties;
15
16 import org.dom4j.Document;
17 import org.dom4j.DocumentHelper;
18
19 public class Dom4jXPathExpressionWithNamespaceTestCase extends AbstractXmlPropertyExtractorTestCase
20 {
21
22 public static final String MESSAGE = "<foo:endpoint xmlns:foo=\"http://foo.com\">{0}</foo:endpoint>";
23
24 public Dom4jXPathExpressionWithNamespaceTestCase()
25 {
26 super(true);
27 }
28
29 protected Properties getStartUpProperties()
30 {
31 Properties p = new Properties();
32 p.setProperty("selector.expression", "/foo:endpoint");
33 p.setProperty("selector.evaluator", "xpath");
34
35 return p;
36 }
37
38 protected Object getMatchMessage() throws Exception
39 {
40 return documentFor("matchingEndpoint1");
41 }
42
43 protected Object getErrorMessage() throws Exception
44 {
45 return documentFor("missingEndpoint");
46 }
47
48 protected Document documentFor(String name) throws Exception
49 {
50 return DocumentHelper.parseText(MessageFormat.format(MESSAGE, name));
51
52 }
53
54 }