1
2
3
4
5
6
7
8
9
10
11 package org.mule.module.xml.functional;
12
13 import java.util.ArrayList;
14 import java.util.List;
15 import java.util.Properties;
16
17 public class BeanPropertyExtractorMultipleEndpointsTestCase extends AbstractXmlPropertyExtractorTestCase
18 {
19 public BeanPropertyExtractorMultipleEndpointsTestCase(ConfigVariant variant, String configResources)
20 {
21 super(variant, configResources, false);
22 }
23
24 @Override
25 protected Properties getStartUpProperties()
26 {
27 Properties p = new Properties();
28 p.setProperty("selector.expression", "endpointsHolder.endpoints");
29 p.setProperty("selector.evaluator", "bean");
30 return p;
31 }
32
33 @Override
34 protected Object getMatchMessage()
35 {
36
37 List<String> endpoints = new ArrayList<String>(2);
38 endpoints.add("matchingEndpoint1");
39 endpoints.add("matchingEndpoint2");
40 return new TestRootBean(new EndpointsHolder(endpoints));
41 }
42
43 @Override
44 protected Object getErrorMessage()
45 {
46 List<String> endpoints = new ArrayList<String>(1);
47 endpoints.add("missingEndpoint");
48 return new TestRootBean(new EndpointsHolder(endpoints));
49 }
50
51 public class TestRootBean
52 {
53 private EndpointsHolder endpointsHolder;
54
55 public TestRootBean(EndpointsHolder endpointsHolder)
56 {
57 this.endpointsHolder = endpointsHolder;
58 }
59
60 public EndpointsHolder getEndpointsHolder()
61 {
62 return endpointsHolder;
63 }
64
65 public void setEndpointsHolder(EndpointsHolder endpointsHolder)
66 {
67 this.endpointsHolder = endpointsHolder;
68 }
69 }
70
71 public class EndpointsHolder
72 {
73 private List<String> endpoints;
74
75 public EndpointsHolder(List<String> endpoints)
76 {
77 this.endpoints = endpoints;
78 }
79
80 public List<String> getEndpoints()
81 {
82 return endpoints;
83 }
84
85 public void setEndpoints(List<String> endpoints)
86 {
87 this.endpoints = endpoints;
88 }
89 }
90 }