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