View Javadoc

1   /*
2    * $Id: EntryPointResolverTestCase.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.test.integration.resolvers;
12  
13  import java.util.HashMap;
14  import java.util.Map;
15  
16  public class EntryPointResolverTestCase extends AbstractEntryPointResolverTestCase
17  {
18  
19      protected String getConfigResources()
20      {
21          return "org/mule/test/integration/resolvers/entry-point-resolver-test.xml";
22      }
23  
24      public void testArrayEntryPointResolverOnModel() throws Exception
25      {
26          doTest("array", new String[]{"hello", "world"}, "array");
27      }
28      
29      public void testArrayEntryPointResolverOnComponent() throws Exception
30      {
31          doTest("array2", new String[]{"hello", "world"}, "array");
32      }
33  
34      public void testCallableEntryPointResolverOnModel() throws Exception
35      {
36          doTest("callable", new Object(), "callable");
37      }
38  
39      public void testCallableEntryPointResolverOnComponent() throws Exception
40      {
41          doTest("callable2", new Object(), "callable");
42      }
43  
44      public void testCustomEntryPointResolverOnModel() throws Exception
45      {
46          doTest("custom", new Object(), "custom");
47      }
48  
49      public void testCustomEntryPointResolverOnComponent() throws Exception
50      {
51          doTest("custom2", new Object(), "custom");
52      }
53  
54      public void testMethodEntryPointResolverOnModel() throws Exception
55      {
56          doTest("method", new String(), "methodString");
57          doTest("method", new Integer(0), "methodInteger");
58      }
59  
60      public void testMethodEntryPointResolverOnComponent() throws Exception
61      {
62          doTest("method2", new String(), "methodString");
63          doTest("method2", new Integer(0), "methodInteger");
64      }
65  
66      public void testNoArgumentsEntryPointResolverOnModel() throws Exception
67      {
68          doTest("no-arguments", new String(), "noArguments");
69      }
70  
71      public void testNoArgumentsEntryPointResolverOnComponent() throws Exception
72      {
73          doTest("no-arguments2", new String(), "noArguments");
74      }
75  
76      public void testPropertyEntryPointResolverOnModel() throws Exception
77      {
78          Map properties = new HashMap();
79          properties.put("propertyName", "property");
80          doTest("property", new Object(), "property", properties);
81      }
82  
83      public void testPropertyEntryPointResolverOnComponent() throws Exception
84      {
85          Map properties = new HashMap();
86          properties.put("propertyName", "property");
87          doTest("property2", new Object(), "property", properties);
88      }
89  
90      public void testReflectionEntryPointResolverOnModel() throws Exception
91      {
92          doTest("reflection", new Object[]{new Integer(0), new String("String")}, "reflection");
93      }
94  
95      public void testReflectionEntryPointResolverOnComponent() throws Exception
96      {
97          doTest("reflection2", new Object[]{new Integer(0), new String("String")}, "reflection");
98      }
99  
100     public void testLegacyEntryPointResolversOnModel() throws Exception
101     {
102         doTest("legacy", "hello world", "callable");
103     }
104 
105     public void testLegacyEntryPointResolversOnComponent() throws Exception
106     {
107         doTest("legacy2", "hello world", "callable");
108     }
109 
110     public void testReflectionEntryPointResolverWithNullElementInArray() throws Exception
111     {
112         // see MULE-3565
113         
114         // This first case causes an exception in the flow because the ReflectionEntryPointResolver
115         // will take the argument types literally and it doesn't know how to handle the null as class
116         doTest("reflection", new Object[] { new Integer(42), null }, "{NullPayload}");
117         
118         doTest("array", new String[] { "hello", null, "world" }, "array");
119     }
120 }