001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: SLSBEjbRefMethodInjection.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.ejbref;
025:
026: import static org.ow2.easybeans.tests.common.helper.ContextHelper.checkBeanRef;
027:
028: import javax.annotation.Resource;
029: import javax.ejb.EJB;
030: import javax.ejb.Remote;
031: import javax.ejb.SessionContext;
032: import javax.ejb.Stateless;
033:
034: import org.ow2.easybeans.tests.common.ejbs.base.ItfEJBRef;
035: import org.ow2.easybeans.tests.common.ejbs.base.ItfOneMethod01;
036:
037: /**
038: * @author Eduardo Studzinski Estima de Castro
039: * @author Gisele Pinheiro Souza
040: *
041: */
042: @Stateless(name="SLSBEjbRefFieldInjection")
043: @Remote(ItfEJBRef.class)
044: public class SLSBEjbRefMethodInjection implements ItfEJBRef {
045:
046: /**
047: * SessionContext.
048: */
049: @Resource
050: private SessionContext ctx;
051:
052: /**
053: * Bean.
054: */
055: private ItfOneMethod01 bean00;
056:
057: /**
058: * Bean.
059: */
060: private ItfOneMethod01 bean01;
061:
062: /**
063: * Bean.
064: */
065: private ItfOneMethod01 bean02;
066:
067: /**
068: * Bean.
069: */
070: private ItfOneMethod01 bean03;
071:
072: /**
073: * Bean.
074: */
075: private ItfOneMethod01 bean04;
076:
077: /**
078: * Bean.
079: */
080: private ItfOneMethod01 bean05;
081:
082: /**
083: * Bean.
084: */
085: private ItfOneMethod01 bean06;
086:
087: /**
088: * Setter method.
089: * @param b bean
090: */
091: @EJB
092: public void setBean00(final ItfOneMethod01 b) {
093: bean00 = b;
094: }
095:
096: /**
097: * Setter method.
098: * @param b bean
099: */
100: @EJB(name="ejb/bean01",description="This bean is used to test name and description properties of the @EJB annotation.")
101: public void setBean01(final ItfOneMethod01 b) {
102: bean01 = b;
103: }
104:
105: /**
106: * Setter method.
107: * @param b bean
108: */
109: @EJB(beanInterface=ItfOneMethod01.class)
110: public void setBean02(final ItfOneMethod01 b) {
111: bean02 = b;
112: }
113:
114: /**
115: * Setter method.
116: * @param b bean
117: */
118: @EJB(beanName="EJBInjectionBean")
119: public void setBean03(final ItfOneMethod01 b) {
120: bean03 = b;
121: }
122:
123: /**
124: * Setter method.
125: * @param b bean
126: */
127: @EJB(mappedName="org.ow2.easybeans.tests.common.ejbs.base.EJBInjectionBean_org.ow2.easybeans.tests.common." + "ejbs.base.ItfOneMethod01@Remote")
128: public void setBean04(final ItfOneMethod01 b) {
129: bean04 = b;
130: }
131:
132: /**
133: * Setter method.
134: * @param b bean
135: */
136: @EJB(name="ejb/bean05",beanInterface=ItfOneMethod01.class,beanName="EJBInjectionBean",description="bean05")
137: public void setBean05(final ItfOneMethod01 b) {
138: bean05 = b;
139: }
140:
141: /**
142: * Setter method.
143: * @param b bean
144: */
145: @EJB(name="ejb/bean06",beanInterface=ItfOneMethod01.class,beanName="EJBInjectionBean",description="bean06",mappedName="org.ow2.easybeans.tests.common.ejbs.base.EJBInjectionBean_org.ow2.easybeans.tests.common." + "ejbs.base.ItfOneMethod01@Remote")
146: public void setBean06(final ItfOneMethod01 b) {
147: bean06 = b;
148: }
149:
150: /**
151: * Checks if the annotation @EJB is working properly. The annotation's
152: * properties are not used.
153: */
154: public void check00() {
155: assert bean00.getBool();
156: checkBeanRef(ctx,
157: "org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged."
158: + "ejbref.SLSBEjbRefMethodInjection/bean00",
159: ItfOneMethod01.class);
160: }
161:
162: /**
163: * Checks if the annotation @EJB is working properly. The following
164: * properties are used: <li>name</li><li>description</li>
165: */
166: public void check01() {
167: assert bean01.getBool();
168: checkBeanRef(ctx, "ejb/bean01", ItfOneMethod01.class);
169: }
170:
171: /**
172: * Checks if the annotation @EJB is working properly. The following
173: * property is used: <li>beanInterface</li>
174: */
175: public void check02() {
176: assert bean02.getBool();
177: checkBeanRef(ctx,
178: "org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged."
179: + "ejbref.SLSBEjbRefMethodInjection/bean02",
180: ItfOneMethod01.class);
181: }
182:
183: /**
184: * Checks if the annotation @EJB is working properly. The following
185: * property is used: <li>beanName</li>
186: */
187: public void check03() {
188: assert bean03.getBool();
189: checkBeanRef(ctx,
190: "org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged."
191: + "ejbref.SLSBEjbRefMethodInjection/bean03",
192: ItfOneMethod01.class);
193: }
194:
195: /**
196: * Checks if the annotation @EJB is working properly. The following
197: * property is used: <li>mappedName</li>
198: */
199: public void check04() {
200: assert bean04.getBool();
201: checkBeanRef(ctx,
202: "org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged."
203: + "ejbref.SLSBEjbRefMethodInjection/bean04",
204: ItfOneMethod01.class);
205: }
206:
207: /**
208: * Checks if the annotation @EJB is working properly. The following
209: * properties are used: <li>name</li> <li>beanInterface</li><li>beanName</li><li>description</li>
210: */
211: public void check05() {
212: assert bean05.getBool();
213: checkBeanRef(ctx, "ejb/bean05", ItfOneMethod01.class);
214: }
215:
216: /**
217: * Checks if the annotation @EJB is working properly. The following
218: * properties are used: <li>name</li> <li>beanInterface</li><li>beanName</li><li>description</li><li>mappedName</li>
219: */
220: public void check06() {
221: assert bean06.getBool();
222: checkBeanRef(ctx, "ejb/bean06", ItfOneMethod01.class);
223: }
224: }
|