KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > deploymentdesc > TestOverriden00


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: TestOverriden00.java 977 2006-07-28 13:18:26Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.deploymentdesc;
26
27 import javax.naming.NamingException JavaDoc;
28 import javax.transaction.HeuristicMixedException JavaDoc;
29 import javax.transaction.HeuristicRollbackException JavaDoc;
30 import javax.transaction.NotSupportedException JavaDoc;
31 import javax.transaction.RollbackException JavaDoc;
32 import javax.transaction.SystemException JavaDoc;
33
34 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.xmldescriptor.ItfOverrideTester00;
35 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.xmldescriptor.SFSBOverrideTester00;
36 import org.objectweb.easybeans.tests.common.exception.TransactionException;
37 import org.objectweb.easybeans.tests.common.helper.EJBHelper;
38 import org.testng.annotations.BeforeMethod;
39 import org.testng.annotations.Test;
40
41 /**
42  * Verifies if the deployment descriptor overrides the bean annotation.
43  * @reference JSR 220 - FINAL RELEASE
44  * @requirement the bean SFSBOverrideTester must be deployed to make the tests,
45  * and, the SFSBSimpleBeanOverrided with the deployment descriptor
46  * must be deployed too.
47  * @setup gets an instance of the SFSBOverrideTester.
48  * @author Gisele Pinheiro Souza
49  * @author Eduardo Studzinski Estima de Castro
50  */

51 public class TestOverriden00 {
52
53     /**
54      * Bean used to verify the local access.
55      */

56     private ItfOverrideTester00 tester;
57
58     /**
59      * Creates the stateful bean used during the tests.
60      * @throws Exception if an error occurs during the lookup.
61      */

62     @BeforeMethod
63     public void setup() throws Exception JavaDoc {
64         tester = EJBHelper.getBeanRemoteInstance(SFSBOverrideTester00.class, ItfOverrideTester00.class);
65     }
66
67     /**
68      * Verifies if the injection works when the local interface and the bean
69      * name are used. The bean has a different name defined in the annotation
70      * and in the deployment descriptor,and the local interface defined in the
71      * deployment descriptor is different too. The test uses the values defined
72      * in the deployment descriptor.
73      * @input -
74      * @output the correct method execution.
75      */

76     @Test
77     public void testLocalInjection() {
78         tester.testLocalInjection();
79     }
80
81     /**
82      * Verifies if the injection works when the remotel interface and the bean
83      * name are used. The bean has a different name defined in the annotation
84      * and in the deployment descriptor,and the remote interface defined in the
85      * deployment descriptor is different too. The test uses the values defined
86      * in the deployment descriptor.
87      * @input -
88      * @output the correct method execution.
89      */

90     @Test
91     public void testRemoteInjection() {
92         tester.testRemoteInjection();
93     }
94
95     /**
96      * Verififes if the lookup works when a local interface is used. The
97      * interface defined as local in the deployment descriptor is different of
98      * the interface defined in the bean class. The test uses the values defined
99      * in the deployment descriptor.
100      * @input -
101      * @output the correct method execution.
102      * @throws Exception if a lookup error occurs.
103      */

104     @Test
105     public void testLookupLocal() throws Exception JavaDoc {
106         tester.testLookupLocal();
107     }
108
109     /**
110      * Verififes if the lookup works when a local interface is used. The
111      * interface defined as remote in the deployment descriptor is different of
112      * the interface defined in the bean class. The test uses the values defined
113      * in the deployment descriptor.
114      * @input -
115      * @output the correct method execution.
116      * @throws Exception if a lookup error occurs.
117      */

118     @Test
119     public void testLookupRemote() throws Exception JavaDoc {
120         tester.testLookupRemote();
121     }
122
123
124
125     /**
126      * Verifies if the container overrides the transaction type when a
127      * deployment descriptor is used. The transaction type defined in the bean
128      * is container managed, but the transaction type defined in the deployment
129      * descriptor is bean managed.The bean gets an instance of an user
130      * transaction. If the transaction is bean managed, the operation must not
131      * throw an exception.
132      * @input -
133      * @output the correct method execution.
134      * @throws NamingException if a lookup error occurs.
135      * @throws SystemException if an unexpected error occurs.
136      * @throws NotSupportedException if the resquest cannot be made.
137      * @throws HeuristicRollbackException if a heuristic decision was made and
138      * some relevant update was rolled back.
139      * @throws RollbackException if the transaction was rolled back instead of
140      * committed.
141      * @throws HeuristicMixedException if a heuristic decision was made and some
142      * relevant update was commited and others rolled back.
143      * @throws TransactionException if a rollback was made.
144      */

145     @Test
146     public void testTransactionType() throws IllegalStateException JavaDoc, SecurityException JavaDoc, HeuristicMixedException JavaDoc,
147             HeuristicRollbackException JavaDoc, RollbackException JavaDoc, SystemException JavaDoc, NotSupportedException JavaDoc, NamingException JavaDoc {
148         tester.testTransactionType();
149     }
150
151 }
152
Popular Tags