Source Code Cross Referenced for ObjectIndexedTest.java in  » Scripting » OGNL » org » ognl » test » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » OGNL » org.ognl.test 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.ognl.test;
002:
003:        import junit.framework.TestCase;
004:        import junit.framework.TestSuite;
005:        import ognl.Ognl;
006:        import ognl.OgnlContext;
007:        import ognl.OgnlException;
008:        import ognl.OgnlRuntime;
009:        import ognl.SimpleNode;
010:
011:        public class ObjectIndexedTest extends TestCase {
012:            protected OgnlContext context;
013:
014:            /*===================================================================
015:                Public static classes
016:              ===================================================================*/
017:            public static interface TestInterface {
018:                String getSunk(String index);
019:
020:                void setSunk(String index, String sunk);
021:            }
022:
023:            public static class Test1 extends Object implements  TestInterface {
024:                public String getSunk(String index) {
025:                    return "foo";
026:                }
027:
028:                public void setSunk(String index, String sunk) {
029:                    /* do nothing */
030:                }
031:            }
032:
033:            public static class Test2 extends Test1 {
034:                public String getSunk(String index) {
035:                    return "foo";
036:                }
037:
038:                public void setSunk(String index, String sunk) {
039:                    /* do nothing */
040:                }
041:            }
042:
043:            public static class Test3 extends Test1 {
044:                public String getSunk(String index) {
045:                    return "foo";
046:                }
047:
048:                public void setSunk(String index, String sunk) {
049:                    /* do nothing */
050:                }
051:
052:                public String getSunk(Object index) {
053:                    return null;
054:                }
055:            }
056:
057:            public static class Test4 extends Test1 {
058:                public String getSunk(String index) {
059:                    return "foo";
060:                }
061:
062:                public void setSunk(String index, String sunk) {
063:                    /* do nothing */
064:                }
065:
066:                public void setSunk(Object index, String sunk) {
067:                    /* do nothing */
068:                }
069:            }
070:
071:            public static class Test5 extends Test1 {
072:                public String getSunk(String index) {
073:                    return "foo";
074:                }
075:
076:                public void setSunk(String index, String sunk) {
077:                    /* do nothing */
078:                }
079:
080:                public String getSunk(Object index) {
081:                    return null;
082:                }
083:
084:                public void setSunk(Object index, String sunk) {
085:                    /* do nothing */
086:                }
087:            }
088:
089:            /*===================================================================
090:                Public static methods
091:              ===================================================================*/
092:            public static TestSuite suite() {
093:                return new TestSuite(ObjectIndexedTest.class);
094:            }
095:
096:            /*===================================================================
097:                Constructors
098:              ===================================================================*/
099:            public ObjectIndexedTest() {
100:                super ();
101:            }
102:
103:            public ObjectIndexedTest(String name) {
104:                super (name);
105:            }
106:
107:            /*===================================================================
108:                Public methods
109:              ===================================================================*/
110:            public void testPropertyDescriptorReflection() throws Exception {
111:                OgnlRuntime.getPropertyDescriptor(java.util.AbstractList.class,
112:                        "");
113:                OgnlRuntime.getPropertyDescriptor(
114:                        java.util.AbstractSequentialList.class, "");
115:                OgnlRuntime.getPropertyDescriptor(
116:                        java.lang.reflect.Array.class, "");
117:                OgnlRuntime
118:                        .getPropertyDescriptor(java.util.ArrayList.class, "");
119:                OgnlRuntime.getPropertyDescriptor(java.util.BitSet.class, "");
120:                OgnlRuntime.getPropertyDescriptor(java.util.Calendar.class, "");
121:                OgnlRuntime.getPropertyDescriptor(
122:                        java.lang.reflect.Field.class, "");
123:                OgnlRuntime.getPropertyDescriptor(java.util.LinkedList.class,
124:                        "");
125:                OgnlRuntime.getPropertyDescriptor(java.util.List.class, "");
126:                OgnlRuntime.getPropertyDescriptor(java.util.Iterator.class, "");
127:                OgnlRuntime.getPropertyDescriptor(java.lang.ThreadLocal.class,
128:                        "");
129:                OgnlRuntime.getPropertyDescriptor(java.net.URL.class, "");
130:                OgnlRuntime.getPropertyDescriptor(java.util.Vector.class, "");
131:            }
132:
133:            public void testObjectIndexAccess() throws OgnlException {
134:                SimpleNode expression = (SimpleNode) Ognl
135:                        .parseExpression("#ka.sunk[#root]");
136:
137:                context.put("ka", new Test1());
138:                Ognl.getValue(expression, context, "aksdj");
139:            }
140:
141:            public void testObjectIndexInSubclass() throws OgnlException {
142:                SimpleNode expression = (SimpleNode) Ognl
143:                        .parseExpression("#ka.sunk[#root]");
144:
145:                context.put("ka", new Test2());
146:                Ognl.getValue(expression, context, "aksdj");
147:            }
148:
149:            public void testMultipleObjectIndexGetters() throws OgnlException {
150:                SimpleNode expression = (SimpleNode) Ognl
151:                        .parseExpression("#ka.sunk[#root]");
152:
153:                context.put("ka", new Test3());
154:                try {
155:                    Ognl.getValue(expression, context, new Test3());
156:                    fail();
157:                } catch (OgnlException ex) {
158:                    /* Should throw */
159:                }
160:            }
161:
162:            public void testMultipleObjectIndexSetters() throws OgnlException {
163:                SimpleNode expression = (SimpleNode) Ognl
164:                        .parseExpression("#ka.sunk[#root]");
165:
166:                context.put("ka", new Test4());
167:                try {
168:                    Ognl.getValue(expression, context, "aksdj");
169:                    fail();
170:                } catch (OgnlException ex) {
171:                    /* Should throw */
172:                }
173:            }
174:
175:            public void testMultipleObjectIndexMethodPairs()
176:                    throws OgnlException {
177:                SimpleNode expression = (SimpleNode) Ognl
178:                        .parseExpression("#ka.sunk[#root]");
179:
180:                context.put("ka", new Test5());
181:                try {
182:                    Ognl.getValue(expression, context, "aksdj");
183:                    fail();
184:                } catch (OgnlException ex) {
185:                    /* Should throw */
186:                }
187:            }
188:
189:            /*===================================================================
190:               Overridden methods
191:             ===================================================================*/
192:            protected void setUp() {
193:                context = (OgnlContext) Ognl.createDefaultContext(null);
194:            }
195:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.