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