KickJava   Java API By Example, From Geeks To Geeks.

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


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: TestExceptionHandleNever.java 980 2006-07-28 13:20:32Z studzine $
23  * --------------------------------------------------------------------------
24  */

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

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

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

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

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

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

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

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

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

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

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

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

189     @Override JavaDoc
190     @Test
191     public void testNotUsingClientTransWithAppRuntimeException() throws Exception JavaDoc{
192         super.testNotUsingClientTransWithAppRuntimeException();
193     }
194 }
195
Popular Tags