KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > deploymentdesc > TestInterceptor02


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: TestInterceptor02.java 977 2006-07-28 13:18:26Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.deploymentdesc;
26
27 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.interceptorxml.ItfInterceptorTester02;
28 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.interceptorxml.SFSBInterceptorTester02;
29 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.ItfCallbackLoggerAccess;
30 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.callbacklogger.SLSBCallbackLoggerAccess;
31 import org.objectweb.easybeans.tests.common.helper.EJBHelper;
32 import org.testng.annotations.BeforeMethod;
33 import org.testng.annotations.Test;
34
35 /**
36  * Verifies if the container can deploy an bean with the interceptors defined in
37  * the deployment description. Item 12.8
38  * @reference JSR 220 - FINAL RELEASE
39  * @requirement the bean SFSBInterceptorTester02,SFSBInterceptorXML and
40  * SLSBCallbackLoggerAccess must be deployed to make the tests,
41  * and, the deployment descriptors must be used too.
42  * @setup gets an instance of the SFSBInterceptorTester02 and the
43  * SLSBCallbackLoggerAccess. Also, it cleans the log.
44  * @author Gisele Pinheiro Souza
45  * @author Eduardo Studzinski Estima de Castro
46  */

47 public class TestInterceptor02 {
48
49     /**
50      * Bean used to verify the interceptor definition..
51      */

52     private ItfInterceptorTester02 tester;
53
54     /**
55      * Bean used to clean the callback methods.
56      */

57     private ItfCallbackLoggerAccess clBean;
58
59     /**
60      * Creates the beans used during the tests.
61      * @throws Exception if an error occurs during the lookup.
62      */

63     @BeforeMethod
64     public void setup() throws Exception JavaDoc {
65         clBean = EJBHelper.getBeanRemoteInstance(SLSBCallbackLoggerAccess.class, ItfCallbackLoggerAccess.class);
66         clBean.deleteAll();
67         tester = EJBHelper.getBeanRemoteInstance(SFSBInterceptorTester02.class, ItfInterceptorTester02.class);
68     }
69
70     /**
71      * Verifies if the container uses the interceptor order defined in the
72      * deployment descriptor.
73      * @input -
74      * @output the correct method execution.
75      */

76     @Test
77     public void testInterceptorOrder01() {
78         tester.testInterceptorOrder01();
79     }
80
81     /**
82      * Verifies if the method interceptor respect the order defined by the
83      * deployment descriptor.
84      * @input -
85      * @output the correct method execution.
86      */

87     @Test
88     public void testInterceptorOrder02() {
89         tester.testInterceptorOrder02();
90     }
91
92
93     /**
94      * Verifies if the postConstruct methods defined by deployment descriptor in a bean
95      * class and in other class are called.
96      * @input -
97      * @output the correct method execution.
98      */

99     @Test
100     public void testPostConstruct() {
101         tester.testPostConstruct();
102     }
103
104     /**
105      * Verifies if the preDestroy methods defined by deployment descriptor in a bean
106      * class and in other class are called.
107      * @input -
108      * @output the correct method execution.
109      */

110     @Test
111     public void testPreDestroy() {
112         tester.testPreDestroy();
113     }
114
115     /**
116      * Verifies if the postPassivate methods defined by deployment descriptor in a bean
117      * class and in other class are called.
118      * @input -
119      * @output the correct method execution.
120      * @throws Exception if an error occurs.
121      */

122     @Test
123     public void testPrePassivate() throws Exception JavaDoc {
124         tester.testPrePassivate();
125         throw new Exception JavaDoc("The prePassivate test is not implemented yet.");
126     }
127
128     /**
129      * Verifies if the postActivate methods defined by deployment descriptor in a bean
130      * class and in other class are called.
131      * @input -
132      * @output the correct method execution.
133      * @throws Exception if an error occurs.
134      */

135     @Test
136     public void testPostActivate() throws Exception JavaDoc {
137         tester.testPostActivate();
138         throw new Exception JavaDoc("The postActivate test is not implemented yet.");
139     }
140 }
141
Popular Tags