KickJava   Java API By Example, From Geeks To Geeks.

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


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: TestResourceRefDeclaration.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.SLSBBeanManagedUtxRefDeclaration00;
32 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.resourceref.SLSBResourceRefDeclaration00;
33 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.timersrvref.SLSBTimerSrvRefDeclaration00;
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 declaration 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 TestResourceRefDeclaration {
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 startUp00() throws Exception JavaDoc {
74         bean = getBeanRemoteInstance(SLSBResourceRefDeclaration00.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(SLSBTimerSrvRefDeclaration00.class, ItfCheck00.class);
84         utxBean = getBeanRemoteInstance(SLSBBeanManagedUtxRefDeclaration00.class, ItfCheck00.class);
85     }
86
87     /**
88      * Tests if a resource reference can be obtained from the environment. The
89      * resource was declared using @Resource on the bean class.
90      * @input -
91      * @output -
92      */

93     @Test
94     public void testJDBC00(){
95         bean.checkJDBC();
96     }
97
98     /**
99      * Tests if a resource reference can be obtained from the environment. The
100      * resource was declared using @Resource on the bean class.
101      * @input -
102      * @output -
103      */

104     @Test
105     public void testJMS00(){
106         bean.checkJMSConFactory();
107     }
108
109     /**
110      * Tests if a resource reference can be obtained from the environment. The
111      * resource was declared using @Resource on the bean class.
112      * @input -
113      * @output -
114      */

115     @Test
116     public void testJMS01(){
117         bean.checkJMSQueueConFactory();
118     }
119
120     /**
121      * Tests if a resource reference can be obtained from the environment. The
122      * resource was declared using @Resource on the bean class.
123      * @input -
124      * @output -
125      */

126     @Test
127     public void testJMS02(){
128         bean.checkJMSTopicConFactory();
129     }
130
131     /**
132      * Tests if a resource reference can be obtained from the environment. The
133      * resource was declared using @Resource on the bean class.
134      * @input -
135      * @output -
136      */

137     @Test
138     public void testJMSQueue(){
139         bean.checkJMSQueue();
140     }
141
142     /**
143      * Tests if a resource reference can be obtained from the environment. The
144      * resource was declared using @Resource on the bean class.
145      * @input -
146      * @output -
147      */

148     @Test
149     public void testJMTopic(){
150         bean.checkJMSTopic();
151     }
152
153     /**
154      * Tests if a resource reference can be obtained from the environment. The
155      * resource was declared using @Resource on the bean class.
156      * @input -
157      * @output -
158      */

159     @Test
160     public void testMail00(){
161         bean.checkMailSession();
162     }
163
164     /**
165      * Tests if a resource reference can be obtained from the environment. The
166      * resource was declared using @Resource on the bean class.
167      * @input -
168      * @output -
169      */

170     @Test
171     public void testUrl00(){
172         bean.checkUrl();
173     }
174
175     /**
176      * Tests if a resource reference can be obtained from the environment. The
177      * resource was declared using @Resource on the bean class.
178      * @input -
179      * @output -
180      */

181     @Test
182     public void testEJBContext00(){
183         bean.checkEJBContext();
184     }
185
186     /**
187      * Tests if a resource reference can be obtained from the environment. The
188      * resource was declared using @Resource on the bean class.
189      * @input -
190      * @output -
191      */

192     @Test
193     public void testTimerService00(){
194         timerBean.check();
195     }
196
197     /**
198      * Tests if a resource reference can be obtained from the environment. The
199      * resource was declared using @Resource on the bean class.
200      * @input -
201      * @output -
202      */

203     @Test
204     public void testUserTransaction00(){
205         utxBean.check();
206     }
207
208 }
209
Popular Tags