KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > common > ejbs > stateless > containermanaged > ejbref > SLSBEjbRefFieldInjection


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: SLSBEjbRefFieldInjection.java 434 2006-05-09 12:48:37Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.ejbref;
26
27 import static org.objectweb.easybeans.tests.common.helper.ContextHelper.checkBeanRef;
28
29 import javax.annotation.Resource;
30 import javax.ejb.EJB JavaDoc;
31 import javax.ejb.Remote JavaDoc;
32 import javax.ejb.SessionContext JavaDoc;
33 import javax.ejb.Stateless JavaDoc;
34
35 import org.objectweb.easybeans.tests.common.ejbs.base.ItfEJBRef;
36 import org.objectweb.easybeans.tests.common.ejbs.base.ItfOneMethod01;
37
38 /**
39  * This bean is used to test injection of enterprise beans.
40  * @author Eduardo Studzinski Estima de Castro
41  * @author Gisele Pinheiro Souza
42  */

43 @Stateless JavaDoc(name = "SLSBEjbRefFieldInjection")
44 @Remote JavaDoc(ItfEJBRef.class)
45 public class SLSBEjbRefFieldInjection implements ItfEJBRef {
46
47     /**
48      * SessionContext.
49      */

50     @Resource
51     private SessionContext JavaDoc ctx;
52
53     /**
54      * Bean.
55      */

56     @EJB JavaDoc
57     private ItfOneMethod01 bean00;
58
59     /**
60      * Bean.
61      */

62     @EJB JavaDoc(name = "ejb/bean01", description = "This bean is used to test name and description properties of the @EJB annotation.")
63     private ItfOneMethod01 bean01;
64
65     /**
66      * Bean.
67      */

68     @EJB JavaDoc(beanInterface = ItfOneMethod01.class)
69     private ItfOneMethod01 bean02;
70
71     /**
72      * Bean.
73      */

74     @EJB JavaDoc(beanName = "EJBInjectionBean")
75     private ItfOneMethod01 bean03;
76
77     /**
78      * Bean.
79      */

80     @EJB JavaDoc(mappedName = "org.objectweb.easybeans.tests.common.ejbs.base.EJBInjectionBean_org.objectweb.easybeans.tests.common."
81             + "ejbs.base.ItfOneMethod01@Remote")
82     private ItfOneMethod01 bean04;
83
84     /**
85      * Bean.
86      */

87     @EJB JavaDoc(name = "ejb/bean05", beanInterface = ItfOneMethod01.class, beanName = "EJBInjectionBean", description = "bean05")
88     private ItfOneMethod01 bean05;
89
90     /**
91      * Bean.
92      */

93     @EJB JavaDoc(name = "ejb/bean06", beanInterface = ItfOneMethod01.class, beanName = "EJBInjectionBean", description = "bean06",
94             mappedName = "org.objectweb.easybeans.tests.common.ejbs.base.EJBInjectionBean_org.objectweb.easybeans.tests.common."
95             + "ejbs.base.ItfOneMethod01@Remote")
96     private ItfOneMethod01 bean06;
97
98     /**
99      * Checks if the annotation @EJB is working properly. The annotation's
100      * properties are not used.
101      */

102     public void check00() {
103         assert bean00.getBool();
104         checkBeanRef(ctx,
105                 "org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged."
106                 + "ejbref.SLSBEjbRefFieldInjection/bean00", ItfOneMethod01.class);
107     }
108
109     /**
110      * Checks if the annotation @EJB is working properly. The following
111      * properties are used: <li>name</li><li>description</li>
112      */

113     public void check01() {
114         assert bean01.getBool();
115         checkBeanRef(ctx, "ejb/bean01", ItfOneMethod01.class);
116     }
117
118     /**
119      * Checks if the annotation &#64;EJB is working properly. The following
120      * property is used: <li>beanInterface</li>
121      */

122     public void check02() {
123         assert bean02.getBool();
124         checkBeanRef(ctx,
125                 "org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged."
126                 + "ejbref.SLSBEjbRefFieldInjection/bean02", ItfOneMethod01.class);
127     }
128
129     /**
130      * Checks if the annotation &#64;EJB is working properly. The following
131      * property is used: <li>beanName</li>
132      */

133     public void check03() {
134         assert bean03.getBool();
135         checkBeanRef(ctx,
136                 "org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged."
137                 + "ejbref.SLSBEjbRefFieldInjection/bean03", ItfOneMethod01.class);
138     }
139
140     /**
141      * Checks if the annotation &#64;EJB is working properly. The following
142      * property is used: <li>mappedName</li>
143      */

144     public void check04() {
145         assert bean04.getBool();
146         checkBeanRef(ctx,
147                 "org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged."
148                 + "ejbref.SLSBEjbRefFieldInjection/bean04", ItfOneMethod01.class);
149     }
150
151     /**
152      * Checks if the annotation &#64;EJB is working properly. The following
153      * properties are used: <li>name</li> <li>beanInterface</li><li>beanName</li><li>description</li>
154      */

155     public void check05() {
156         assert bean05.getBool();
157         checkBeanRef(ctx, "ejb/bean05", ItfOneMethod01.class);
158     }
159
160     /**
161      * Checks if the annotation &#64;EJB is working properly. The following
162      * properties are used: <li>name</li> <li>beanInterface</li><li>beanName</li><li>description</li><li>mappedName</li>
163      */

164     public void check06() {
165         assert bean06.getBool();
166         checkBeanRef(ctx, "ejb/bean06", ItfOneMethod01.class);
167     }
168 }
169
Popular Tags