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: TestResourceRefDeclaration.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.SLSBBeanManagedUtxRefDeclaration00;
031: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.resourceref.SLSBResourceRefDeclaration00;
032: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.timersrvref.SLSBTimerSrvRefDeclaration00;
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 declaration 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 TestResourceRefDeclaration {
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 startUp00() throws Exception {
072: bean = getBeanRemoteInstance(
073: SLSBResourceRefDeclaration00.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: SLSBTimerSrvRefDeclaration00.class, ItfCheck00.class);
085: utxBean = getBeanRemoteInstance(
086: SLSBBeanManagedUtxRefDeclaration00.class,
087: ItfCheck00.class);
088: }
089:
090: /**
091: * Tests if a resource reference can be obtained from the environment. The
092: * resource was declared using @Resource on the bean class.
093: * @input -
094: * @output -
095: */
096: @Test
097: public void testJDBC00() {
098: bean.checkJDBC();
099: }
100:
101: /**
102: * Tests if a resource reference can be obtained from the environment. The
103: * resource was declared using @Resource on the bean class.
104: * @input -
105: * @output -
106: */
107: @Test
108: public void testJMS00() {
109: bean.checkJMSConFactory();
110: }
111:
112: /**
113: * Tests if a resource reference can be obtained from the environment. The
114: * resource was declared using @Resource on the bean class.
115: * @input -
116: * @output -
117: */
118: @Test
119: public void testJMS01() {
120: bean.checkJMSQueueConFactory();
121: }
122:
123: /**
124: * Tests if a resource reference can be obtained from the environment. The
125: * resource was declared using @Resource on the bean class.
126: * @input -
127: * @output -
128: */
129: @Test
130: public void testJMS02() {
131: bean.checkJMSTopicConFactory();
132: }
133:
134: /**
135: * Tests if a resource reference can be obtained from the environment. The
136: * resource was declared using @Resource on the bean class.
137: * @input -
138: * @output -
139: */
140: @Test
141: public void testJMSQueue() {
142: bean.checkJMSQueue();
143: }
144:
145: /**
146: * Tests if a resource reference can be obtained from the environment. The
147: * resource was declared using @Resource on the bean class.
148: * @input -
149: * @output -
150: */
151: @Test
152: public void testJMTopic() {
153: bean.checkJMSTopic();
154: }
155:
156: /**
157: * Tests if a resource reference can be obtained from the environment. The
158: * resource was declared using @Resource on the bean class.
159: * @input -
160: * @output -
161: */
162: @Test
163: public void testMail00() {
164: bean.checkMailSession();
165: }
166:
167: /**
168: * Tests if a resource reference can be obtained from the environment. The
169: * resource was declared using @Resource on the bean class.
170: * @input -
171: * @output -
172: */
173: @Test
174: public void testUrl00() {
175: bean.checkUrl();
176: }
177:
178: /**
179: * Tests if a resource reference can be obtained from the environment. The
180: * resource was declared using @Resource on the bean class.
181: * @input -
182: * @output -
183: */
184: @Test
185: public void testEJBContext00() {
186: bean.checkEJBContext();
187: }
188:
189: /**
190: * Tests if a resource reference can be obtained from the environment. The
191: * resource was declared using @Resource on the bean class.
192: * @input -
193: * @output -
194: */
195: @Test
196: public void testTimerService00() {
197: timerBean.check();
198: }
199:
200: /**
201: * Tests if a resource reference can be obtained from the environment. The
202: * resource was declared using @Resource on the bean class.
203: * @input -
204: * @output -
205: */
206: @Test
207: public void testUserTransaction00() {
208: utxBean.check();
209: }
210:
211: }
|