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: TestEJBRefFieldInjection.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.environment.reference.ejb;
025:
026: import static org.ow2.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
027:
028: import org.ow2.easybeans.tests.common.ejbs.base.ItfEJBInjection;
029: import org.ow2.easybeans.tests.common.ejbs.base.ItfEJBRef;
030: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.ejbref.SLSBEjbRefFieldInjection;
031: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.ejbref.SLSBEjbRefXML;
032: import org.testng.annotations.BeforeClass;
033: import org.testng.annotations.BeforeMethod;
034: import org.testng.annotations.Test;
035:
036: /**
037: * Verifies if the EJB references injection is following the JSR 220.
038: * @reference JSR 220 - EJB 3.0 Core - 16.5
039: * @requirement Application Server must be running; the bean
040: * org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.ejbreference.*
041: * must be deployed.
042: * @setup gets the reference of the bean
043: * @author Gisele Pinheiro Souza
044: * @author Eduardo Studzinski Estima de Castro
045: */
046: public class TestEJBRefFieldInjection {
047:
048: /**
049: * Bean used in tests.
050: */
051: private ItfEJBRef bean;
052:
053: /**
054: * Bean used in tests.
055: */
056: private ItfEJBInjection beanInjectionByDescriptor;
057:
058: /**
059: * Gets bean instances used in the tests.
060: * @throws Exception if there is a problem with the bean initialization.
061: */
062: @BeforeMethod
063: public void startUp() throws Exception {
064: bean = getBeanRemoteInstance(SLSBEjbRefFieldInjection.class,
065: ItfEJBRef.class);
066: }
067:
068: /**
069: * Gets bean instances used in the tests.
070: * @throws Exception if there is a problem with the bean initialization.
071: */
072: @BeforeClass
073: public void startUpInjection() throws Exception {
074: beanInjectionByDescriptor = getBeanRemoteInstance(
075: SLSBEjbRefXML.class, ItfEJBInjection.class);
076: }
077:
078: /**
079: * Checks if the annotation @EJB is working properly. The annotation's
080: * properties are not used.
081: */
082: @Test
083: public void test00() {
084: bean.check00();
085: }
086:
087: /**
088: * Checks if the annotation @EJB is working properly. The following
089: * properties are used: <li>name</li><li>description</li>
090: */
091: @Test
092: public void test01() {
093: bean.check01();
094: }
095:
096: /**
097: * Checks if the annotation @EJB is working properly. The following
098: * property is used: <li>beanInterface</li>
099: */
100: @Test
101: public void test02() {
102: bean.check02();
103: }
104:
105: /**
106: * Checks if the annotation @EJB is working properly. The following
107: * property is used: <li>beanName</li>
108: */
109: @Test
110: public void test03() {
111: bean.check03();
112: }
113:
114: /**
115: * Checks if the annotation @EJB is working properly. The following
116: * property is used: <li>mappedName</li>
117: */
118: @Test
119: public void test04() {
120: bean.check04();
121: }
122:
123: /**
124: * Checks if the annotation @EJB is working properly. The following
125: * properties are used: <li>name</li> <li>beanInterface</li><li>beanName</li><li>description</li>
126: */
127: @Test
128: public void test05() {
129: bean.check05();
130: }
131:
132: /**
133: * Checks if the annotation @EJB is working properly. The following
134: * properties are used: <li>name</li> <li>beanInterface</li><li>beanName</li><li>description</li><li>mappedName</li>
135: */
136: @Test
137: public void test06() {
138: bean.check06();
139: }
140:
141: /**
142: * Tests if injection by deployment descriptor using injection-target tag is working properly.
143: * @input -
144: * @output -
145: */
146: @Test
147: public void testInjectionByDeploymentDescriptor00() {
148: beanInjectionByDescriptor.checkInjection();
149: }
150: }
|