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: TestResourceRefFieldInjection.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.environment.reference.resource;
025:
026: import static org.ow2.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
027:
028: import org.ow2.easybeans.tests.common.ejbs.base.ItfCheck00;
029: import org.ow2.easybeans.tests.common.ejbs.base.ItfResourceEnvRef00;
030: import org.ow2.easybeans.tests.common.ejbs.stateless.beanmanaged.usertxref.SLSBBeanManagedUtxRefFieldInjection00;
031: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.resourceref.SLSBResourceRefFieldInjection00;
032: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.timersrvref.SLSBTimerSrvRefFieldInjection00;
033: import org.testng.annotations.BeforeClass;
034: import org.testng.annotations.BeforeMethod;
035: import org.testng.annotations.Test;
036:
037: /**
038: * Verifies if the resource references injection is following the JSR 220.
039: * The items covered in this test are: 16.7, 16.12, 16.14, 16.15 and 16.19.
040: * @reference JSR 220 - EJB 3.0 Core
041: * @requirement Application Server must be running; the bean
042: * org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.resourcereference.*
043: * must be deployed.
044: * @setup gets the reference of the bean
045: * @author Eduardo Studzinski Estima de Castro
046: * @author Gisele Pinheiro Souza
047: *
048: */
049: public class TestResourceRefFieldInjection {
050:
051: /**
052: * Bean used in tests.
053: */
054: private ItfResourceEnvRef00 bean;
055:
056: /**
057: * Bean used in timer service tests.
058: */
059: private ItfCheck00 timerBean;
060:
061: /**
062: * Bean used in user transaction tests.
063: */
064: private ItfCheck00 utxBean;
065:
066: /**
067: * Gets bean instances used in the tests.
068: * @throws Exception if there is a problem with the bean initialization.
069: */
070: @BeforeMethod
071: public void startUp() throws Exception {
072: bean = getBeanRemoteInstance(
073: SLSBResourceRefFieldInjection00.class,
074: ItfResourceEnvRef00.class);
075: }
076:
077: /**
078: * Gets bean instances used in the tests.
079: * @throws Exception if there is a problem with the bean initialization.
080: */
081: @BeforeClass
082: public void startUp01() throws Exception {
083: timerBean = getBeanRemoteInstance(
084: SLSBTimerSrvRefFieldInjection00.class, ItfCheck00.class);
085: utxBean = getBeanRemoteInstance(
086: SLSBBeanManagedUtxRefFieldInjection00.class,
087: ItfCheck00.class);
088: }
089:
090: /**
091: * Checks if the container can:<li>inject with defined name</li>
092: * <li>inject with defined name and mapped name</li>
093: * <li>inject with defined name and shareable = true</li>
094: * <li>inject without defined name, the default name must be defined by the container.</li>
095: * <li>inject with injection-target by xml</li>
096: * <li>override the annotation injection using the xml descriptor</li>
097: */
098: @Test
099: public void testJDBC00() {
100: bean.checkJDBC();
101: }
102:
103: /**
104: * Checks if the container can: <li>inject with defined name</li>
105: * <li>inject without defined name, the default name must be defined by the container.</li>
106: * <li>inject with injection-target by xml</li>
107: */
108: @Test
109: public void testJMS00() {
110: bean.checkJMSConFactory();
111: }
112:
113: /**
114: * Checks if the container can: <li>inject with defined name.</li>
115: */
116: @Test
117: public void testJMS01() {
118: bean.checkJMSQueueConFactory();
119: }
120:
121: /**
122: * Checks if the container can: <li>inject with defined name.</li>
123: */
124: @Test
125: public void testJMS02() {
126: bean.checkJMSTopicConFactory();
127: }
128:
129: /**
130: * Checks if the container can: <li>inject with defined name.</li>
131: */
132: @Test
133: public void testJMSQueue() {
134: bean.checkJMSQueue();
135: }
136:
137: /**
138: * Checks if the container can: <li>inject with defined name.</li>
139: */
140: @Test
141: public void testJMTopic() {
142: bean.checkJMSTopic();
143: }
144:
145: /**
146: * Checks if the container can: <li>inject with defined name.</li>
147: */
148: @Test
149: public void testMail00() {
150: bean.checkMailSession();
151: }
152:
153: /**
154: * Checks if the container can: <li>inject with defined name.</li>
155: */
156: @Test
157: public void testUrl00() {
158: bean.checkUrl();
159: }
160:
161: /**
162: * Checks if the container can: <li>inject with defined name.</li>
163: */
164: @Test
165: public void testEJBContext00() {
166: bean.checkEJBContext();
167: }
168:
169: /**
170: * Checks if the container can:<li>inject with defined name</li>
171: * <li>inject without defined name, the default name must be defined by the container.</li>
172: */
173: @Test
174: public void testTimerService00() {
175: timerBean.check();
176: }
177:
178: /**
179: * Checks if the container can:<li>inject with defined name</li>
180: * <li>inject without defined name, the default name must be defined by the container.</li>
181: */
182: @Test
183: public void testUserTransaction00() {
184: utxBean.check();
185: }
186:
187: }
|