KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > interceptors > business > stateful > beanmanaged > TestSFBeanManagedAccessInterceptor00


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: TestSFBeanManagedAccessInterceptor00.java 978 2006-07-28 13:19:14Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.interceptors.business.stateful.beanmanaged;
26
27 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
28
29 import org.objectweb.easybeans.tests.common.ejbs.base.ItfAccessEJB;
30 import org.objectweb.easybeans.tests.common.ejbs.base.ItfAccessEMFactory;
31 import org.objectweb.easybeans.tests.common.ejbs.base.ItfAccessEntityManager;
32 import org.objectweb.easybeans.tests.common.ejbs.base.ItfAccessJNDI;
33 import org.objectweb.easybeans.tests.common.ejbs.base.ItfAccessResourceManager;
34 import org.objectweb.easybeans.tests.common.ejbs.base.ItfAccessSessionContext;
35 import org.objectweb.easybeans.tests.common.ejbs.base.ItfAccessUserTransaction;
36 import org.objectweb.easybeans.tests.common.ejbs.stateful.beanmanaged.interceptoraccess.SFSBBMTAccessSessionCtxInterceptor00;
37 import org.objectweb.easybeans.tests.common.ejbs.stateful.beanmanaged.interceptoraccess.SFSBBMTAccessSessionCtxInterceptor01;
38 import org.objectweb.easybeans.tests.common.ejbs.stateful.beanmanaged.interceptoraccess.SFSBBMTAccessUserTxInterceptor00;
39 import org.objectweb.easybeans.tests.common.ejbs.stateful.beanmanaged.interceptoraccess.SFSBBeanManagedAccessInterceptorTest00;
40 import org.objectweb.easybeans.tests.interceptors.business.base.access.BaseAccessOperationsInterceptor00;
41 import org.testng.annotations.BeforeClass;
42 import org.testng.annotations.Test;
43
44 /**
45  * Verifies if interceptors in an external class can access the perform the
46  * operations specified by the JSR-220.
47  * @reference JSR 220 - EJB 3.0 Core - 4.4.1
48  * @requirement Application Server must be running; the beans
49  * org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.SFSB*AccessInterceptor*
50  * must be deployed.
51  * (Ant task: install.jar.tests.interceptor.business)
52  * @setup gets the reference of SFSBAccessInterceptorTest01,
53  * SFSBAccessTimerInterceptor01,
54  * SFSBBMTAccessUserTxInterceptor00
55  * @author Eduardo Studzinski Estima de Castro
56  * @author Gisele Pinheiro Souza
57  */

