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: TestInterceptor00.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.deploymentdesc;
025:
026: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.interceptorxml.ItfInterceptorTester00;
027: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.interceptorxml.SFSBInterceptorTester00;
028: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess;
029: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.SLSBCallbackLoggerAccess;
030: import org.ow2.easybeans.tests.common.helper.EJBHelper;
031: import org.testng.annotations.BeforeMethod;
032: import org.testng.annotations.Test;
033:
034: /**
035: * Verifies if the container can deploy an bean with the interceptors defined in
036: * the deployment description. Item 12.8
037: * @reference JSR 220 - FINAL RELEASE
038: * @requirement the bean SFSBInterceptorTester00,SFSBInterceptorXML and
039: * SLSBCallbackLoggerAccess must be deployed to make the tests,
040: * and, the deployment descriptors must be used too.
041: * @setup gets an instance of the SFSBInterceptorTester00 and the
042: * SLSBCallbackLoggerAccess. Also, it cleans the log.
043: * @author Gisele Pinheiro Souza
044: * @author Eduardo Studzinski Estima de Castro
045: */
046: public class TestInterceptor00 {
047:
048: /**
049: * Bean used to verify the interceptor definition..
050: */
051: private ItfInterceptorTester00 tester;
052:
053: /**
054: * Bean used to clean the callback methods.
055: */
056: private ItfCallbackLoggerAccess clBean;
057:
058: /**
059: * Creates the beans used during the tests.
060: * @throws Exception if an error occurs during the lookup.
061: */
062: @BeforeMethod
063: public void setup() throws Exception {
064: clBean = EJBHelper.getBeanRemoteInstance(
065: SLSBCallbackLoggerAccess.class,
066: ItfCallbackLoggerAccess.class);
067: clBean.deleteAll();
068: tester = EJBHelper.getBeanRemoteInstance(
069: SFSBInterceptorTester00.class,
070: ItfInterceptorTester00.class);
071: }
072:
073: /**
074: * Verifies if the default interceptors and the class interceptors defined
075: * in the deployment descriptors are called.
076: * @input -
077: * @output the correct method execution.
078: */
079: @Test
080: public void testInterceptorOrder01() {
081: tester.testInterceptorOrder01();
082: }
083:
084: /**
085: * Verifies if the interceptor defined for a method works correctly. The
086: * interceptor is defined to the methods with the name insertOrder2, so the
087: * both methods( insertOrder2(List) and insertOrder2(List, int) ) must have
088: * the same interceptors.
089: * @input -
090: * @output the correct method execution.
091: */
092: @Test
093: public void testInterceptorOrder02() {
094: tester.testInterceptorOrder02();
095: }
096:
097: /**
098: * Verifies the element exclude class interceptors.
099: * @input -
100: * @output the correct method execution.
101: */
102: @Test
103: public void testInterceptorOrder03() {
104: tester.testInterceptorOrder03();
105: }
106:
107: /**
108: * Verifies if the postConstruct defined by deployment descriptor in a bean
109: * class is called.
110: * @input -
111: * @output the correct method execution.
112: */
113: @Test
114: public void testPostConstruct() {
115: tester.testPostConstruct();
116: }
117:
118: /**
119: * Verifies if the preDestroy defined by deployment descriptor in a bean
120: * class is called.
121: * @input -
122: * @output the correct method execution.
123: */
124: @Test
125: public void testPreDestroy() {
126: tester.testPreDestroy();
127: }
128:
129: /**
130: * Verifies if the prePassivate defined by deployment descriptor in a bean
131: * class is called.
132: * @input -
133: * @output the correct method execution.
134: * @throws Exception if an error occurs during the test.
135: */
136: @Test
137: public void testPrePassivate() throws Exception {
138: tester.testPrePassivate();
139: //TODO: Needs to be implemented
140: }
141:
142: /**
143: * Verifies if the postActivate defined by deployment descriptor in a bean
144: * class is called.
145: * @input -
146: * @output the correct method execution.
147: * @throws Exception if an error occurs during the test.
148: */
149: @Test
150: public void testPostActivate() throws Exception {
151: tester.testPostActivate();
152: //TODO: Needs to be implemented
153: }
154: }
|