KickJava   Java API By Example, From Geeks To Geeks.

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


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: TestResourceRefMethodInjection.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.SLSBBeanManagedUtxRefMethodInjection00;
32 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.resourceref.SLSBResourceRefMethodInjection00;
33 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.timersrvref.SLSBTimerSrvRefMethodInjection00;
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 TestResourceRefMethodInjection {
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(SLSBResourceRefMethodInjection00.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(SLSBTimerSrvRefMethodInjection00.class, ItfCheck00.class);
84         utxBean = getBeanRemoteInstance(SLSBBeanManagedUtxRefMethodInjection00.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      */

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

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

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

118     @Test
119     public void testJMSQueue(){
120         bean.checkJMSQueue();
121     }
122
123     /**
124      * Checks if the cotainer can: <li>inject with defined name.</li>
125      */

126     @Test
127     public void testJMSTopic(){
128         bean.checkJMSTopic();
129     }
130
131     /**
132      * Checks if the cotainer can: <li>inject with defined name.</li>
133      */

134     @Test
135     public void testJMS02(){
136         bean.checkJMSTopicConFactory();
137     }
138
139     /**
140      * Checks if the cotainer can: <li>inject with defined name.</li>
141      */

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

150     @Test
151     public void testUrl00(){
152         bean.checkUrl();
153     }
154
155     /**
156      * Checks if the cotainer can inject a reference.
157      */

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

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

176     @Test
177     public void testUserTransaction00(){
178         utxBean.check();
179     }
180 }
181
Popular Tags