KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > interceptors > business > stateless > containermanaged > TestSLAccessInterceptor01


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

25 package org.objectweb.easybeans.tests.interceptors.business.stateless.containermanaged;
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.stateless.containermanaged.interceptoraccess.SLSBAccessInterceptorTest01;
37 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.interceptoraccess.SLSBAccessUserTxInterceptor01;
38 import org.objectweb.easybeans.tests.common.exception.CustomException00;
39 import org.objectweb.easybeans.tests.interceptors.business.base.access.BaseAccessOperationsInterceptor00;
40 import org.testng.annotations.BeforeClass;
41 import org.testng.annotations.Test;
42
43
44 /**
45  * Verifies if interceptors in the bean class can perform the operations specified by the JSR-220.
46  * @reference JSR 220-PROPOSED FINAL - Chapter 4.5.2 - Table 2
47  * @requirement Application Server must be running; the beans
48  * org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.SLSB*AccessInterceptor*
49  * must be deployed.
50  * (Ant task: install.jar.tests.interceptor.business)
51  * @setup gets the reference of SLSBAccessInterceptorTest01, SLSBAccessTimerInterceptor01
52  * @author Eduardo Studzinski Estima de Castro
53  * @author Gisele Pinheiro Souza
54  */

55 public class TestSLAccessInterceptor01 extends BaseAccessOperationsInterceptor00{
56
57     /**
58      * Gets bean instances used in the tests.
59      * @throws Exception if there is a problem with the bean initialization.
60      */

61     @BeforeClass
62     public void startUp() throws Exception JavaDoc {
63         ItfAccessJNDI bean00 = getBeanRemoteInstance(SLSBAccessInterceptorTest01.class, ItfAccessJNDI.class);
64         ItfAccessEJB bean01 = getBeanRemoteInstance(SLSBAccessInterceptorTest01.class, ItfAccessEJB.class);
65         ItfAccessResourceManager bean02 = getBeanRemoteInstance(SLSBAccessInterceptorTest01.class,
66                 ItfAccessResourceManager.class);
67         ItfAccessEntityManager bean03 = getBeanRemoteInstance(SLSBAccessInterceptorTest01.class, ItfAccessEntityManager.class);
68         ItfAccessEMFactory bean04 = getBeanRemoteInstance(SLSBAccessInterceptorTest01.class, ItfAccessEMFactory.class);
69         ItfAccessSessionContext bean05 = getBeanRemoteInstance(SLSBAccessInterceptorTest01.class, ItfAccessSessionContext.class);
70         super.setBeans(bean00, bean01, bean02, bean03, bean04, bean05, null);
71     }
72
73     /**
74      * Verifies if the interceptor can access the "java:comp/env" via JNDI. This
75      * operation is allowed, so there isn't an expected
76      * exception.
77      * @input -
78      * @output no exceptions.
79      * @throws Exception if a problem occurs.
80      */

81     @Override JavaDoc
82     @Test(groups = {"java:comp/env access"})
83     public void testJNDI00() throws Exception JavaDoc {
84         super.testJNDI00();
85     }
86
87     /**
88      * Verifies if the interceptor can access an EJB. This
89      * operation is allowed, so there isn't an expected
90      * exception.
91      * @input -
92      * @output no exceptions.
93      * @throws Exception if a problem occurs.
94      */

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

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

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

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

151     @Override JavaDoc
152     @Test(groups = {"SessionContext access"})
153     public void testSessionContext00() throws Exception JavaDoc {
154         super.testSessionContext00();
155     }
156
157     /**
158      * Verifies if an interceptor can access the user transaction.
159      * The specification denies the use of this service, the container
160      * must throw an exception that indicates the null reference.
161      * @input -
162      * @output CustomException00
163      * @throws Exception if a problem occurs.
164      */

165     @Override JavaDoc
166     @Test(groups = {"UserTransaction access"}, expectedExceptions = CustomException00.class)
167     @SuppressWarnings JavaDoc("unused")
168     public void testUserTransaction00() throws Exception JavaDoc {
169         ItfAccessUserTransaction bean = getBeanRemoteInstance(SLSBAccessUserTxInterceptor01.class,
170                 ItfAccessUserTransaction.class);
171         bean.accessUserTransaction(null);
172     }
173
174 }
175
Popular Tags