58 public class TestSFBeanManagedAccessInterceptor00 extends BaseAccessOperationsInterceptor00 {
59
60     /**
61      * Gets bean instances used in the tests.
62      * @throws Exception if there is a problem with the bean initialization.
63      */

64     @BeforeClass
65     public void startUp() throws Exception JavaDoc {
66         ItfAccessJNDI bean00 = getBeanRemoteInstance(SFSBBeanManagedAccessInterceptorTest00.class, ItfAccessJNDI.class);
67         ItfAccessEJB bean01 = getBeanRemoteInstance(SFSBBeanManagedAccessInterceptorTest00.class, ItfAccessEJB.class);
68         ItfAccessResourceManager bean02 = getBeanRemoteInstance(SFSBBeanManagedAccessInterceptorTest00.class,
69                 ItfAccessResourceManager.class);
70         ItfAccessEntityManager bean03 = getBeanRemoteInstance(SFSBBeanManagedAccessInterceptorTest00.class,
71                 ItfAccessEntityManager.class);
72         ItfAccessEMFactory bean04 = getBeanRemoteInstance(SFSBBeanManagedAccessInterceptorTest00.class,
73                 ItfAccessEMFactory.class);
74         ItfAccessSessionContext bean05 = getBeanRemoteInstance(SFSBBeanManagedAccessInterceptorTest00.class,
75                 ItfAccessSessionContext.class);
76         ItfAccessUserTransaction bean06 = getBeanRemoteInstance(
77                 SFSBBMTAccessUserTxInterceptor00.class, ItfAccessUserTransaction.class);
78
79         ItfAccessSessionContext bean07 = getBeanRemoteInstance(SFSBBMTAccessSessionCtxInterceptor00.class,
80                 ItfAccessSessionContext.class);
81         ItfAccessSessionContext bean08 = getBeanRemoteInstance(SFSBBMTAccessSessionCtxInterceptor01.class,
82                 ItfAccessSessionContext.class);
83         super.setBeans(bean00, bean01, bean02, bean03, bean04, bean05, bean06, bean07, bean08);
84     }
85
86     /**
87      * Verifies if the interceptor can access the "java:comp/env" via JNDI. This
88      * operation is allowed, so there isn't an expected
89      * exception.
90      * @input -
91      * @output no exceptions.
92      * @throws Exception if a problem occurs.
93      */

94     @Override JavaDoc
95     @Test(groups = {"java:comp/env access"})
96     public void testJNDI00() throws Exception JavaDoc {
97         super.testJNDI00();
98     }
99
100     /**
101      * Verifies if the interceptor can access an EJB. This
102      * operation is allowed, so there isn't an expected
103      * exception.
104      * @input -
105      * @output no exceptions.
106      * @throws Exception if a problem occurs.
107      */

108     @Override JavaDoc
109     @Test(groups = {"EJB access"})
110     public void testEJB00() throws Exception JavaDoc {
111         super.testEJB00();
112     }
113
114     /**
115      * Verifies if the interceptor can access the resource manager. This
116      * operation is allowed, so there isn't an expected
117      * exception.
118      * @input -
119      * @output no exceptions.
120      * @throws Exception if a problem occurs.
121      */

122     @Override JavaDoc
123     @Test(groups = {"Resource access"})
124     public void testResource00() throws Exception JavaDoc {
125         super.testResource00();
126     }
127
128     /**
129      * Verifies if the interceptor can access the entity manager. This
130      * operation is allowed, so there isn't an expected
131      * exception.
132      * @input -
133      * @output no exceptions.
134      * @throws Exception if a problem occurs.
135      */

136     @Override JavaDoc
137     @Test(groups = {"Entity Manager access"})
138     public void testEntityManager00() throws Exception JavaDoc {
139         super.testEntityManager00();
140     }
141
142     /**
143      * Verifies if the interceptor can access the entity factory. This
144      * operation is allowed, so there isn't an expected
145      * exception.
146      * @input -
147      * @output no exceptions.
148      * @throws Exception if a problem occurs.
149      */

150     @Override JavaDoc
151     @Test(groups = {"Entity Factory access"})
152     public void testEntityFactory00() throws Exception JavaDoc {
153         super.testEntityFactory00();
154     }
155
156     /**
157      * Verifies if the interceptor can access the session context. This
158      * operation is allowed, so there isn't an expected
159      * exception.
160      * @input -
161      * @output no exceptions.
162      * @throws Exception if a problem occurs.
163      */

164     @Override JavaDoc
165     @Test(groups = {"SessionContext access"})
166     public void testSessionContext00() throws Exception JavaDoc {
167         super.testSessionContext00();
168     }
169
170     /**
171      * Verifies if an interceptor can access the "getTimerService()" of a SessionContext instance.
172      * The specification defines that if a bean instance attempts to invoke a method and that access is not allowed, the container
173      * must throw the java.lang.IllegalStateException.
174      * @input -
175      * @output java.lang.IllegalStateException.
176      * @throws Exception if a problem occurs.
177      */

178     @Override JavaDoc
179     @Test(groups = {"SessionContext access"})
180     public void testSessionContext01() throws Exception JavaDoc {
181         super.testSessionContext01();
182     }
183
184     /**
185      * Verifies if an interceptor can access the "getUserTransaction()" of a SessionContext instance.
186      * The specification defines that if a bean instance attempts to invoke a method and that access is not allowed, the container
187      * must throw the java.lang.IllegalStateException.
188      * @input -
189      * @output java.lang.IllegalStateException.
190      * @throws Exception if a problem occurs.
191      */

192     @Override JavaDoc
193     @Test(groups = {"SessionContext access"})
194     public void testSessionContext02() throws Exception JavaDoc {
195         super.testSessionContext02();
196     }
197
198     /**
199      * Verifies if the interceptor can access the user transaction. This
200      * operation is allowed, so there isn't an expected
201      * exception.
202      * @input -
203      * @output no exceptions.
204      * @throws Exception if a problem occurs.
205      */

206     @Override JavaDoc
207     @Test(groups = {"UserTransaction access"})
208     public void testUserTransaction00() throws Exception JavaDoc {
209         super.testUserTransaction00();
210     }
211
212 }
213
Popular Tags