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: TestInterceptor02.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.ItfInterceptorTester02;
027: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.interceptorxml.SFSBInterceptorTester02;
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 SFSBInterceptorTester02,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 SFSBInterceptorTester02 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 TestInterceptor02 {
047:
048: /**
049: * Bean used to verify the interceptor definition..
050: */
051: private ItfInterceptorTester02 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: SFSBInterceptorTester02.class,
070: ItfInterceptorTester02.class);
071: }
072:
073: /**
074: * Verifies if the container uses the interceptor order defined in the
075: * deployment descriptor.
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 method interceptor respect the order defined by the
086: * deployment descriptor.
087: * @input -
088: * @output the correct method execution.
089: */
090: @Test
091: public void testInterceptorOrder02() {
092: tester.testInterceptorOrder02();
093: }
094:
095: /**
096: * Verifies if the postConstruct methods defined by deployment descriptor in a bean
097: * class and in other class are called.
098: * @input -
099: * @output the correct method execution.
100: */
101: @Test
102: public void testPostConstruct() {
103: tester.testPostConstruct();
104: }
105:
106: /**
107: * Verifies if the preDestroy methods defined by deployment descriptor in a bean
108: * class and in other class are called.
109: * @input -
110: * @output the correct method execution.
111: */
112: @Test
113: public void testPreDestroy() {
114: tester.testPreDestroy();
115: }
116:
117: /**
118: * Verifies if the postPassivate methods defined by deployment descriptor in a bean
119: * class and in other class are called.
120: * @input -
121: * @output the correct method execution.
122: * @throws Exception if an error occurs.
123: */
124: @Test
125: public void testPrePassivate() throws Exception {
126: tester.testPrePassivate();
127: //TODO: Add a test for pre passivate
128: }
129:
130: /**
131: * Verifies if the postActivate methods defined by deployment descriptor in a bean
132: * class and in other class are called.
133: * @input -
134: * @output the correct method execution.
135: * @throws Exception if an error occurs.
136: */
137: @Test
138: public void testPostActivate() throws Exception {
139: tester.testPostActivate();
140: //TODO: Add a test for post activate
141: }
142: }
|