KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > environment > reference > resource > TestResourceRefFieldInjection


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: TestResourceRefFieldInjection.java 990 2006-07-31 13:09:09Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.environment.reference.resource;
26
27 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
28
29 import org.objectweb.easybeans.tests.common.ejbs.base.ItfCheck00;
30 import org.objectweb.easybeans.tests.common.ejbs.base.ItfResourceEnvRef00;
31 import org.objectweb.easybeans.tests.common.ejbs.stateless.beanmanaged.usertxref.SLSBBeanManagedUtxRefFieldInjection00;
32 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.resourceref.SLSBResourceRefFieldInjection00;
33 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.timersrvref.SLSBTimerSrvRefFieldInjection00;
34 import org.testng.annotations.BeforeClass;
35 import org.testng.annotations.BeforeMethod;
36 import org.testng.annotations.Test;
37
38
39 /**
40  * Verifies if the resource references injection is following the JSR 220.
41  * The items covered in this test are: 16.7, 16.12, 16.14, 16.15 and 16.19.
42  * @reference JSR 220 - EJB 3.0 Core
43  * @requirement Application Server must be running; the bean
44  * org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.resourcereference.*
45  * must be deployed.
46  * @setup gets the reference of the bean
47  * @author Eduardo Studzinski Estima de Castro
48  * @author Gisele Pinheiro Souza
49  *
50  */

51 public class TestResourceRefFieldInjection {
52
53     /**
54      * Bean used in tests.
55      */

56     private ItfResourceEnvRef00 bean;
57
58     /**
59      * Bean used in timer service tests.
60      */

61     private ItfCheck00 timerBean;
62
63     /**
64      * Bean used in user transaction tests.
65      */

66     private ItfCheck00 utxBean;
67
68     /**
69      * Gets bean instances used in the tests.
70      * @throws Exception if there is a problem with the bean initialization.
71      */

72     @BeforeMethod
73     public void startUp() throws Exception JavaDoc {
74         bean = getBeanRemoteInstance(SLSBResourceRefFieldInjection00.class, ItfResourceEnvRef00.class);
75     }
76
77     /**
78      * Gets bean instances used in the tests.
79      * @throws Exception if there is a problem with the bean initialization.
80      */

81     @BeforeClass
82     public void startUp01() throws Exception JavaDoc {
83         timerBean = getBeanRemoteInstance(SLSBTimerSrvRefFieldInjection00.class, ItfCheck00.class);
84         utxBean = getBeanRemoteInstance(SLSBBeanManagedUtxRefFieldInjection00.class, ItfCheck00.class);
85     }
86
87     /**
88      * Checks if the cotainer can:<li>inject with defined name</li>
89      * <li>inject with defined name and mapped name</li>
90      * <li>inject with defined name and shareable = true</li>
91      * <li>inject without defined name, the default name must be defined by the container.</li>
92      * <li>inject with injection-target by xml</li>
93      * <li>override the annotation injection using the xml descriptor</li>
94      */

95     @Test
96     public void testJDBC00(){
97         bean.checkJDBC();
98     }
99
100     /**
101      * Checks if the cotainer can: <li>inject with defined name</li>
102      * <li>inject without defined name, the default name must be defined by the container.</li>
103      * <li>inject with injection-target by xml</li>
104      */

105     @Test
106     public void testJMS00(){
107         bean.checkJMSConFactory();
108     }
109
110     /**
111      * Checks if the cotainer can: <li>inject with defined name.</li>
112      */

113     @Test
114     public void testJMS01(){
115         bean.checkJMSQueueConFactory();
116     }
117
118     /**
119      * Checks if the cotainer can: <li>inject with defined name.</li>
120      */

121     @Test
122     public void testJMS02(){
123         bean.checkJMSTopicConFactory();
124     }
125
126     /**
127      * Checks if the cotainer can: <li>inject with defined name.</li>
128      */

129     @Test
130     public void testJMSQueue(){
131         bean.checkJMSQueue();
132     }
133
134     /**
135      * Checks if the cotainer can: <li>inject with defined name.</li>
136      */

137     @Test
138     public void testJMTopic(){
139         bean.checkJMSTopic();
140     }
141
142     /**
143      * Checks if the cotainer can: <li>inject with defined name.</li>
144      */

145     @Test
146     public void testMail00(){
147         bean.checkMailSession();
148     }
149
150     /**
151      * Checks if the cotainer can: <li>inject with defined name.</li>
152      */

153     @Test
154     public void testUrl00(){
155         bean.checkUrl();
156     }
157
158     /**
159      * Checks if the cotainer can: <li>inject with defined name.</li>
160      */

161     @Test
162     public void testEJBContext00(){
163         bean.checkEJBContext();
164     }
165
166     /**
167      * Checks if the cotainer can:<li>inject with defined name</li>
168      * <li>inject without defined name, the default name must be defined by the container.</li>
169      */

170     @Test
171     public void testTimerService00(){
172         timerBean.check();
173     }
174
175     /**
176      * Checks if the cotainer can:<li>inject with defined name</li>
177      * <li>inject without defined name, the default name must be defined by the container.</li>
178      */

179     @Test
180     public void testUserTransaction00(){
181         utxBean.check();
182     }
183
184 }
185
Popular Tags