KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > environment > reference > ejb > TestEJBRefFieldInjection


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: TestEJBRefFieldInjection.java 978 2006-07-28 13:19:14Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.environment.reference.ejb;
26
27 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
28
29 import org.objectweb.easybeans.tests.common.ejbs.base.ItfEJBInjection;
30 import org.objectweb.easybeans.tests.common.ejbs.base.ItfEJBRef;
31 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.ejbref.SLSBEjbRefFieldInjection;
32 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.ejbref.SLSBEjbRefXML;
33 import org.testng.annotations.BeforeClass;
34 import org.testng.annotations.BeforeMethod;
35 import org.testng.annotations.Test;
36
37 /**
38  * Verifies if the EJB references injection is following the JSR 220.
39  * @reference JSR 220 - EJB 3.0 Core - 16.5
40  * @requirement Application Server must be running; the bean
41  * org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.ejbreference.*
42  * must be deployed.
43  * @setup gets the reference of the bean
44  * @author Gisele Pinheiro Souza
45  * @author Eduardo Studzinski Estima de Castro
46  */

47 public class TestEJBRefFieldInjection {
48
49     /**
50      * Bean used in tests.
51      */

52     private ItfEJBRef bean;
53
54     /**
55      * Bean used in tests.
56      */

57     private ItfEJBInjection beanInjectionByDescriptor;
58
59     /**
60      * Gets bean instances used in the tests.
61      * @throws Exception if there is a problem with the bean initialization.
62      */

63     @BeforeMethod
64     public void startUp() throws Exception JavaDoc {
65         bean = getBeanRemoteInstance(SLSBEjbRefFieldInjection.class, ItfEJBRef.class);
66     }
67
68     /**
69      * Gets bean instances used in the tests.
70      * @throws Exception if there is a problem with the bean initialization.
71      */

72     @BeforeClass
73     public void startUpInjection() throws Exception JavaDoc {
74         beanInjectionByDescriptor = getBeanRemoteInstance(SLSBEjbRefXML.class, ItfEJBInjection.class);
75     }
76
77     /**
78      * Checks if the annotation @EJB is working properly. The annotation's
79      * properties are not used.
80      */

81     @Test
82     public void test00(){
83         bean.check00();
84     }
85
86     /**
87      * Checks if the annotation @EJB is working properly. The following
88      * properties are used: <li>name</li><li>description</li>
89      */

90     @Test
91     public void test01(){
92         bean.check01();
93     }
94
95     /**
96      * Checks if the annotation &#64;EJB is working properly. The following
97      * property is used: <li>beanInterface</li>
98      */

99     @Test
100     public void test02(){
101         bean.check02();
102     }
103
104     /**
105      * Checks if the annotation &#64;EJB is working properly. The following
106      * property is used: <li>beanName</li>
107      */

108     @Test
109     public void test03(){
110         bean.check03();
111     }
112
113     /**
114      * Checks if the annotation &#64;EJB is working properly. The following
115      * property is used: <li>mappedName</li>
116      */

117     @Test
118     public void test04(){
119         bean.check04();
120     }
121
122     /**
123      * Checks if the annotation &#64;EJB is working properly. The following
124      * properties are used: <li>name</li> <li>beanInterface</li><li>beanName</li><li>description</li>
125      */

126     @Test
127     public void test05(){
128         bean.check05();
129     }
130
131     /**
132      * Checks if the annotation &#64;EJB is working properly. The following
133      * properties are used: <li>name</li> <li>beanInterface</li><li>beanName</li><li>description</li><li>mappedName</li>
134      */

135     @Test
136     public void test06(){
137         bean.check06();
138     }
139
140     /**
141      * Tests if injection by deployment descriptor using injection-target tag is working properly.
142      * @input -
143      * @output -
144      */

145     @Test
146     public void testInjectionByDeploymentDescriptor00() {
147         beanInjectionByDescriptor.checkInjection();
148     }
149 }
150
Popular Tags