KickJava   Java API By Example, From Geeks To Geeks.

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


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: TestInterceptor00.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.ItfInterceptorTester00;
28 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.interceptorxml.SFSBInterceptorTester00;
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 SFSBInterceptorTester00,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 SFSBInterceptorTester00 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 TestInterceptor00 {
48
49     /**
50      * Bean used to verify the interceptor definition..
51      */

52     private ItfInterceptorTester00 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(SFSBInterceptorTester00.class, ItfInterceptorTester00.class);
68     }
69
70     /**
71      * Verifies if the default interceptors and the class interceptors defined
72      * in the deployment descriptors are called.
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 interceptor defined for a method works correctly. The
83      * interceptor is defined to the methods with the name insertOrder2, so the
84      * both methods( insertOrder2(List) and insertOrder2(List, int) ) must have
85      * the same interceptors.
86      * @input -
87      * @output the correct method execution.
88      */

89     @Test
90     public void testInterceptorOrder02() {
91         tester.testInterceptorOrder02();
92     }
93
94     /**
95      * Verifies the element exclude class interceptors.
96      * @input -
97      * @output the correct method execution.
98      */

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

110     @Test
111     public void testPostConstruct() {
112         tester.testPostConstruct();
113     }
114
115     /**
116      * Verifies if the preDestroy defined by deployment descriptor in a bean
117      * class is called.
118      * @input -
119      * @output the correct method execution.
120      */

121     @Test
122     public void testPreDestroy() {
123         tester.testPreDestroy();
124     }
125
126     /**
127      * Verifies if the prePassivate defined by deployment descriptor in a bean
128      * class is called.
129      * @input -
130      * @output the correct method execution.
131      * @throws Exception if an error occurs during the test.
132      */

133     @Test
134     public void testPrePassivate() throws Exception JavaDoc {
135         tester.testPrePassivate();
136         throw new Exception JavaDoc("The prePassivate test is not implemented yet.");
137     }
138
139     /**
140      * Verifies if the postActivate defined by deployment descriptor in a bean
141      * class is called.
142      * @input -
143      * @output the correct method execution.
144      * @throws Exception if an error occurs during the test.
145      */

146     @Test
147     public void testPostActivate() throws Exception JavaDoc {
148         tester.testPostActivate();
149         throw new Exception JavaDoc("The postActivate test is not implemented yet.");
150     }
151 }
152
Popular Tags