Source Code Cross Referenced for TestExceptionHandleDefault.java in  » J2EE » ow2-easybeans » org » ow2 » easybeans » tests » transaction » containermanaged » stateful » 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.transaction.containermanaged.stateful 
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: TestExceptionHandleDefault.java 1970 2007-10-16 11:49:25Z benoitf $
023:         * --------------------------------------------------------------------------
024:         */package org.ow2.easybeans.tests.transaction.containermanaged.stateful;
025:
026:        import java.sql.SQLException;
027:
028:        import javax.ejb.EJBTransactionRolledbackException;
029:
030:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransacDefaultApp01;
031:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransacDefaultApp02;
032:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransactionDefaultApp;
033:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransactionDefaultRollback;
034:        import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransactionDefaultRuntime;
035:        import org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase;
036:        import org.testng.annotations.BeforeMethod;
037:        import org.testng.annotations.Test;
038:
039:        /**
040:         * Verifies if the container-managed transaction in the session bean is
041:         * following the JSR 220. The container must handle the different types of
042:         * exception in the transaction context. The items covered in this test are:
043:         * 14.3.1
044:         * @reference JSR 220-FINAL RELEASE
045:         * @requirement Application Server must be running; the bean .
046:         *              SFSBContainerTransactionDefaultApp,
047:         *              SFSBContainerTransacDefaultApp01,
048:         *              SFSBContainerTransacDefaultApp02
049:         *              SFSBContainerTransactionDefaultRollback and
050:         *              SFSBContainerTransactionDefaultRuntime must be deployed .
051:         * @setup gets the reference of the beans , cleans the database and close all
052:         *        transactions.
053:         * @author Gisele Pinheiro Souza
054:         * @author Eduardo Studzinski Estima de Castro
055:         */
056:        public class TestExceptionHandleDefault extends TestExceptionHandleBase {
057:
058:            /**
059:             * Creates the bean intances, closes the transactions and cleans the
060:             * database.
061:             * @throws Exception if an error during the bean creation occurs.
062:             */
063:            @BeforeMethod
064:            @Override
065:            public void setup() throws Exception {
066:                super .setup();
067:            }
068:
069:            /**
070:             * Creates a bean that throws always an application exception that extends
071:             * Exception and has the rollback element as false.
072:             * @throws Exception if an error during the bean creation occurs.
073:             */
074:            @Override
075:            public void createBeanApp() throws Exception {
076:                super .createBeanApp(SFSBContainerTransactionDefaultApp.class);
077:
078:            }
079:
080:            /**
081:             * Creates a bean that throws always an application exception that extends
082:             * RuntimeException and has the rollback element as false.
083:             * @throws Exception if an error during the bean creation occurs.
084:             */
085:            @Override
086:            public void createBeanApp01() throws Exception {
087:                super .createBeanApp01(SFSBContainerTransacDefaultApp01.class);
088:            }
089:
090:            /**
091:             * Creates a bean that throws always an application exception that extends
092:             * RuntimeException and has the rollback element as true.
093:             * @throws Exception if an error during the bean creation occurs.
094:             */
095:            @Override
096:            public void createBeanApp02() throws Exception {
097:                super .createBeanApp02(SFSBContainerTransacDefaultApp02.class);
098:            }
099:
100:            /**
101:             * Creates a bean that throws always an application exception that extends
102:             * Exception and has the rollback element as true.
103:             * @throws Exception if an error during the bean creation occurs.
104:             */
105:            @Override
106:            public void createBeanRollback() throws Exception {
107:                super 
108:                        .createBeanRollback(SFSBContainerTransactionDefaultRollback.class);
109:            }
110:
111:            /**
112:             * Creates a bean that throws always aa runtime exception.
113:             * @throws Exception if an error during the bean creation occurs.
114:             */
115:            @Override
116:            public void createBeanRuntime() throws Exception {
117:                super 
118:                        .createBeanRuntime(SFSBContainerTransactionDefaultRuntime.class);
119:            }
120:
121:            /**
122:             * Inserts a table in an database and after throws an application exception
123:             * that extends Exception and has the rollback element as false. So, the
124:             * container must not rollback the transaction and must re-throw the
125:             * exception.
126:             * @input -
127:             * @output the correct method execution.
128:             * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
129:             * @throws Exception if an error during the tests occurs.
130:             */
131:            @Test(groups={"application exception tests"})
132:            @Override
133:            public void testNotUsingClientTransWithAppException()
134:                    throws Exception {
135:                super .testNotUsingClientTransWithAppException();
136:            }
137:
138:            /**
139:             * Inserts a table in an database and after throws an application exception
140:             * that extends Exception and has the rollback element as true. So, the
141:             * container must rollback the transaction and must re-throw the exception.
142:             * @input -
143:             * @output the exception when the test makes a select in the database to
144:             *         find the table created.
145:             * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
146:             * @throws Exception if an error during the tests occurs.
147:             */
148:            @Test(groups={"application rollback exception tests"},expectedExceptions=SQLException.class)
149:            @Override
150:            public void testNotUsingClientTransWithAppRollbackException()
151:                    throws Exception {
152:                super .testNotUsingClientTransWithAppRollbackException();
153:            }
154:
155:            /**
156:             * Inserts a table in an database and after throws a runtime exception. So,
157:             * the container must rollback the transaction, discards the bean and throws
158:             * an EJBException.
159:             * @input -
160:             * @output the exception when the test makes a select in the database to
161:             *         find the table created.
162:             * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
163:             * @throws Exception if an error during the tests occurs.
164:             */
165:            @Test(groups={"runtime exception tests"},expectedExceptions=SQLException.class)
166:            @Override
167:            public void testNotUsingClientTransWithRuntimeException()
168:                    throws Exception {
169:                super .testNotUsingClientTransWithRuntimeException();
170:            }
171:
172:            /**
173:             * Inserts a table in an database and after throws an application exception
174:             * that extends RuntimeException and has the rollback element as false. So,
175:             * the container must not rollback the transaction and must re-throw the
176:             * exception.
177:             * @input -
178:             * @output the correct method execution.
179:             * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
180:             * @throws Exception if an error during the tests occurs.
181:             */
182:            @Test
183:            @Override
184:            public void testNotUsingClientTransWithAppRuntimeException()
185:                    throws Exception {
186:                super .testNotUsingClientTransWithAppRuntimeException();
187:            }
188:
189:            /**
190:             * Inserts a table in an database and after throws an application exception
191:             * that extends RuntimeException and has the rollback element as true. So,
192:             * the container must rollback the transaction and must re-throw the
193:             * exception.
194:             * @input -
195:             * @output the exception when the test makes a select in the database to
196:             *         find the table created.
197:             * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
198:             * @throws Exception if an error during the tests occurs.
199:             */
200:            @Test(expectedExceptions=SQLException.class)
201:            @Override
202:            public void testNotUsingClientTransWithAppRuntimeRollbackException()
203:                    throws Exception {
204:                super .testNotUsingClientTransWithAppRuntimeRollbackException();
205:            }
206:
207:            /**
208:             * Inserts a table in an database and after throws an application exception
209:             * that extends Exception and has the rollback element as false. The test
210:             * uses the client transaction, so, the container must not mark the client
211:             * transaction for rollback and must re-throw the exception.
212:             * @input -
213:             * @output the correct method execution.
214:             * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
215:             * @throws Exception if an error during the tests occurs.
216:             */
217:            @Override
218:            @Test(groups={"application exception tests"})
219:            public void testUsingClientTransWithAppException() throws Exception {
220:                super .testUsingClientTransWithAppException();
221:            }
222:
223:            /**
224:             * Inserts a table in an database and after throws an application exception
225:             * that extends Exception and has the rollback element as true. The test
226:             * uses the client transaction, so, the container must mark the client
227:             * transaction for rollback and must re-throw the exception.
228:             * @input - *
229:             * @output the exception when the test makes a select in the database to
230:             *         find the table created.
231:             * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
232:             * @throws Exception if an error during the tests occurs.
233:             */
234:            @Test(groups={"application rollback exception tests"},expectedExceptions=SQLException.class)
235:            public void tesUsingClientTransWithAppRollbackException()
236:                    throws Exception {
237:                super .testUsingClientTransWithAppRollbackException(false);
238:            }
239:
240:            /**
241:             * Inserts a table in an database and after throws an application exception
242:             * that extends RuntimeException and has the rollback element as false. The
243:             * test uses the client transaction, so, the container must not mark the
244:             * client transaction for rollback and must re-throw the exception.
245:             * @input -
246:             * @output the correct method execution.
247:             * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
248:             * @throws Exception if an error during the tests occurs.
249:             */
250:            @Test(groups={"runtime exception tests"})
251:            public void testUsingClientTransWithRuntimeException()
252:                    throws Exception {
253:                super .testUsingClientTransWithRuntimeException(
254:                        EJBTransactionRolledbackException.class, false);
255:            }
256:
257:            /**
258:             * Inserts a table in an database and after throws an application exception
259:             * that extends RuntimeException and has the rollback element as false. The
260:             * test uses the client transaction, so, the container must not mark the
261:             * client transaction for rollback and must re-throw the exception.
262:             * @input -
263:             * @output the correct method execution.
264:             * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
265:             * @throws Exception if an error during the tests occurs.
266:             */
267:            @Override
268:            @Test
269:            public void testUsingClientTransWithAppRuntimeException()
270:                    throws Exception {
271:                super .testUsingClientTransWithAppRuntimeException();
272:            }
273:
274:            /**
275:             * Inserts a table in an database and after throws an application exception
276:             * that extends RuntimeException and has the rollback element as false. The
277:             * test uses the client transaction, so, the container must not mark the
278:             * client transaction for rollback and must re-throw the exception.
279:             * @input -
280:             * @output the correct method execution.
281:             * @see org.ow2.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
282:             * @throws Exception if an error during the tests occurs.
283:             */
284:            @Test(expectedExceptions=SQLException.class)
285:            public void testUsingClientTransWithAppRuntimeRollbackException()
286:                    throws Exception {
287:                super 
288:                        .testUsingClientTransWithAppRuntimeRollbackException(false);
289:            }
290:
291:        }
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.