KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > transaction > containermanaged > stateful > TestExceptionHandleNotSupported


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: TestExceptionHandleNotSupported.java 980 2006-07-28 13:20:32Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.transaction.containermanaged.stateful;
26
27 import javax.ejb.EJBException JavaDoc;
28
29 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransacNotSupportedApp01;
30 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransacNotSupportedApp02;
31 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransacNotSupportedRollback;
32 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransacNotSupportedRuntime;
33 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.transaction.SFSBContainerTransactionNotSupportedApp;
34 import org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase;
35 import org.testng.annotations.BeforeMethod;
36 import org.testng.annotations.Test;
37
38 /**
39  * Verifies if the container-managed transaction in the session bean is
40  * following the JSR 220. The container must handle the different types of
41  * exception in the transaction context. The items covered in this test are:
42  * 14.3.1
43  * @reference JSR 220-FINAL RELEASE
44  * @requirement Application Server must be running; the bean .
45  * SFSBContainerTransactionNotSupportedApp,
46  * SFSBContainerTransacNotSupportedApp01,
47  * SFSBContainerTransacNotSupportedApp02
48  * SFSBContainerTransactionNotSupportedRollback and
49  * SFSBContainerTransactionNotSupportedRuntime must be deployed .
50  * @setup gets the reference of the beans , cleans the database and close all
51  * transactions.
52  * @author Gisele Pinheiro Souza
53  * @author Eduardo Studzinski Estima de Castro
54  */

