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: TestSFSessionBeanInterface.java 1970 2007-10-16 11:49:25Z benoitf $
023: * --------------------------------------------------------------------------
024: */package org.ow2.easybeans.tests.sessionbean.stateful.sbinterface;
025:
026: import static org.ow2.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.PRE_DESTROY;
027: import static org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess.SLEEP;
028: import static org.ow2.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
029:
030: import java.util.ArrayList;
031: import java.util.List;
032:
033: import org.ow2.easybeans.tests.common.ejbs.base.ItfCheck02;
034: import org.ow2.easybeans.tests.common.ejbs.stateful.containermanaged.sbinterface.SFSBSessionBeanItf;
035: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess;
036: import org.ow2.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.SLSBCallbackLoggerAccess;
037: import org.testng.annotations.BeforeMethod;
038: import org.testng.annotations.Test;
039:
040: /**
041: * Tests beans that implements the SessionBean interface.
042: * @author Eduardo Studzinski Estima de Castro
043: * @author Gisele Pinheiro Souza
044: */
045: public class TestSFSessionBeanInterface {
046:
047: /**
048: * Bean.
049: */
050: private ItfCheck02 bean;
051:
052: /**
053: * Logger bean.
054: */
055: private ItfCallbackLoggerAccess beanLogger;
056:
057: /**
058: * Gets bean instances used in the tests.
059: * @throws Exception if there is a problem with bean initialization.
060: */
061: @BeforeMethod
062: public void startUp() throws Exception {
063: bean = getBeanRemoteInstance(SFSBSessionBeanItf.class,
064: ItfCheck02.class);
065: beanLogger = getBeanRemoteInstance(
066: SLSBCallbackLoggerAccess.class,
067: ItfCallbackLoggerAccess.class);
068: beanLogger.deleteAll();
069: }
070:
071: /**
072: * Verifies the setSessionContext.
073: * @input -
074: * @output -
075: * @throws Exception if a problem occurs.
076: */
077: @Test
078: public void verifySessionContext() throws Exception {
079: bean.check();
080: }
081:
082: /**
083: * Verifies the ejbActivate().
084: * @input -
085: * @output -
086: * @throws Exception if a problem occurs.
087: */
088: // @Test
089: public void verifyEjbActivate() throws Exception {
090: // TODO: test
091: }
092:
093: /**
094: * Verifies the ejbPassivate().
095: * @input -
096: * @output -
097: * @throws Exception if a problem occurs.
098: */
099: // @Test
100: public void verifyEjbPassivate() throws Exception {
101: // TODO: test
102: }
103:
104: /**
105: * Verifies the ejbRemove().
106: * @input -
107: * @output -
108: * @throws Exception if a problem occurs.
109: */
110: @Test
111: public void verifyEjbRemove() throws Exception {
112: bean.remove();
113:
114: // Sleep used to wait all interceptors execution
115: Thread.sleep(SLEEP);
116:
117: // Interceptors list
118: List<String> arLife = new ArrayList<String>();
119:
120: arLife.add(SFSBSessionBeanItf.class.getName());
121:
122: beanLogger.verifyCallbackOrder(SFSBSessionBeanItf.class,
123: PRE_DESTROY, arLife.toArray(new String[0]));
124: }
125: }
|