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: BaseAccessOperationsInterceptor00.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.interceptors.business.base.access;
025:
026: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessEJB;
027: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessEMFactory;
028: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessEntityManager;
029: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessJNDI;
030: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessResourceManager;
031: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessSessionContext;
032: import org.ow2.easybeans.tests.common.ejbs.base.ItfAccessUserTransaction;
033:
034: /**
035: * Verifies the interceptor access to the following items. <li>SessionContext
036: * Methods</li> <li>JNDI Access to java:comp/env</li> <li>Resource Manager</li>
037: * <li>Enterprise bean</li> <li>EntityManagerFactory</li> <li>EntityManager</li>
038: * <li>TimerService</li> <li>UserTransaction</li>
039: * @author Eduardo Studzinski Estima de Castro
040: * @author Gisele Pinheiro Souza
041: */
042: public class BaseAccessOperationsInterceptor00 {
043:
044: /**
045: * Bean used to implement the test.
046: */
047: private ItfAccessJNDI beanAccessJNDI;
048:
049: /**
050: * Bean used to implement the test.
051: */
052: private ItfAccessEJB beanAccessEJB;
053:
054: /**
055: * Bean used to implement the test.
056: */
057: private ItfAccessResourceManager beanAccessResourceManager;
058:
059: /**
060: * Bean used to implement the test.
061: */
062: private ItfAccessEntityManager beanAccessEntityManager;
063:
064: /**
065: * Bean used to implement the test.
066: */
067: private ItfAccessEMFactory beanAccessEMFactory;
068:
069: /**
070: * Bean used to implement the test.
071: */
072: private ItfAccessSessionContext beanAccessSessionContext01;
073:
074: /**
075: * Bean used to implement the test.
076: */
077: private ItfAccessUserTransaction beanAcessUserTransaction;
078:
079: /**
080: * Bean used to implement the test.
081: */
082: private ItfAccessSessionContext beanAccessSessionContext00;
083:
084: /**
085: * Bean used to implement the test.
086: */
087: private ItfAccessSessionContext beanAccessSessionContext02;
088:
089: /**
090: * Verifies if the interceptor can access the "java:comp/env" via JNDI.
091: * @throws Exception if a problem occurs.
092: */
093: @SuppressWarnings("unchecked")
094: public void testJNDI00() throws Exception {
095: beanAccessJNDI.accessJNDI(null);
096: }
097:
098: /**
099: * Verifies if the interceptor can access an ejb.
100: * @throws Exception if a problem occurs.
101: */
102: @SuppressWarnings("unchecked")
103: public void testEJB00() throws Exception {
104: beanAccessEJB.accessEJB(null);
105: }
106:
107: /**
108: * Verifies if the interceptor can access a resource.
109: * @throws Exception if a problem occurs.
110: */
111: @SuppressWarnings("unchecked")
112: public void testResource00() throws Exception {
113: beanAccessResourceManager.accessResManager(null);
114: }
115:
116: /**
117: * Verifies if the interceptor can access an Entity Manager.
118: * @throws Exception if a problem occurs.
119: */
120: @SuppressWarnings("unchecked")
121: public void testEntityManager00() throws Exception {
122: beanAccessEntityManager.accessEntityManager(null);
123: }
124:
125: /**
126: * Verifies if the interceptor can access an Entity Factory.
127: * @throws Exception if a problem occurs.
128: */
129: @SuppressWarnings("unchecked")
130: public void testEntityFactory00() throws Exception {
131: beanAccessEMFactory.accessEntityManagerFactory(null);
132: }
133:
134: /**
135: * Verifies if the interceptor can access a SessionContext.
136: * @throws Exception if a problem occurs.
137: */
138: @SuppressWarnings("unchecked")
139: public void testSessionContext00() throws Exception {
140: beanAccessSessionContext01.accessSessionContext(null);
141: }
142:
143: /**
144: * Verifies if the interceptor can access an UserTransaction.
145: * @throws Exception if a problem occurs.
146: */
147: @SuppressWarnings("unchecked")
148: public void testUserTransaction00() throws Exception {
149: beanAcessUserTransaction.accessUserTransaction(null);
150: }
151:
152: /**
153: * Verifies if the interceptor can call the "getTimerService()" of a
154: * SessionContext.
155: * @throws Exception if a problem occurs.
156: */
157: @SuppressWarnings("unchecked")
158: public void testSessionContext01() throws Exception {
159: beanAccessSessionContext00.accessSessionContext(null);
160: }
161:
162: /**
163: * Verifies if the interceptor can call "getUserTransaction()" of a
164: * SessionContext.
165: * @throws Exception if a problem occurs.
166: */
167: @SuppressWarnings("unchecked")
168: public void testSessionContext02() throws Exception {
169: beanAccessSessionContext02.accessSessionContext(null);
170: }
171:
172: /**
173: * Sets bean(s) used in the tests.
174: * @param bean00 The bean to set.
175: * @param bean01 The bean to set.
176: * @param bean02 The bean to set.
177: * @param bean03 The bean to set.
178: * @param bean04 The bean to set.
179: * @param bean05 The bean to set.
180: * @param bean06 The bean to set.
181: */
182: public void setBeans(final ItfAccessJNDI bean00,
183: final ItfAccessEJB bean01,
184: final ItfAccessResourceManager bean02,
185: final ItfAccessEntityManager bean03,
186: final ItfAccessEMFactory bean04,
187: final ItfAccessSessionContext bean05,
188: final ItfAccessUserTransaction bean06) {
189: this .beanAccessJNDI = bean00;
190: this .beanAccessEJB = bean01;
191: this .beanAccessResourceManager = bean02;
192: this .beanAccessEntityManager = bean03;
193: this .beanAccessEMFactory = bean04;
194: this .beanAccessSessionContext01 = bean05;
195: this .beanAcessUserTransaction = bean06;
196: }
197:
198: /**
199: * Sets bean(s) used in the tests.
200: * @param bean00 The bean to set.
201: * @param bean01 The bean to set.
202: * @param bean02 The bean to set.
203: * @param bean03 The bean to set.
204: * @param bean04 The bean to set.
205: * @param bean05 The bean to set.
206: * @param bean06 The bean to set.
207: * @param bean07 The bean to set.
208: * @param bean08 The bean to set.
209: */
210: public void setBeans(final ItfAccessJNDI bean00,
211: final ItfAccessEJB bean01,
212: final ItfAccessResourceManager bean02,
213: final ItfAccessEntityManager bean03,
214: final ItfAccessEMFactory bean04,
215: final ItfAccessSessionContext bean05,
216: final ItfAccessUserTransaction bean06,
217: final ItfAccessSessionContext bean07,
218: final ItfAccessSessionContext bean08) {
219: this.setBeans(bean00, bean01, bean02, bean03, bean04, bean05,
220: bean06);
221: this.beanAccessSessionContext00 = bean07;
222: this.beanAccessSessionContext02 = bean08;
223: }
224:
225: }
|