55 public class TestExceptionHandleNotSupported extends TestExceptionHandleBase{
56
57     /**
58      * Creates the bean intances, closes the transactions and cleans the
59      * database.
60      * @throws Exception if an error during the bean creation occurs.
61      */

62     @BeforeMethod
63     @Override JavaDoc
64     public void setup() throws Exception JavaDoc {
65         super.setup();
66     }
67
68     /**
69      * Creates a bean that throws always an application exception that extends
70      * Exception and has the rollback element as false.
71      * @throws Exception if an error during the bean creation occurs.
72      */

73     @Override JavaDoc
74     public void createBeanApp() throws Exception JavaDoc {
75         super.createBeanApp(SFSBContainerTransactionNotSupportedApp.class);
76     }
77
78     /**
79      * Creates a bean that throws always an application exception that extends
80      * RuntimeException and has the rollback element as false.
81      * @throws Exception if an error during the bean creation occurs.
82      */

83     @Override JavaDoc
84     public void createBeanApp01() throws Exception JavaDoc {
85         super.createBeanApp01(SFSBContainerTransacNotSupportedApp01.class);
86     }
87
88     /**
89      * Creates a bean that throws always an application exception that extends
90      * RuntimeException and has the rollback element as true.
91      * @throws Exception if an error during the bean creation occurs.
92      */

93     @Override JavaDoc
94     public void createBeanApp02() throws Exception JavaDoc {
95         super.createBeanApp02(SFSBContainerTransacNotSupportedApp02.class);
96     }
97
98     /**
99      * Creates a bean that throws always an application exception that extends
100      * Exception and has the rollback element as true.
101      * @throws Exception if an error during the bean creation occurs.
102      */

103     @Override JavaDoc
104     public void createBeanRollback() throws Exception JavaDoc {
105         super.createBeanRollback(SFSBContainerTransacNotSupportedRollback.class);
106     }
107
108     /**
109      * Creates a bean that throws always aa runtime exception.
110      * @throws Exception if an error during the bean creation occurs.
111      */

112     @Override JavaDoc
113     public void createBeanRuntime() throws Exception JavaDoc {
114         super.createBeanRuntime(SFSBContainerTransacNotSupportedRuntime.class);
115     }
116
117     /**
118      * Inserts a table in an database and after throws an application exception
119      * that extends Exception and has the rollback element as false. So, the
120      * container must not rollback the transaction and must re-throw the
121      * exception.
122      * @input -
123      * @output the correct method execution.
124      * @see org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
125      * @throws Exception if an error during the tests occurs.
126      */

127     @Test(groups = {"application exception tests"})
128     @Override JavaDoc
129     public void testNotUsingClientTransWithAppException() throws Exception JavaDoc {
130         super.testNotUsingClientTransWithAppException();
131     }
132
133     /**
134      * Inserts a table in an database and after throws an application exception
135      * that extends Exception and has the rollback element as false. So, the
136      * container must not rollback the transaction and must re-throw the
137      * exception.
138      * @input -
139      * @output the correct method execution.
140      * @see org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
141      * @throws Exception if an error during the tests occurs.
142      */

143     @Test(groups = {"application rollback exception tests"})
144     @Override JavaDoc
145     public void testNotUsingClientTransWithAppRollbackException() throws Exception JavaDoc {
146         super.testNotUsingClientTransWithAppRollbackException();
147     }
148
149     /**
150      * Inserts a table in an database and after throws a runtime exception So,
151      * the container must not rollback the transaction and must throw the
152      * EJBException.
153      * @input -
154      * @output the correct method execution.
155      * @see org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
156      * @throws Exception if an error during the tests occurs.
157      */

158     @Test(groups = {"runtime exception tests"})
159     @Override JavaDoc
160     public void testNotUsingClientTransWithRuntimeException() throws Exception JavaDoc {
161         super.testNotUsingClientTransWithRuntimeException();
162     }
163
164     /**
165      * Inserts a table in an database and after throws an application exception
166      * that extends RuntimeException and has the rollback element as false. So, the
167      * container must not rollback the transaction and must re-throw the
168      * exception.
169      * @input -
170      * @output the correct method execution.
171      * @see org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
172      * @throws Exception if an error during the tests occurs.
173      */

174     @Test
175     @Override JavaDoc
176     public void testNotUsingClientTransWithAppRuntimeRollbackException() throws Exception JavaDoc{
177         super.testNotUsingClientTransWithAppRuntimeRollbackException();
178     }
179
180     /**
181      * Inserts a table in an database and after throws an application exception
182      * that extends RuntimeException and has the rollback element as true. So, the
183      * container must not rollback the transaction and must re-throw the
184      * exception.
185      * @input -
186      * @output the correct method execution.
187      * @see org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
188      * @throws Exception if an error during the tests occurs.
189      */

190     @Test
191     @Override JavaDoc
192     public void testNotUsingClientTransWithAppRuntimeException() throws Exception JavaDoc{
193         super.testNotUsingClientTransWithAppRuntimeException();
194     }
195
196     /**
197      * Inserts a table in an database and after throws an application exception
198      * that extends Exception and has the rollback element as false. This test
199      * is called with a client transaction.So, the container must not rollback
200      * the transaction and must re-throw the exception.
201      * @input -
202      * @output the correct method execution.
203      * @see org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
204      * @throws Exception if an error during the tests occurs.
205      */

206     @Override JavaDoc
207     @Test(groups = {"application exception tests"})
208     public void testUsingClientTransWithAppException() throws Exception JavaDoc {
209          super.testUsingClientTransWithAppException();
210     }
211
212     /**
213      * Inserts a table in an database and after throws an application exception
214      * that extends Exception and has the rollback element as true. This test
215      * is called with a client transaction.So, the container must not rollback
216      * the transaction and must re-throw the exception.
217      * @input -
218      * @output the correct method execution.
219      * @see org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
220      * @throws Exception if an error during the tests occurs.
221      */

222     @Test(groups = {"application rollback exception tests"})
223     public void testUsingClientTransWithAppRollbackException() throws Exception JavaDoc {
224         super.testUsingClientTransWithAppRollbackException(true);
225     }
226
227     /**
228      * Inserts a table in an database and after throws a runtime exception. This
229      * test is called with a client transaction.So, the container must not
230      * rollback the transaction and must throw the EJBException.
231      * @input -
232      * @output the correct method execution.
233      * @see org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
234      * @throws Exception if an error during the tests occurs.
235      */

236     @Test(groups = {"runtime exception tests"})
237     public void testUsingClientTransWithRuntimeException() throws Exception JavaDoc {
238         super.testUsingClientTransWithRuntimeException(EJBException JavaDoc.class, true);
239     }
240
241     /**
242      * Inserts a table in an database and after throws an application exception
243      * that extends RuntimeException and has the rollback element as true. This test
244      * is called with a client transaction.So, the container must not rollback
245      * the transaction and must re-throw the exception.
246      * @input -
247      * @output the correct method execution.
248      * @see org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
249      * @throws Exception if an error during the tests occurs.
250      */

251     @Test
252     public void testUsingClientTransWithAppRuntimeRollbackException() throws Exception JavaDoc{
253         super.testUsingClientTransWithAppRuntimeRollbackException(true);
254     }
255
256     /**
257      * Inserts a table in an database and after throws an application exception
258      * that extends RuntimeException and has the rollback element as false. This test
259      * is called with a client transaction.So, the container must not rollback
260      * the transaction and must re-throw the exception.
261      * @input -
262      * @output the correct method execution.
263      * @see org.objectweb.easybeans.tests.transaction.containermanaged.base.TestExceptionHandleBase
264      * @throws Exception if an error during the tests occurs.
265      */

266     @Override JavaDoc
267     @Test
268     public void testUsingClientTransWithAppRuntimeException() throws Exception JavaDoc{
269         super.testUsingClientTransWithAppRuntimeException();
270     }
271
272 }
273
Popular Tags