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: TestResourceRefMethodInjection.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.SLSBBeanManagedUtxRefMethodInjection00;
031: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.resourceref.SLSBResourceRefMethodInjection00;
032: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.timersrvref.SLSBTimerSrvRefMethodInjection00;
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 TestResourceRefMethodInjection {
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: SLSBResourceRefMethodInjection00.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: SLSBTimerSrvRefMethodInjection00.class,
085: ItfCheck00.class);
086: utxBean = getBeanRemoteInstance(
087: SLSBBeanManagedUtxRefMethodInjection00.class,
088: ItfCheck00.class);
089: }
090:
091: /**
092: * Checks if the cotainer can:<li>inject with defined name</li>
093: * <li>inject with defined name and mapped name</li>
094: * <li>inject with defined name and shareable = true</li>
095: * <li>inject without defined name, the default name must be defined by the container.</li>
096: */
097: @Test
098: public void testJDBC00() {
099: bean.checkJDBC();
100: }
101:
102: /**
103: * Checks if the cotainer can: <li>inject with defined name</li>
104: * <li>inject without defined name, the default name must be defined by the container.</li>
105: */
106: @Test
107: public void testJMS00() {
108: bean.checkJMSConFactory();
109: }
110:
111: /**
112: * Checks if the cotainer can: <li>inject with defined name.</li>
113: */
114: @Test
115: public void testJMS01() {
116: bean.checkJMSQueueConFactory();
117: }
118:
119: /**
120: * Checks if the cotainer can: <li>inject with defined name.</li>
121: */
122: @Test
123: public void testJMSQueue() {
124: bean.checkJMSQueue();
125: }
126:
127: /**
128: * Checks if the cotainer can: <li>inject with defined name.</li>
129: */
130: @Test
131: public void testJMSTopic() {
132: bean.checkJMSTopic();
133: }
134:
135: /**
136: * Checks if the cotainer can: <li>inject with defined name.</li>
137: */
138: @Test
139: public void testJMS02() {
140: bean.checkJMSTopicConFactory();
141: }
142:
143: /**
144: * Checks if the cotainer can: <li>inject with defined name.</li>
145: */
146: @Test
147: public void testMail00() {
148: bean.checkMailSession();
149: }
150:
151: /**
152: * Checks if the cotainer can: <li>inject with defined name.</li>
153: */
154: @Test
155: public void testUrl00() {
156: bean.checkUrl();
157: }
158:
159: /**
160: * Checks if the cotainer can inject a reference.
161: */
162: @Test
163: public void testEJBContext00() {
164: bean.checkEJBContext();
165: }
166:
167: /**
168: * Checks if the cotainer can:<li>inject with defined name</li>
169: * <li>inject without defined name, the default name must be defined by the container.</li>
170: */
171: @Test
172: public void testTimerService00() {
173: timerBean.check();
174: }
175:
176: /**
177: * Checks if the cotainer can:<li>inject with defined name</li>
178: * <li>inject without defined name, the default name must be defined by the container.</li>
179: */
180: @Test
181: public void testUserTransaction00() {
182: utxBean.check();
183: }
184: }
|