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: TestSLBeanManagedAccessInterceptor01.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.SLSBBMTAccessUserTxInterceptor00;
036: import org.ow2.easybeans.tests.common.ejbs.stateless.beanmanaged.interceptoraccess.SLSBBeanManagedAccessInterceptorTest00;
037: import org.ow2.easybeans.tests.common.ejbs.stateless.beanmanaged.interceptoraccess.SLSBBeanManagedAccessInterceptorTest01;
038: import org.ow2.easybeans.tests.interceptors.business.base.access.BaseAccessOperationsInterceptor00;
039: import org.testng.annotations.BeforeClass;
040: import org.testng.annotations.Test;
041:
042: /**
043: * Verifies if interceptors in the bean class can perform the operations specified by the JSR-220.
044: * @reference JSR 220 - EJB 3.0 Core - 4.5.2
045: * @requirement Application Server must be running; the beans
046: * org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.SLSB*AccessInterceptor*
047: * must be deployed.
048: * (Ant task: install.jar.tests.interceptor.business)
049: * @setup gets the reference of SLSBAccessInterceptorTest01
050: * @author Eduardo Studzinski Estima de Castro
051: * @author Gisele Pinheiro Souza
052: */
053: public class TestSLBeanManagedAccessInterceptor01 extends
054: BaseAccessOperationsInterceptor00 {
055:
056: /**
057: * Gets bean instances used in the tests.
058: * @throws Exception if there is a problem with the bean initialization.
059: */
060: @BeforeClass
061: public void startUp() throws Exception {
062: ItfAccessJNDI bean00 = getBeanRemoteInstance(
063: SLSBBeanManagedAccessInterceptorTest00.class,
064: ItfAccessJNDI.class);
065: ItfAccessEJB bean01 = getBeanRemoteInstance(
066: SLSBBeanManagedAccessInterceptorTest00.class,
067: ItfAccessEJB.class);
068: ItfAccessResourceManager bean02 = getBeanRemoteInstance(
069: SLSBBeanManagedAccessInterceptorTest01.class,
070: ItfAccessResourceManager.class);
071: ItfAccessEntityManager bean03 = getBeanRemoteInstance(
072: SLSBBeanManagedAccessInterceptorTest01.class,
073: ItfAccessEntityManager.class);
074: ItfAccessEMFactory bean04 = getBeanRemoteInstance(
075: SLSBBeanManagedAccessInterceptorTest01.class,
076: ItfAccessEMFactory.class);
077: ItfAccessSessionContext bean05 = getBeanRemoteInstance(
078: SLSBBeanManagedAccessInterceptorTest01.class,
079: ItfAccessSessionContext.class);
080: ItfAccessUserTransaction bean06 = getBeanRemoteInstance(
081: SLSBBMTAccessUserTxInterceptor00.class,
082: ItfAccessUserTransaction.class);
083: super .setBeans(bean00, bean01, bean02, bean03, bean04, bean05,
084: bean06);
085: }
086:
087: /**
088: * Verifies if the interceptor can access the "java:comp/env" via JNDI. This
089: * operation is allowed, so there isn't an expected
090: * exception.
091: * @input -
092: * @output no exceptions.
093: * @throws Exception if a problem occurs.
094: */
095: @Override
096: @Test(groups={"java:comp/env access"})
097: public void testJNDI00() throws Exception {
098: super .testJNDI00();
099: }
100:
101: /**
102: * Verifies if the interceptor can access an EJB. 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
110: @Test(groups={"EJB access"})
111: public void testEJB00() throws Exception {
112: super .testEJB00();
113: }
114:
115: /**
116: * Verifies if the interceptor can access the resource 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
124: @Test(groups={"Resource access"})
125: public void testResource00() throws Exception {
126: super .testResource00();
127: }
128:
129: /**
130: * Verifies if the interceptor can access the entity manager. 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
138: @Test(groups={"Entity Manager access"})
139: public void testEntityManager00() throws Exception {
140: super .testEntityManager00();
141: }
142:
143: /**
144: * Verifies if the interceptor can access the entity factory. 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
152: @Test(groups={"Entity Factory access"})
153: public void testEntityFactory00() throws Exception {
154: super .testEntityFactory00();
155: }
156:
157: /**
158: * Verifies if the interceptor can access the session context. This
159: * operation is allowed, so there isn't an expected
160: * exception.
161: * @input -
162: * @output no exceptions.
163: * @throws Exception if a problem occurs.
164: */
165: @Override
166: @Test(groups={"SessionContext access"})
167: public void testSessionContext00() throws Exception {
168: super .testSessionContext00();
169: }
170:
171: /**
172: * Verifies if the interceptor can access the user transaction. This
173: * operation is allowed, so there isn't an expected
174: * exception.
175: * @input -
176: * @output no exceptions.
177: * @throws Exception if a problem occurs.
178: */
179: @Override
180: @Test(groups={"UserTransaction access"})
181: public void testUserTransaction00() throws Exception {
182: super.testUserTransaction00();
183: }
184:
185: }
|