Source Code Cross Referenced for BaseClassInterceptor00.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: BaseClassInterceptor00.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.ItfClassInterceptor;
032:        import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.interceptororder.SLSBClassInterceptorTest00;
033:        import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder01Interceptor;
034:        import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder02Interceptor;
035:        import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder03Interceptor;
036:        import org.ow2.easybeans.tests.common.interceptors.business.order.PrintOrder04Interceptor;
037:        import org.testng.annotations.Test;
038:
039:        /**
040:         * Verifies if the order to execute the class and method interceptors is
041:         * correct.
042:         * @author Gisele Pinheiro Souza
043:         * @author Eduardo Studzinski Estima de Castro
044:         */
045:        public class BaseClassInterceptor00 {
046:
047:            /**
048:             * Bean used to implement the test.
049:             */
050:            private ItfClassInterceptor<Integer> clBean;
051:
052:            /**
053:             * Verifies if the interceptors are not executed.
054:             * @input List with no values inside.
055:             * @output List with only one value, the value inserted by the method.
056:             */
057:            @Test(groups={"onlyClassInterceptor"})
058:            public void testClassInterCallOrder00() {
059:                // The arrays used to know what is the interceptor order
060:                List<Integer> arResult = new ArrayList<Integer>();
061:                List<Integer> arExpected = new ArrayList<Integer>();
062:
063:                // insert the value of method
064:                // there are not interceptors in this class, so only
065:                // the method will be executed
066:                arExpected.add(SLSBClassInterceptorTest00.ORDER);
067:
068:                // gets the result
069:                arResult = clBean.withoutMethodInterceptor(arResult);
070:
071:                // compares the two values
072:                assertEquals(arExpected, arResult,
073:                        "This class does not have interceptor, but the method is calling one.");
074:            }
075:
076:            /**
077:             * Verifies if the default interceptors are not executed.
078:             * @input List with no values inside.
079:             * @output List with only one value, the value inserted by the method.
080:             */
081:            @Test(groups={"excludeDefaultInterceptor"})
082:            public void testClassInterCallOrder01() {
083:                // The arrays used to know what is the interceptor order
084:                List<Integer> arResult = new ArrayList<Integer>();
085:                List<Integer> arExpected = new ArrayList<Integer>();
086:
087:                // insert the value of method
088:                // there are not default interceptors in this class, so only
089:                // the metho will be executed
090:                arExpected.add(SLSBClassInterceptorTest00.ORDER);
091:
092:                // gets the result
093:                arResult = clBean.withExcludeDefaultInterceptor(arResult);
094:
095:                // compares the two values
096:                assertEquals(
097:                        arExpected,
098:                        arResult,
099:                        "This class does not have a default interceptor, but the method is calling one.");
100:            }
101:
102:            /**
103:             * Verifies if the interceptor classes are not executed with the annotation
104:             * excludeClassInterceptor.
105:             * @input List with no values inside.
106:             * @output List with only one value, the value inserted by the method.
107:             */
108:            @Test(groups={"excludeClassInterceptor","onlyClassInterceptor"})
109:            public void testClassInterCallOrder02() {
110:                // The arrays used to know what is the interceptor order
111:                List<Integer> arResult = new ArrayList<Integer>();
112:                List<Integer> arExpected = new ArrayList<Integer>();
113:
114:                // insert the value of the method
115:                arExpected.add(SLSBClassInterceptorTest00.ORDER);
116:
117:                // gets the result
118:                arResult = clBean.withExcludeClassInterceptor(arResult);
119:
120:                // compares the two values
121:                assertEquals(
122:                        arExpected,
123:                        arResult,
124:                        "This method has the excludeClassInterceptor annotation, but the method is calling one.");
125:            }
126:
127:            /**
128:             * Verifies if the interceptor classes are not executed with the annotation
129:             * excludeClassInterceptor. Also, this test verifies if the annotation doesn't
130:             * modify the interceptor method execution.
131:             * @input List with no values inside.
132:             * @output List with two values, the value inserted by the method
133:             *         interceptor and the value inserted by the method.
134:             */
135:            @Test(groups={"methodInterceptor","excludeClassInterceptor"})
136:            public void testClassInterCallOrder03() {
137:                // The arrays used to know what is the interceptor order
138:                List<Integer> arResult = new ArrayList<Integer>();
139:                List<Integer> arExpected = new ArrayList<Integer>();
140:
141:                // insert the value of the interceptor
142:                arExpected.add(PrintOrder01Interceptor.ORDER);
143:                // insert the value of the method
144:                arExpected.add(SLSBClassInterceptorTest00.ORDER);
145:
146:                // gets the result
147:                arResult = clBean.excludeClassAndOneMtd(arResult);
148:
149:                // compares the two values
150:                assertEquals(arExpected, arResult,
151:                        "The interceptors  are running in a incorrect order.");
152:            }
153:
154:            /**
155:             * Verifies if the interceptor classes are not executed with the annotation
156:             * excludeClassInterceptor. Also, this test verifies if the annotation doesn't
157:             * modify many interceptor method executions.
158:             * @input List with no values inside.
159:             * @output List with five values, the valuees inserted by the method
160:             *         interceptors and the value inserted by the method.
161:             */
162:            @Test(groups={"excludeDefaultInterceptor","excludeClassInterceptor","methodInterceptor","withInheritance"})
163:            public void testClassInterCallOrder04() {
164:                // The arrays used to know what is the interceptor order
165:                List<Integer> arResult = new ArrayList<Integer>();
166:                List<Integer> arExpected = new ArrayList<Integer>();
167:
168:                // insert the value of the interceptor
169:                arExpected.add(PrintOrder01Interceptor.ORDER);
170:                // insert the value of the interceptor
171:                arExpected.add(PrintOrder02Interceptor.ORDER);
172:                // insert the value of the interceptor
173:                arExpected.add(PrintOrder03Interceptor.ORDER);
174:                // insert the value of the interceptor
175:                arExpected.add(PrintOrder04Interceptor.ORDER);
176:                // insert the value of the method
177:                arExpected.add(SLSBClassInterceptorTest00.ORDER);
178:
179:                // gets the result
180:                arResult = clBean.excludeClassDefAndFourMtd(arResult);
181:
182:                // compares the two values
183:                assertEquals(arExpected, arResult,
184:                        "The method interceptors are running in the incorrect order.");
185:            }
186:
187:            /**
188:             * Verifies if the interceptor classes and the interceptor methods work well
189:             * together, i.e., if they respect the order.
190:             * @input List with no values inside.
191:             * @output List with four values, the values inserted by the method
192:             *         interceptor and the value inserted by the method.
193:             */
194:            @Test(groups={"methodInterceptor","withInheritance"})
195:            public void testClassInterCallOrder05() {
196:                // The arrays used to know what is the interceptor order
197:                List<Integer> arResult = new ArrayList<Integer>();
198:                List<Integer> arExpected = new ArrayList<Integer>();
199:
200:                // insert the value of the interceptor
201:                arExpected.add(PrintOrder01Interceptor.ORDER);
202:                // insert the value of the interceptor
203:                arExpected.add(PrintOrder02Interceptor.ORDER);
204:                // insert the value of the interceptor
205:                arExpected.add(PrintOrder03Interceptor.ORDER);
206:                // insert the value of the method
207:                arExpected.add(SLSBClassInterceptorTest00.ORDER);
208:
209:                // gets the result
210:                arResult = clBean.withThreeMethodInterceptor(arResult);
211:
212:                // compares the two values
213:                assertEquals(arExpected, arResult,
214:                        "The method interceptor are running in the incorrect order.");
215:            }
216:
217:            /**
218:             * Verifies if the interceptor classes and the interceptor methods work well
219:             * together, i.e., if they respect the order.
220:             * @input List with no values inside.
221:             * @output List with two values, the values inserted by the method
222:             *         interceptor and the value inserted by the method.
223:             */
224:            @Test(groups={"methodInterceptor"})
225:            public void testClassInterCallOrder06() {
226:                // The arrays used to know what is the interceptor order
227:                List<Integer> arResult = new ArrayList<Integer>();
228:                List<Integer> arExpected = new ArrayList<Integer>();
229:
230:                // insert the value of the interceptor
231:                arExpected.add(PrintOrder01Interceptor.ORDER);
232:                // insert the value of the method
233:                arExpected.add(SLSBClassInterceptorTest00.ORDER);
234:
235:                // gets the result
236:                arResult = clBean.withOneMethodInterceptor(arResult);
237:
238:                // compares the two values
239:                assertEquals(arExpected, arResult,
240:                        "The method interceptor are running in the incorrect order.");
241:            }
242:
243:            /**
244:             * Sets bean used in the tests.
245:             * @param bean The bean to set.
246:             */
247:            public void setBean(final ItfClassInterceptor<Integer> bean) {
248:                this.clBean = bean;
249:            }
250:        }
ww__w.j_a___v__a__2__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.