Source Code Cross Referenced for TestSFAccessInterceptor00.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » tests » interceptors » business » stateful » containermanaged » 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.stateful.containermanaged 
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: TestSFAccessInterceptor00.java 1970 2007-10-16 11:49:25Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.tests.interceptors.business.stateful.containermanaged;
025:
026:        import static org.ow2.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
027:        import static org.ow2.easybeans.tests.common.helper.ExceptionHelper.checkCause;
028:
029:        import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessEJB;
030:        import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessEMFactory;
031:        import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessEntityManager;
032:        import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessJNDI;
033:        import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessResourceManager;
034:        import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessSessionContext;
035:        import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessUserTransaction;
036:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.interceptoraccess.SFSBAccessInterceptorTest00;
037:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.interceptoraccess.SFSBAccessSessionCtxInterceptor00;
038:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.interceptoraccess.SFSBAccessSessionCtxInterceptor01;
039:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.interceptoraccess.SFSBAccessUserTxInterceptor00;
040:        import org.ow2.easybeans.tests.common.exception.CustomException00;
041:        import org.ow2.easybeans.tests.interceptors.business.base.access.BaseAccessOperationsInterceptor00;
042:        import org.testng.annotations.BeforeClass;
043:        import org.testng.annotations.Test;
044:
045:        /**
046:         * Verifies if interceptors in an external class can access the perform the
047:         * operations specified by the JSR-220.
048:         * @reference JSR 220 - EJB 3.0 Core - 4.4.1
049:         * @requirement Application Server must be running; the beans
050:         *              org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.SFSB*AccessInterceptor*
051:         *              must be deployed.
052:         *              (Ant task: install.jar.tests.interceptor.business)
053:         * @setup gets the reference of SFSBAccessInterceptorTest00, SFSBAccessTimerInterceptor00
054:         * @author Eduardo Studzinski Estima de Castro
055:         * @author Gisele Pinheiro Souza
056:         */
057:        public class TestSFAccessInterceptor00 extends
058:                BaseAccessOperationsInterceptor00 {
059:
060:            /**
061:             * Gets bean instances used in the tests.
062:             * @throws Exception if there is a problem with the bean initialization.
063:             */
064:            @BeforeClass
065:            public void startUp() throws Exception {
066:                ItfAccessJNDI bean00 = getBeanRemoteInstance(
067:                        SFSBAccessInterceptorTest00.class, ItfAccessJNDI.class);
068:                ItfAccessEJB bean01 = getBeanRemoteInstance(
069:                        SFSBAccessInterceptorTest00.class, ItfAccessEJB.class);
070:                ItfAccessResourceManager bean02 = getBeanRemoteInstance(
071:                        SFSBAccessInterceptorTest00.class,
072:                        ItfAccessResourceManager.class);
073:                ItfAccessEntityManager bean03 = getBeanRemoteInstance(
074:                        SFSBAccessInterceptorTest00.class,
075:                        ItfAccessEntityManager.class);
076:                ItfAccessEMFactory bean04 = getBeanRemoteInstance(
077:                        SFSBAccessInterceptorTest00.class,
078:                        ItfAccessEMFactory.class);
079:                ItfAccessSessionContext bean05 = getBeanRemoteInstance(
080:                        SFSBAccessInterceptorTest00.class,
081:                        ItfAccessSessionContext.class);
082:
083:                ItfAccessSessionContext bean07 = getBeanRemoteInstance(
084:                        SFSBAccessSessionCtxInterceptor00.class,
085:                        ItfAccessSessionContext.class);
086:                ItfAccessSessionContext bean08 = getBeanRemoteInstance(
087:                        SFSBAccessSessionCtxInterceptor01.class,
088:                        ItfAccessSessionContext.class);
089:                super .setBeans(bean00, bean01, bean02, bean03, bean04, bean05,
090:                        null, bean07, bean08);
091:            }
092:
093:            /**
094:             * Verifies if the interceptor can access the "java:comp/env" via JNDI. This
095:             * operation is allowed, so there isn't an expected
096:             * exception.
097:             * @input -
098:             * @output no exceptions.
099:             * @throws Exception if a problem occurs.
100:             */
101:            @Override
102:            @Test(groups={"java:comp/env access"})
103:            public void testJNDI00() throws Exception {
104:                super .testJNDI00();
105:            }
106:
107:            /**
108:             * Verifies if the interceptor can access an EJB. This
109:             * operation is allowed, so there isn't an expected
110:             * exception.
111:             * @input -
112:             * @output no exceptions.
113:             * @throws Exception if a problem occurs.
114:             */
115:            @Override
116:            @Test(groups={"EJB access"})
117:            public void testEJB00() throws Exception {
118:                super .testEJB00();
119:            }
120:
121:            /**
122:             * Verifies if the interceptor can access the resource manager. This
123:             * operation is allowed, so there isn't an expected
124:             * exception.
125:             * @input -
126:             * @output no exceptions.
127:             * @throws Exception if a problem occurs.
128:             */
129:            @Override
130:            @Test(groups={"Resource access"})
131:            public void testResource00() throws Exception {
132:                super .testResource00();
133:            }
134:
135:            /**
136:             * Verifies if the interceptor can access the entity manager. This
137:             * operation is allowed, so there isn't an expected
138:             * exception.
139:             * @input -
140:             * @output no exceptions.
141:             * @throws Exception if a problem occurs.
142:             */
143:            @Override
144:            @Test(groups={"Entity Manager access"})
145:            public void testEntityManager00() throws Exception {
146:                super .testEntityManager00();
147:            }
148:
149:            /**
150:             * Verifies if the interceptor can access the entity factory. This
151:             * operation is allowed, so there isn't an expected
152:             * exception.
153:             * @input -
154:             * @output no exceptions.
155:             * @throws Exception if a problem occurs.
156:             */
157:            @Override
158:            @Test(groups={"Entity Factory access"})
159:            public void testEntityFactory00() throws Exception {
160:                super .testEntityFactory00();
161:            }
162:
163:            /**
164:             * Verifies if the interceptor can access the session context. This
165:             * operation is allowed, so there isn't an expected
166:             * exception.
167:             * @input -
168:             * @output no exceptions.
169:             * @throws Exception if a problem occurs.
170:             */
171:            @Override
172:            @Test(groups={"SessionContext access"})
173:            public void testSessionContext00() throws Exception {
174:                super .testSessionContext00();
175:            }
176:
177:            /**
178:             * Verifies if an interceptor can access the "getTimerService()" of a SessionContext instance.
179:             * The specification defines that if a bean instance attempts to invoke a method and that access is not allowed, the container
180:             * must throw the java.lang.IllegalStateException.
181:             * @input -
182:             * @output javax.ejb.EJBException with a java.lang.IllegalStateException as cause.
183:             */
184:            @Override
185:            @Test(groups={"SessionContext access"})
186:            public void testSessionContext01() {
187:                try {
188:                    super .testSessionContext01();
189:                } catch (Exception e) {
190:                    checkCause(e, IllegalStateException.class);
191:                }
192:            }
193:
194:            /**
195:             * Verifies if an interceptor can access the "getUserTransaction()" of a SessionContext instance.
196:             * The specification defines that if a bean instance attempts to invoke a method and that access is not allowed, the container
197:             * must throw the java.lang.IllegalStateException.
198:             * @input -
199:             * @output javax.ejb.EJBException with a java.lang.IllegalStateException as cause.
200:             */
201:            @Override
202:            @Test(groups={"SessionContext access"})
203:            public void testSessionContext02() {
204:                try {
205:                    super .testSessionContext02();
206:                } catch (Exception e) {
207:                    checkCause(e, IllegalStateException.class);
208:                }
209:            }
210:
211:            /**
212:             * Verifies if an interceptor can access the user transaction.
213:             * The specification denies the use of this service, the reference must be null and
214:             * an exception must be thrown.
215:             * @input -
216:             * @output CustomException00
217:             * @throws Exception if a problem occurs.
218:             */
219:            @Override
220:            @Test(groups={"UserTransaction access"},expectedExceptions=CustomException00.class)
221:            @SuppressWarnings("unused")
222:            public void testUserTransaction00() throws Exception {
223:                ItfAccessUserTransaction bean = getBeanRemoteInstance(
224:                        SFSBAccessUserTxInterceptor00.class,
225:                        ItfAccessUserTransaction.class);
226:                bean.accessUserTransaction(null);
227:            }
228:
229:        }
w___w___w.___ja__v___a__2__s._co_m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.