View Javadoc

1   /*
2    * $Id: BeanPropertyExtractorTestCase.java 20321 2010-11-24 15:21:24Z dfeist $
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  public class BeanPropertyExtractorTestCase extends AbstractXmlPropertyExtractorTestCase
16  {
17      public BeanPropertyExtractorTestCase()
18      {
19          super(true);
20      }
21  
22      protected Properties getStartUpProperties()
23      {
24          Properties p = new Properties();
25          p.setProperty("selector.expression", "childBean.value");
26          p.setProperty("selector.evaluator", "bean");
27  
28          return p;
29      }
30  
31      protected Object getMatchMessage()
32      {
33          //Model a simple bean graph. Path is: childBean.value
34          return new TestRootBean(new TestValueBean("matchingEndpoint1"));
35      }
36  
37      protected Object getErrorMessage()
38      {
39          return new TestRootBean(new TestValueBean("missingEndpoint"));
40      }
41  
42      public class TestRootBean
43      {
44          private TestValueBean childBean;
45  
46          public TestRootBean(TestValueBean childBean)
47          {
48              this.childBean = childBean;
49          }
50  
51          public TestValueBean getChildBean()
52          {
53              return childBean;
54          }
55  
56          public void setChildBean(TestValueBean childBean)
57          {
58              this.childBean = childBean;
59          }
60      }
61  
62      public class TestValueBean
63      {
64          private String value;
65  
66          public TestValueBean(String value)
67          {
68              this.value = value;
69          }
70  
71          public String getValue()
72          {
73              return value;
74          }
75  
76          public void setValue(String value)
77          {
78              this.value = value;
79          }
80      }
81  
82  }