KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > stateful > containermanaged > xmldescriptor > SFSBOverrideTester00


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: SFSBOverrideTester00.java 956 2006-07-27 07:15:49Z pinheirg $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.xmldescriptor;
26
27 import javax.ejb.EJB JavaDoc;
28 import javax.ejb.Remote JavaDoc;
29 import javax.ejb.Stateful JavaDoc;
30 import javax.naming.NamingException JavaDoc;
31 import javax.transaction.HeuristicMixedException JavaDoc;
32 import javax.transaction.HeuristicRollbackException JavaDoc;
33 import javax.transaction.NotSupportedException JavaDoc;
34 import javax.transaction.RollbackException JavaDoc;
35 import javax.transaction.SystemException JavaDoc;
36
37 import org.objectweb.easybeans.tests.common.exception.TransactionException;
38 import org.objectweb.easybeans.tests.common.helper.EJBHelper;
39
40 /**
41  * Verifies if the container overrides the annotation by the deployment
42  * descriptor.
43  * @author Gisele Pinheiro Souza
44  * @author Eduardo Studzinski Estima de Castro
45  */

46 @Stateful JavaDoc
47 @Remote JavaDoc(ItfOverrideTester00.class)
48 public class SFSBOverrideTester00 implements ItfOverrideTester00 {
49
50     /**
51      * Bean injected by the ejb name defined in the deployment descriptor.
52      */

53     @EJB JavaDoc(beanName = "SLSBSimpleBeanOverrideLocal")
54     private ItfSimpleBeanOverridedLocal bean1;
55
56     /**
57      * Bean injected by the ejb name defined in the deployment descriptor.
58      */

59     @EJB JavaDoc(beanName = "SLSBSimpleBeanOverrideLocal")
60     private ItfSimpleBeanOverridedRemote bean2;
61
62     /**
63      * Verifies if the bean was injected correctly. The local interface is used.
64      */

65     public void testLocalInjection() {
66         bean1.toString();
67     }
68
69     /**
70      * Verifies if the bean was injected correctly. The remote interface is
71      * used.
72      */

73     public void testRemoteInjection() {
74         bean2.toString();
75     }
76
77     /**
78      * Verifies if the bean(with the local interface) can be obtained by the
79      * lookup.
80      * @throws Exception if a lookup error occurs.
81      */

82     public void testLookupLocal() throws Exception JavaDoc {
83         ItfSimpleBeanOverridedLocal bean = EJBHelper.getBeanLocalInstance(SFSBSimpleBeanOverrided.class,
84                 ItfSimpleBeanOverridedLocal.class);
85         bean.toString();
86     }
87
88     /**
89      * Verifies if the bean(with the remote interface) can be obtained by the
90      * lookup.
91      * @throws Exception if a lookup error occurs.
92      */

93     public void testLookupRemote() throws Exception JavaDoc {
94         ItfSimpleBeanOverridedRemote bean = EJBHelper.getBeanRemoteInstance(SFSBSimpleBeanOverrided.class,
95                 ItfSimpleBeanOverridedRemote.class);
96         bean.toString();
97     }
98
99     /**
100      * Verifies if the transaction type was overriden by the container. The bean
101      * has the transaction management defined as Container and the xml
102      * descriptor defines the transaction management as bean.
103      * @throws NamingException if a lookup error occurs.
104      * @throws SystemException if an unexpected error occurs.
105      * @throws NotSupportedException if the resquest cannot be made.
106      * @throws HeuristicRollbackException if a heuristic decision was made and
107      * some relevant update was rolled back.
108      * @throws RollbackException if the transaction was rolled back instead of
109      * committed.
110      * @throws HeuristicMixedException if a heuristic decision was made and some
111      * relevant update was commited and others rolled back.
112      * @throws TransactionException if a rollback was made.
113      */

114     public void testTransactionType() throws IllegalStateException JavaDoc, SecurityException JavaDoc, HeuristicMixedException JavaDoc,
115             HeuristicRollbackException JavaDoc, RollbackException JavaDoc, SystemException JavaDoc, NotSupportedException JavaDoc, NamingException JavaDoc {
116         bean1.verifyBMT();
117         bean2.verifyBMT();
118     }
119
120 }
121
Popular Tags