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