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: SLSBResourceRefXMLInjection00.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.resourceref;
025:
026: import static org.ow2.easybeans.tests.common.helper.ContextHelper.checkResource;
027:
028: import java.net.URL;
029:
030: import javax.annotation.Resource;
031: import javax.ejb.EJBContext;
032: import javax.ejb.Remote;
033: import javax.ejb.SessionContext;
034: import javax.ejb.Stateless;
035: import javax.jms.ConnectionFactory;
036: import javax.jms.Queue;
037: import javax.jms.QueueConnectionFactory;
038: import javax.jms.Topic;
039: import javax.jms.TopicConnectionFactory;
040: import javax.mail.Session;
041: import javax.sql.DataSource;
042:
043: import org.ow2.easybeans.tests.common.ejbs.base.ItfResourceEnvRef00;
044:
045: /**
046: * This bean is used to test injection of resource references by xml descriptors with the injection-target tag.
047: * @author Eduardo Studzinski Estima de Castro
048: * @author Gisele Pinheiro Souza
049: */
050: @Stateless(name="SLSBResourceRefXMLInjection00")
051: @Remote(ItfResourceEnvRef00.class)
052: public class SLSBResourceRefXMLInjection00 implements
053: ItfResourceEnvRef00 {
054:
055: /**
056: * SessionContext.
057: */
058: @Resource
059: private SessionContext sessionContext;
060:
061: /**
062: * The reference must be injected by the container using
063: * injection-target(XML).
064: */
065: private DataSource ds00;
066:
067: /**
068: * The reference must be injected by the container using
069: * injection-target(XML).
070: */
071: private ConnectionFactory cf00;
072:
073: /**
074: * The reference must be injected by the container using
075: * injection-target(XML).
076: */
077: private QueueConnectionFactory qcf00;
078:
079: /**
080: * The reference must be injected by the container using
081: * injection-target(XML).
082: */
083: private TopicConnectionFactory tcf00;
084:
085: /**
086: * The reference must be injected by the container using
087: * injection-target(XML).
088: */
089: private Queue queue00;
090:
091: /**
092: * The reference must be injected by the container using
093: * injection-target(XML).
094: */
095: private Topic topic00;
096:
097: /**
098: * The reference must be injected by the container using
099: * injection-target(XML).
100: */
101: private Session mail00;
102:
103: /**
104: * The reference must be injected by the container using
105: * injection-target(XML).
106: */
107: private URL url00;
108:
109: /**
110: * The reference must be injected by the container using
111: * injection-target(XML).
112: */
113: private EJBContext ctx00;
114:
115: /**
116: * Checks the ejb context reference injected by xml descriptor.
117: */
118: public void checkJDBC() {
119: checkResource(sessionContext, ds00, "jdbc/ds00");
120: }
121:
122: /**
123: * Checks the ejb context reference injected by xml descriptor.
124: */
125: public void checkJMSConFactory() {
126: checkResource(sessionContext, cf00, "jms/cf00");
127:
128: }
129:
130: /**
131: * Checks the ejb context reference injected by xml descriptor.
132: */
133: public void checkJMSQueueConFactory() {
134: checkResource(sessionContext, qcf00, "jms/qcf00");
135: }
136:
137: /**
138: * Checks the ejb context reference injected by xml descriptor.
139: */
140: public void checkJMSTopicConFactory() {
141: checkResource(sessionContext, tcf00, "jms/tcf00");
142: }
143:
144: /**
145: * Checks the ejb context reference injected by xml descriptor.
146: */
147: public void checkMailSession() {
148: checkResource(sessionContext, mail00, "mail/mail00");
149: }
150:
151: /**
152: * Checks the ejb context reference injected by xml descriptor.
153: */
154: public void checkUrl() {
155: checkResource(sessionContext, url00, "url/url00");
156: }
157:
158: /**
159: * Checks the ejb context reference injected by xml descriptor.
160: */
161: public void checkEJBContext() {
162: checkResource(sessionContext, ctx00, "ejbctx/ctx00");
163: }
164:
165: /**
166: * Checks the ejb context reference injected by xml descriptor.
167: */
168: public void checkJMSQueue() {
169: checkResource(sessionContext, queue00, "jms/queue00");
170: }
171:
172: /**
173: * Checks the ejb context reference injected by xml descriptor.
174: */
175: public void checkJMSTopic() {
176: checkResource(sessionContext, topic00, "jms/topic00");
177: }
178:
179: }
|