KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > entity > listeners > TestListeners03


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

25 package org.objectweb.easybeans.tests.entity.listeners;
26
27 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.listeners.ItfListenerTester;
28 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.listeners.SLSBListenerTester03;
29 import org.objectweb.easybeans.tests.common.helper.EJBHelper;
30 import org.testng.annotations.BeforeMethod;
31 import org.testng.annotations.Test;
32
33 /**
34  * Verifies if the container can manage listeners, when a class that overrides
35  * the callback methods from the superclass use the same callback type for the
36  * same method name.In the specification, in this case the methods in the
37  * superclass must be overriden and they are not called. For example:
38  * <br>class Father{
39  * <br> @PrePersist
40  * <br> public void prePersist(){...}
41  * <br>}
42  * <br>class Son extends class Father{
43  * <br> @PrePersist
44  * <br> public void prePersist(){...}
45  * <br>}
46  * <br>The item tested is the 3.5.4.
47  * @reference JSR 220-PROPOSED FINAL
48  * @requirement Application Server must be running; the bean
49  * SLSBListenerTester03 must be deployed.
50  * @setup gets the reference of SLSBListenerTester03
51  * @author Gisele Pinheiro Souza
52  * @author Eduardo Studzinski Estima de Castro
53  */

54 public class TestListeners03 {
55
56     /**
57      * The bean used during the tests.
58      */

59     private ItfListenerTester sfsbListenerTester;
60
61     /**
62      * Creates the stateless bean used during the tests.
63      * @throws Exception if an error occurs during the lookup.
64      */

65     @BeforeMethod
66     public void setup() throws Exception JavaDoc {
67          sfsbListenerTester = EJBHelper.getBeanRemoteInstance(SLSBListenerTester03.class,
68                 ItfListenerTester.class);
69      }
70
71     /**
72      * Verifies if the container calls only the class method and deos not call
73      * the superclass method. The callback methods verified are the PrePersist
74      * and the PostPersist.
75      * @input -
76      * @output the correct method execution
77      */

78     @Test
79     public void testPersistWithSupperclassListenerOverriden(){
80         sfsbListenerTester.testPersistCallbackMethods();
81     }
82
83     /**
84      * Verifies if the container calls only the class method and deos not call
85      * the superclass method. The callback methods verified are the PreRemove
86      * and the PostRemove.
87      * @input -
88      * @output the correct method execution
89      */

90     @Test
91     public void testRemoveWithSupperclassListenerOverriden(){
92         sfsbListenerTester.testRemoveCallbackMethods();
93     }
94
95     /**
96      * Verifies if the container calls only the class method and deos not call
97      * the superclass method. The callback methods verified are the PreUpdate
98      * and the PostUpdate.
99      * @input -
100      * @output the correct method execution
101      */

102     @Test
103     public void testUpdateWithSupperclassListenerOverriden(){
104         sfsbListenerTester.testUpdateCallbackMethods();
105     }
106
107     /**
108      * Verifies if the container calls only the class method and deos not call
109      * the superclass method. The callback method verified is the PostLoad.
110      * @input -
111      * @output the correct method execution
112      */

113     @Test
114     public void testRefreshWithSupperclassListenerOverriden(){
115         sfsbListenerTester.testLoadCallbackMethods();
116     }
117
118 }
119
Popular Tags