KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > sessionbean > stateful > sbinterface > TestSFSessionBeanInterface


1 /**
2  * EasyBeans
3  * Copyright (C) 2006 Bull S.A.S.
4  * Contact: easybeans@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * --------------------------------------------------------------------------
22  * $Id: TestSFSessionBeanInterface.java 928 2006-07-25 13:11:32Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.sessionbean.stateful.sbinterface;
26
27 import static org.objectweb.easybeans.tests.common.ejbs.entity.callbacklogger.CallbackType.PRE_DESTROY;
28 import static org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess.SLEEP;
29 import static org.objectweb.easybeans.tests.common.helper.EJBHelper.getBeanRemoteInstance;
30
31 import java.util.ArrayList JavaDoc;
32 import java.util.List JavaDoc;
33
34 import org.objectweb.easybeans.tests.common.ejbs.base.ItfCheck02;
35 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.sbinterface.SFSBSessionBeanItf;
36 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess;
37 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.SLSBCallbackLoggerAccess;
38 import org.testng.annotations.BeforeMethod;
39 import org.testng.annotations.Test;
40
41 /**
42  * Tests beans that implements the SessionBean interface.
43  * @author Eduardo Studzinski Estima de Castro
44  * @author Gisele Pinheiro Souza
45  */

46 public class TestSFSessionBeanInterface {
47
48     /**
49      * Bean.
50      */

51     private ItfCheck02 bean;
52
53     /**
54      * Logger bean.
55      */

56     private ItfCallbackLoggerAccess beanLogger;
57
58     /**
59      * Gets bean instances used in the tests.
60      * @throws Exception if there is a problem with bean initialization.
61      */

62     @BeforeMethod
63     public void startUp() throws Exception JavaDoc {
64         bean = getBeanRemoteInstance(SFSBSessionBeanItf.class, ItfCheck02.class);
65         beanLogger = getBeanRemoteInstance(SLSBCallbackLoggerAccess.class, ItfCallbackLoggerAccess.class);
66         beanLogger.deleteAll();
67     }
68
69     /**
70      * Verifies the setSessionContext.
71      * @input -
72      * @output -
73      * @throws Exception if a problem occurs.
74      */

75     @Test
76     public void verifySessionContext() throws Exception JavaDoc {
77         bean.check();
78     }
79
80     /**
81      * Verifies the ejbActivate().
82      * @input -
83      * @output -
84      * @throws Exception if a problem occurs.
85      */

86     // @Test
87
public void verifyEjbActivate() throws Exception JavaDoc {
88         // TODO: test
89
}
90
91     /**
92      * Verifies the ejbPassivate().
93      * @input -
94      * @output -
95      * @throws Exception if a problem occurs.
96      */

97     // @Test
98
public void verifyEjbPassivate() throws Exception JavaDoc {
99         // TODO: test
100
}
101
102     /**
103      * Verifies the ejbRemove().
104      * @input -
105      * @output -
106      * @throws Exception if a problem occurs.
107      */

108     @Test
109     public void verifyEjbRemove() throws Exception JavaDoc {
110         bean.remove();
111
112         // Sleep used to wait all interceptors execution
113
Thread.sleep(SLEEP);
114
115         // Interceptors list
116
List JavaDoc<String JavaDoc> arLife = new ArrayList JavaDoc<String JavaDoc>();
117
118         arLife.add(SFSBSessionBeanItf.class.getName());
119
120         beanLogger.verifyCallbackOrder(SFSBSessionBeanItf.class, PRE_DESTROY, arLife.toArray(new String JavaDoc[0]));
121     }
122 }
123
Popular Tags