View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.xml.functional;
8   
9   import java.text.MessageFormat;
10  import java.util.Properties;
11  
12  public class JXPathExpressionWithNamespaceTestCase extends AbstractXmlPropertyExtractorTestCase
13  {
14  
15      public static final String MESSAGE = "<foo:endpoint xmlns:foo=\"http://foo.com\">{0}</foo:endpoint>";
16  
17      public JXPathExpressionWithNamespaceTestCase()
18      {
19          super(true);
20      }
21  
22      @Override
23      protected Properties getStartUpProperties()
24      {
25          Properties p = new Properties();
26          p.setProperty("selector.expression", "/foo:endpoint");
27          p.setProperty("selector.evaluator", "jxpath");
28  
29          return p;
30      }
31  
32      @Override
33      protected Object getMatchMessage() throws Exception
34      {
35          return documentFor("matchingEndpoint1");
36      }
37  
38      @Override
39      protected Object getErrorMessage() throws Exception
40      {
41          return documentFor("missingEndpoint");
42      }
43  
44      protected String documentFor(String name) throws Exception
45      {
46          return MessageFormat.format(MESSAGE, name);
47      }
48  
49  }