Source Code Cross Referenced for TestSFCallbackAccess00.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » tests » interceptors » lifecycle » 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.lifecycle.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: TestSFCallbackAccess00.java 1970 2007-10-16 11:49:25Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.tests.interceptors.lifecycle.stateful.containermanaged;
025:
026:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.POST_CONSTRUCT;
027:        import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.PRE_DESTROY;
028:        import static org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess.SLEEP;
029:        import static org.ow2.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
030:
031:        import java.util.ArrayList;
032:        import java.util.List;
033:
034:        import org.ow2.easybeans.tests.common.ejbs.base.ItfCheck02;
035:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.lifecallback.SFSBExternalCallbackAccess00;
036:        import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess;
037:        import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.SLSBCallbackLoggerAccess;
038:        import org.ow2.easybeans.tests.common.interceptors.lifecycle.misc.AllLifeCallbackEJBAccess00;
039:        import org.ow2.easybeans.tests.common.interceptors.lifecycle.misc.AllLifeCallbackEMFactoryAccess00;
040:        import org.ow2.easybeans.tests.common.interceptors.lifecycle.misc.AllLifeCallbackEntityManagerAccess00;
041:        import org.ow2.easybeans.tests.common.interceptors.lifecycle.misc.AllLifeCallbackJEnvCompAccess00;
042:        import org.ow2.easybeans.tests.common.interceptors.lifecycle.misc.AllLifeCallbackResourceManagerAccess00;
043:        import org.ow2.easybeans.tests.common.interceptors.lifecycle.misc.AllLifeCallbackSessionContextAccess00;
044:        import org.testng.annotations.AfterMethod;
045:        import org.testng.annotations.BeforeMethod;
046:        import org.testng.annotations.Test;
047:
048:        /**
049:         * Verifies if interceptors methods for lifecycle callbacks can perform the operations
050:         * allowed by the specification.
051:         * @reference JSR 220-PROPOSED FINAL - Table 2
052:         * @requirement Application Server must be running; the beans
053:         *              org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.lifecallback.*
054:         *              must be deployed.
055:         *              (Ant task: install.jar.tests.interceptor.lifecycle)
056:         * @author Eduardo Studzinski Estima de Castro
057:         * @author Gisele Pinheiro Souza
058:         */
059:        public class TestSFCallbackAccess00 {
060:
061:            /**
062:             * Bean.
063:             */
064:            private ItfCheck02 bean;
065:
066:            /**
067:             * Logger bean.
068:             */
069:            private ItfCallbackLoggerAccess beanLogger;
070:
071:            /**
072:             * Gets bean instances used in the tests.
073:             * @throws Exception if there is a problem with the bean initialization.
074:             */
075:            @BeforeMethod
076:            public void startUp() throws Exception {
077:                bean = getBeanRemoteInstance(
078:                        SFSBExternalCallbackAccess00.class, ItfCheck02.class);
079:                beanLogger = getBeanRemoteInstance(
080:                        SLSBCallbackLoggerAccess.class,
081:                        ItfCallbackLoggerAccess.class);
082:                beanLogger.deleteAll();
083:            }
084:
085:            /**
086:             * Verifies PostConstruct lifecycle callback interceptor method operations.
087:             * The following operations are tested:
088:             * <li>EJB</li>
089:             * <li>SessionContext</li>
090:             * <li>JNDI</li>
091:             * <li>ResourceManager</li>
092:             * <li>EntityManagerFactory</li>
093:             * <li>EntityManager</li>
094:             * @input -
095:             * @output -
096:             * @throws Exception if a problem occurs.
097:             */
098:            @Test
099:            public void test00() throws Exception {
100:                bean.check();
101:
102:                /*TODO: review after PostConstruct implementation.*/
103:
104:                //Interceptors list
105:                List<String> arLife = new ArrayList<String>();
106:
107:                arLife.add(AllLifeCallbackEJBAccess00.class.getName());
108:                arLife.add(AllLifeCallbackSessionContextAccess00.class
109:                        .getName());
110:                arLife.add(AllLifeCallbackJEnvCompAccess00.class.getName());
111:                arLife.add(AllLifeCallbackResourceManagerAccess00.class
112:                        .getName());
113:                arLife.add(AllLifeCallbackEMFactoryAccess00.class.getName());
114:                arLife
115:                        .add(AllLifeCallbackEntityManagerAccess00.class
116:                                .getName());
117:
118:                beanLogger.verifyCallbackOrder(
119:                        SFSBExternalCallbackAccess00.class, POST_CONSTRUCT,
120:                        arLife.toArray(new String[0]));
121:            }
122:
123:            /**
124:             * Verifies PreDestroy lifecycle callback interceptor method operations.
125:             * The following operations are tested:
126:             * <li>EJB</li>
127:             * <li>SessionContext</li>
128:             * <li>JNDI</li>
129:             * <li>ResourceManager</li>
130:             * <li>EntityManagerFactory</li>
131:             * <li>EntityManager</li>
132:             * @input -
133:             * @output -
134:             * @throws Exception if a problem occurs.
135:             */
136:            @Test
137:            public void test01() throws Exception {
138:                bean.check();
139:                bean.remove();
140:
141:                //Sleep used to wait all interceptors execution
142:                Thread.sleep(SLEEP);
143:
144:                /*TODO: review after PreDestroy implementation.*/
145:
146:                //Interceptors list
147:                List<String> arLife = new ArrayList<String>();
148:
149:                arLife.add(AllLifeCallbackEJBAccess00.class.getName());
150:                arLife.add(AllLifeCallbackSessionContextAccess00.class
151:                        .getName());
152:                arLife.add(AllLifeCallbackJEnvCompAccess00.class.getName());
153:                arLife.add(AllLifeCallbackResourceManagerAccess00.class
154:                        .getName());
155:                arLife.add(AllLifeCallbackEMFactoryAccess00.class.getName());
156:                arLife
157:                        .add(AllLifeCallbackEntityManagerAccess00.class
158:                                .getName());
159:
160:                beanLogger.verifyCallbackOrder(
161:                        SFSBExternalCallbackAccess00.class, PRE_DESTROY, arLife
162:                                .toArray(new String[0]));
163:            }
164:
165:            /**
166:             * Clears callback event log.
167:             */
168:            @AfterMethod
169:            public void tearDown() {
170:                beanLogger.deleteAll();
171:            }
172:        }
ww__w_.j___av___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.