001: /**
002: * EasyBeans
003: * Copyright (C) 2006 Bull S.A.S.
004: * Contact: easybeans@ow2.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * --------------------------------------------------------------------------
022: * $Id: TestSLBeanManagedAccessInterceptor00.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.interceptors.business.stateless.beanmanaged;
025:
026: import static org.ow2.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
027:
028: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessEJB;
029: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessEMFactory;
030: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessEntityManager;
031: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessJNDI;
032: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessResourceManager;
033: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessSessionContext;
034: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessUserTransaction;
035: import org.ow2.easybeans.tests.common.ejbs.stateless.beanmanaged.interceptoraccess.SLSBBMTAccessSessionCtxInterceptor00;
036: import org.ow2.easybeans.tests.common.ejbs.stateless.beanmanaged.interceptoraccess.SLSBBMTAccessSessionCtxInterceptor01;
037: import org.ow2.easybeans.tests.common.ejbs.stateless.beanmanaged.interceptoraccess.SLSBBMTAccessUserTxInterceptor00;
038: import org.ow2.easybeans.tests.common.ejbs.stateless.beanmanaged.interceptoraccess.SLSBBeanManagedAccessInterceptorTest00;
039: import org.ow2.easybeans.tests.interceptors.business.base.access.BaseAccessOperationsInterceptor00;
040: import org.testng.annotations.BeforeClass;
041: import org.testng.annotations.Test;
042:
043: /**
044: * Verifies if interceptors in an external class can perform the
045: * operations specified by the JSR-220.
046: * @reference JSR 220 - EJB 3.0 Core - 4.5.2
047: * @requirement Application Server must be running; the beans
048: * org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.SSLSBBeanManagedAccess*InterceptorTest00
049: * must be deployed.
050: * (Ant task: install.jar.tests.interceptor.business)
051: * @setup gets the reference of SLSBBeanManagedAccess*Test00
052: * @author Eduardo Studzinski Estima de Castro
053: * @author Gisele Pinheiro Souza
054: */
055: public class TestSLBeanManagedAccessInterceptor00 extends
056: BaseAccessOperationsInterceptor00 {
057:
058: /**
059: * Gets bean instances used in the tests.
060: * @throws Exception if there is a problem with the bean initialization.
061: */
062: @BeforeClass
063: public void startUp() throws Exception {
064: ItfAccessJNDI bean00 = getBeanRemoteInstance(
065: SLSBBeanManagedAccessInterceptorTest00.class,
066: ItfAccessJNDI.class);
067: ItfAccessEJB bean01 = getBeanRemoteInstance(
068: SLSBBeanManagedAccessInterceptorTest00.class,
069: ItfAccessEJB.class);
070: ItfAccessResourceManager bean02 = getBeanRemoteInstance(
071: SLSBBeanManagedAccessInterceptorTest00.class,
072: ItfAccessResourceManager.class);
073: ItfAccessEntityManager bean03 = getBeanRemoteInstance(
074: SLSBBeanManagedAccessInterceptorTest00.class,
075: ItfAccessEntityManager.class);
076: ItfAccessEMFactory bean04 = getBeanRemoteInstance(
077: SLSBBeanManagedAccessInterceptorTest00.class,
078: ItfAccessEMFactory.class);
079: ItfAccessSessionContext bean05 = getBeanRemoteInstance(
080: SLSBBeanManagedAccessInterceptorTest00.class,
081: ItfAccessSessionContext.class);
082: ItfAccessUserTransaction bean06 = getBeanRemoteInstance(
083: SLSBBMTAccessUserTxInterceptor00.class,
084: ItfAccessUserTransaction.class);
085:
086: ItfAccessSessionContext bean07 = getBeanRemoteInstance(
087: SLSBBMTAccessSessionCtxInterceptor00.class,
088: ItfAccessSessionContext.class);
089: ItfAccessSessionContext bean08 = getBeanRemoteInstance(
090: SLSBBMTAccessSessionCtxInterceptor01.class,
091: ItfAccessSessionContext.class);
092: super .setBeans(bean00, bean01, bean02, bean03, bean04, bean05,
093: bean06, bean07, bean08);
094: }
095:
096: /**
097: * Verifies if the interceptor can access the "java:comp/env" via JNDI. This
098: * operation is allowed, so there isn't an expected
099: * exception.
100: * @input -
101: * @output no exceptions.
102: * @throws Exception if a problem occurs.
103: */
104: @Override
105: @Test(groups={"java:comp/env access"})
106: public void testJNDI00() throws Exception {
107: super .testJNDI00();
108: }
109:
110: /**
111: * Verifies if the interceptor can access an EJB. This
112: * operation is allowed, so there isn't an expected
113: * exception.
114: * @input -
115: * @output no exceptions.
116: * @throws Exception if a problem occurs.
117: */
118: @Override
119: @Test(groups={"EJB access"})
120: public void testEJB00() throws Exception {
121: super .testEJB00();
122: }
123:
124: /**
125: * Verifies if the interceptor can access the resource manager. This
126: * operation is allowed, so there isn't an expected
127: * exception.
128: * @input -
129: * @output no exceptions.
130: * @throws Exception if a problem occurs.
131: */
132: @Override
133: @Test(groups={"Resource access"})
134: public void testResource00() throws Exception {
135: super .testResource00();
136: }
137:
138: /**
139: * Verifies if the interceptor can access the entity manager. This
140: * operation is allowed, so there isn't an expected
141: * exception.
142: * @input -
143: * @output no exceptions.
144: * @throws Exception if a problem occurs.
145: */
146: @Override
147: @Test(groups={"Entity Manager access"})
148: public void testEntityManager00() throws Exception {
149: super .testEntityManager00();
150: }
151:
152: /**
153: * Verifies if the interceptor can access the entity factory. This
154: * operation is allowed, so there isn't an expected
155: * exception.
156: * @input -
157: * @output no exceptions.
158: * @throws Exception if a problem occurs.
159: */
160: @Override
161: @Test(groups={"Entity Factory access"})
162: public void testEntityFactory00() throws Exception {
163: super .testEntityFactory00();
164: }
165:
166: /**
167: * Verifies if the interceptor can access the session context. This
168: * operation is allowed, so there isn't an expected
169: * exception.
170: * @input -
171: * @output no exceptions.
172: * @throws Exception if a problem occurs.
173: */
174: @Override
175: @Test(groups={"SessionContext access"})
176: public void testSessionContext00() throws Exception {
177: super .testSessionContext00();
178: }
179:
180: /**
181: * Verifies if an interceptor can access the "getTimerService()" of a
182: * SessionContext instance. This
183: * operation is allowed, so there isn't an expected
184: * exception.
185: * @input -
186: * @output No exceptions.
187: * @throws Exception if a problem occurs.
188: */
189: @Override
190: @Test(groups={"SessionContext access"})
191: public void testSessionContext01() throws Exception {
192: super .testSessionContext01();
193: }
194:
195: /**
196: * Test if an interceptor can access the "getUserTransaction()" of a
197: * SessionContext instance. This
198: * operation is allowed, so there isn't an expected
199: * exception.
200: * @input -
201: * @output No exceptions.
202: * @throws Exception if a problem occurs.
203: */
204: @Override
205: @Test(groups={"SessionContext access"})
206: public void testSessionContext02() throws Exception {
207: super .testSessionContext02();
208: }
209:
210: /**
211: * Verifies if the interceptor can access the user transaction. This
212: * operation is allowed, so there isn't an expected
213: * exception.
214: * @input -
215: * @output no exceptions.
216: * @throws Exception if a problem occurs.
217: */
218: @Override
219: @Test(groups={"UserTransaction access"})
220: public void testUserTransaction00() throws Exception {
221: super.testUserTransaction00();
222: }
223:
224: }
|