KickJava   Java API By Example, From Geeks To Geeks.

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


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: TestSFSessionBeanInterfaceWithAnnotation.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.SFSBSessionBeanItfWithAnnotation;
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 TestSFSessionBeanInterfaceWithAnnotation {
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(SFSBSessionBeanItfWithAnnotation.class, ItfCheck02.class);
65         beanLogger = getBeanRemoteInstance(SLSBCallbackLoggerAccess.class, ItfCallbackLoggerAccess.class);
66         beanLogger.deleteAll();
67     }
68
69     /**
70      * Verifies the ejbActivate() with the @PostActivate annotation is
71      * working properly.
72      * @input -
73      * @output -
74      * @throws Exception if a problem occurs.
75      */

76     // @Test
77
public void verifyEjbActivate() throws Exception JavaDoc {
78         // TODO: test
79
}
80
81     /**
82      * Verifies the ejbPassivate() with the @PrePassivate annotation is
83      * working properly.
84      * @input -
85      * @output -
86      * @throws Exception if a problem occurs.
87      */

88     // @Test
89
public void verifyEjbPassivate() throws Exception JavaDoc {
90         // TODO: test
91
}
92
93     /**
94      * Verifies if the ejbRemove() with the @PreDestroy annotation is
95      * working properly.
96      * @input -
97      * @output -
98      * @throws Exception if a problem occurs.
99      */

100     @Test
101     public void verifyEjbRemove() throws Exception JavaDoc {
102         bean.remove();
103
104         // Sleep used to wait all interceptors execution
105
Thread.sleep(SLEEP);
106
107         // Interceptors list
108
List JavaDoc<String JavaDoc> arLife = new ArrayList JavaDoc<String JavaDoc>();
109
110         arLife.add(SFSBSessionBeanItfWithAnnotation.class.getName());
111
112         beanLogger.verifyCallbackOrder(SFSBSessionBeanItfWithAnnotation.class, PRE_DESTROY, arLife
113                 .toArray(new String JavaDoc[0]));
114     }
115 }
116
Popular Tags