Source Code Cross Referenced for BaseMiscInterceptor00.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » tests » interceptors » business » base » invocationorder » 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 » J2EE » ow2 easybeans » org.ow2.easybeans.tests.interceptors.business.base.invocationorder 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * EasyBeans
003:         * Copyright (C) 2006 Bull S.A.S.
004:         * Contact: easybeans@ow2.org
005:         *
006:         * This library is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public
008:         * License as published by the Free Software Foundation; either
009:         * version 2.1 of the License, or any later version.
010:         *
011:         * This library is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014:         * Lesser General Public License for more details.
015:         *
016:         * You should have received a copy of the GNU Lesser General Public
017:         * License along with this library; if not, write to the Free Software
018:         * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
019:         * USA
020:         *
021:         * --------------------------------------------------------------------------
022:         * $Id: BaseMiscInterceptor00.java 1970 2007-10-16 11:49:25Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.tests.interceptors.business.base.invocationorder;
025:
026:        import static org.ow2.easybeans.tests.common.asserts.Assert.assertEquals;
027:
028:        import java.util.ArrayList;
029:        import java.util.List;
030:
031:        import org.ow2.easybeans.tests.common.ejbs.base.ItfSimpleBean;
032:        import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder.SLSBSimpleInterceptorTest00;
033:        import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder.SLSBSimpleInterceptorTest01;
034:        import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder.SLSBSimpleInterceptorTest02;
035:        import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder.SLSBSimpleInterceptorTest03;
036:        import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder01Interceptor;
037:        import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder03Interceptor;
038:        import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder06Interceptor;
039:        import org.testng.annotations.Test;
040:
041:        /**
042:         * Verifies if the order to execute the method and callbacks interceptors is
043:         * correct, also verifies the interceptors inheritance.
044:         * @author Eduardo Studzinski Estima de Castro
045:         * @author Gisele Pinheiro Souza
046:         */
047:        public class BaseMiscInterceptor00 {
048:
049:            /**
050:             * Bean used to implement the test.
051:             */
052:            private ItfSimpleBean<Integer> mtBean00;
053:
054:            /**
055:             * Bean used to implement the test.
056:             */
057:            private ItfSimpleBean<Integer> mtBean01;
058:
059:            /**
060:             * Bean used to implement the test.
061:             */
062:            private ItfSimpleBean<Integer> mtBean02;
063:
064:            /**
065:             * Bean used to implement the test.
066:             */
067:            private ItfSimpleBean<Integer> mtBean03;
068:
069:            /**
070:             * Verifies if the interceptors are following the order of declaration.
071:             * There is an interceptor inside the bean class that has public modifier
072:             * access.
073:             * @input List with no values inside
074:             * @output List with 4 values, the value inserted by the method and value
075:             *         inserted by the interceptors.
076:             */
077:            @Test(groups={"withInterceptor"})
078:            public void testMiscPublicInterCallOrder() {
079:                // The arrays used to know what is the interceptor order
080:                List<Integer> arResult = new ArrayList<Integer>();
081:                List<Integer> arExpected = new ArrayList<Integer>();
082:
083:                // insert the value of interceptor
084:                arExpected.add(PrintOrder06Interceptor.ORDER);
085:                // insert the value of interceptor
086:                arExpected.add(PrintOrder01Interceptor.ORDER);
087:                // insert the value of interceptor
088:                arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
089:                // insert the value of the method
090:                arExpected.add(SLSBSimpleInterceptorTest00.ORDER);
091:
092:                // gets the result
093:                arResult = mtBean00.withInterceptors(arResult);
094:
095:                assertEquals(
096:                        arExpected,
097:                        arResult,
098:                        "The method has class interceptors, a method interceptor and a public bean interceptor method"
099:                                + " declared inside the bean; however it isn't running in the correct order.");
100:            }
101:
102:            /**
103:             * Verifies if the interceptors are following the order of declaration.
104:             * There is an interceptor inside the bean class that has protected modifier
105:             * access.
106:             * @input List with no values inside
107:             * @output List with 4 values, the value inserted by the method and value
108:             *         inserted by the interceptors.
109:             */
110:            @Test(groups={"withInterceptor"})
111:            public void testMiscProtectedInterCallOrder() {
112:                // The arrays used to know what is the interceptor order
113:                List<Integer> arResult = new ArrayList<Integer>();
114:                List<Integer> arExpected = new ArrayList<Integer>();
115:
116:                // insert the value of interceptor
117:                arExpected.add(PrintOrder06Interceptor.ORDER);
118:                // insert the value of interceptor
119:                arExpected.add(PrintOrder01Interceptor.ORDER);
120:                // insert the value of interceptor
121:                arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
122:                // insert the value of the method
123:                arExpected.add(SLSBSimpleInterceptorTest01.ORDER);
124:
125:                // gets the result
126:                arResult = mtBean01.withInterceptors(arResult);
127:
128:                // compares the two values
129:                assertEquals(
130:                        arExpected,
131:                        arResult,
132:                        "The method has class interceptors, a method interceptor and a protected bean interceptor method"
133:                                + " declared inside the bean; however it isn't running in the correct order.");
134:            }
135:
136:            /**
137:             * Verifies if the interceptors are following the order of declaration.
138:             * There is an interceptor inside the bean class that has private modifier
139:             * access.
140:             * @input List with no values inside
141:             * @output List with 4 values, the value inserted by the method and value
142:             *         inserted by the interceptors.
143:             */
144:            @Test(groups={"withInterceptor"})
145:            public void testMiscPrivateInterCallOrder() {
146:                // The arrays used to know what is the interceptor order
147:                List<Integer> arResult = new ArrayList<Integer>();
148:                List<Integer> arExpected = new ArrayList<Integer>();
149:
150:                // insert the value of interceptor
151:                arExpected.add(PrintOrder06Interceptor.ORDER);
152:                // insert the value of interceptor
153:                arExpected.add(PrintOrder01Interceptor.ORDER);
154:                // insert the value of interceptor
155:                arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
156:                // insert the value of the method
157:                arExpected.add(SLSBSimpleInterceptorTest02.ORDER);
158:
159:                // gets the result
160:                arResult = mtBean02.withInterceptors(arResult);
161:
162:                // compares the two values
163:                assertEquals(
164:                        arExpected,
165:                        arResult,
166:                        "The method has class interceptors, a method interceptor and a protected bean interceptor method"
167:                                + " declared inside the bean; however it isn't running in the correct order.");
168:            }
169:
170:            /**
171:             * Verifies if the interceptors are following the order of declaration.
172:             * There is an interceptor inside the bean class that has public modifier
173:             * access.
174:             * @input List with no values inside
175:             * @output List with 4 values, the value inserted by the method and value
176:             *         inserted by the interceptors.
177:             */
178:            @Test(groups={"withInterceptor","withInheritance"})
179:            public void testMiscInheritanceInterCallOrder00() {
180:                // The arrays used to know what is the interceptor order
181:                List<Integer> arResult = new ArrayList<Integer>();
182:                List<Integer> arExpected = new ArrayList<Integer>();
183:
184:                // insert the value of interceptor
185:                arExpected.add(PrintOrder06Interceptor.ORDER);
186:                // insert the value of interceptor
187:                arExpected.add(PrintOrder03Interceptor.ORDER);
188:                // insert the value of interceptor
189:                arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
190:                // insert the value of the method
191:                arExpected.add(SLSBSimpleInterceptorTest00.ORDER);
192:
193:                // gets the result
194:                arResult = mtBean00.withInterceptorsInheritance(arResult);
195:
196:                // compares the two values
197:                assertEquals(
198:                        arExpected,
199:                        arResult,
200:                        "The method has class interceptors, a method interceptor with inheritance and a public bean interceptor method"
201:                                + " declared inside the bean; however it isn't running in the correct order.");
202:            }
203:
204:            /**
205:             * Verifies if the interceptors are following the order of declaration.
206:             * There is an interceptor inside the bean class that has protected modifier
207:             * access.
208:             * @input List with no values inside
209:             * @output List with 4 values, the value inserted by the method and value
210:             *         inserted by the interceptors.
211:             */
212:            @Test(groups={"withInterceptor","withInheritance"})
213:            public void testMiscInheritanceInterCallOrder01() {
214:                // The arrays used to know what is the interceptor order
215:                List<Integer> arResult = new ArrayList<Integer>();
216:                List<Integer> arExpected = new ArrayList<Integer>();
217:
218:                // insert the value of interceptor
219:                arExpected.add(PrintOrder06Interceptor.ORDER);
220:                // insert the value of interceptor
221:                arExpected.add(PrintOrder03Interceptor.ORDER);
222:                // insert the value of interceptor
223:                arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
224:                // insert the value of the method
225:                arExpected.add(SLSBSimpleInterceptorTest01.ORDER);
226:
227:                // gets the result
228:                arResult = mtBean01.withInterceptorsInheritance(arResult);
229:
230:                // compares the two values
231:                assertEquals(
232:                        arExpected,
233:                        arResult,
234:                        "The method has class interceptors, a method interceptor with inheritance and a protected bean interceptor method"
235:                                + " declared inside the bean; however it isn't running in the correct order.");
236:            }
237:
238:            /**
239:             * Verifies if the interceptors are following the order of declaration.
240:             * There is an interceptor inside the bean class that has private modifier
241:             * access.
242:             * @input List with no values inside
243:             * @output List with 4 values, the value inserted by the method and value
244:             *         inserted by the interceptors.
245:             */
246:            @Test(groups={"withInterceptor","withInheritance"})
247:            public void testMiscInheritanceInterCallOrder02() {
248:                // The arrays used to know what is the interceptor order
249:                List<Integer> arResult = new ArrayList<Integer>();
250:                List<Integer> arExpected = new ArrayList<Integer>();
251:
252:                // insert the value of interceptor
253:                arExpected.add(PrintOrder06Interceptor.ORDER);
254:                // insert the value of interceptor
255:                arExpected.add(PrintOrder03Interceptor.ORDER);
256:                // insert the value of interceptor
257:                arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
258:                // insert the value of the method
259:                arExpected.add(SLSBSimpleInterceptorTest02.ORDER);
260:
261:                // gets the result
262:                arResult = mtBean02.withInterceptorsInheritance(arResult);
263:
264:                // compares the two values
265:                assertEquals(
266:                        arExpected,
267:                        arResult,
268:                        "The method has class interceptors, a method interceptor with inheritance and a private bean interceptor method"
269:                                + " declared inside the bean; however it isn't running in the correct order.");
270:            }
271:
272:            /**
273:             * Verifies if the interceptors are following the order of declaration.
274:             * There is an interceptor inside the bean class that has package modifier
275:             * access.
276:             * @input List with no values inside
277:             * @output List with 3 values, the value inserted by the method and value
278:             *         inserted by the interceptors.
279:             */
280:            @Test(groups={"withInterceptor"})
281:            public void testMiscPackageInterCallOrder() {
282:                // The arrays used to know what is the interceptor order
283:                List<Integer> arResult = new ArrayList<Integer>();
284:                List<Integer> arExpected = new ArrayList<Integer>();
285:
286:                // insert the value of interceptor
287:                arExpected.add(PrintOrder03Interceptor.ORDER);
288:                // insert the value of interceptor
289:                arExpected.add(ItfSimpleBean.EMBEDDED_INTERCEPTOR);
290:                // insert the value of the method
291:                arExpected.add(SLSBSimpleInterceptorTest03.ORDER);
292:
293:                // gets the result
294:                arResult = mtBean03.withInterceptorsInheritance(arResult);
295:
296:                // compares the two values
297:                assertEquals(
298:                        arExpected,
299:                        arResult,
300:                        "The method has a method interceptor and a package level bean interceptor method"
301:                                + " declared inside the bean; however it isn't running in the correct order.");
302:            }
303:
304:            /**
305:             * Sets bean used in the tests.
306:             * @param bean00 The bean to set.
307:             * @param bean01 The bean to set.
308:             * @param bean02 The bean to set.
309:             * @param bean03 The bean to set.
310:             */
311:            public void setBeans(final ItfSimpleBean<Integer> bean00,
312:                    final ItfSimpleBean<Integer> bean01,
313:                    final ItfSimpleBean<Integer> bean02,
314:                    final ItfSimpleBean<Integer> bean03) {
315:                this.mtBean00 = bean00;
316:                this.mtBean01 = bean01;
317:                this.mtBean02 = bean02;
318:                this.mtBean03 = bean03;
319:            }
320:        }
w__ww___.___j___a__v__a2__s__.c__o__m | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.