View Javadoc

1   /*
2    * $Id: Dom4jPropertyExtractorMultipleEndpointsTestCase.java 22414 2011-07-14 13:24:46Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.module.xml.functional;
12  
13  import java.util.Properties;
14  
15  import org.dom4j.Document;
16  import org.dom4j.DocumentHelper;
17  import org.dom4j.Element;
18  
19  public class Dom4jPropertyExtractorMultipleEndpointsTestCase extends AbstractXmlPropertyExtractorTestCase
20  {
21  
22      public Dom4jPropertyExtractorMultipleEndpointsTestCase(ConfigVariant variant, String configResources)
23      {
24          super(variant, configResources, false);
25      }
26  
27      @Override
28      protected Properties getStartUpProperties()
29      {
30          Properties p = new Properties();
31          p.setProperty("selector.expression", "/endpoints/endpoint");
32          p.setProperty("selector.evaluator", "xpath");
33  
34          return p;
35      }
36  
37      @Override
38      protected Object getMatchMessage()
39      {
40          Document document = DocumentHelper.createDocument();
41          Element e = document.addElement("endpoints");
42          e.addElement("endpoint").addText("matchingEndpoint1");
43          e.addElement("endpoint").addText("matchingEndpoint2");
44          return document;
45      }
46  
47      @Override
48      protected Object getErrorMessage()
49      {
50          Document document = DocumentHelper.createDocument();
51          document.addElement("endpoint").addText("missingEndpoint");
52          return document;
53      }
54  
55  }