KickJava   Java API By Example, From Geeks To Geeks.

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


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: TestListeners04.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.SLSBListenerTester04;
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 different callback type for the
36  * same method name.In the specification, in this case the methods in the
37  * superclass must be called. for example:
38  * <br>class Father{
39  * <br> @PrePersist
40  * <br> public void prePersist(){...}
41  * <br>
42  * <br> @PostPersist
43  * <br> public void postPersist(){..}
44  * <br>}
45  * <br>class Son extends class Father{
46  * <br> @PrePersist
47  * <br> @Override
48  * <br> public void postPersist(){...}
49  * <br>
50  * <br> @PostPersist
51  * <br> public void prePersist(){..}
52  * <br>}
53  * <br>The item tested is the 3.5.4, note 22.
54  * @reference JSR 220-PROPOSED FINAL
55  * @requirement Application Server must be running; the bean
56  * SLSBListenerTester04 must be deployed.
57  * @setup gets the reference of SLSBListenerTester4
58  * @author Gisele Pinheiro Souza
59  * @author Eduardo Studzinski Estima de Castro
60  */

61 public class TestListeners04 {
62
63     /**
64      * The bean used during the tests.
65      */

66     private ItfListenerTester sfsbListenerTester;
67
68     /**
69      * Creates the stateless bean used during the tests.
70      * @throws Exception if an error occurs during the lookup.
71      */

72     @BeforeMethod
73     public void setup() throws Exception JavaDoc {
74         sfsbListenerTester = EJBHelper.getBeanRemoteInstance(SLSBListenerTester04.class, ItfListenerTester.class);
75     }
76
77     /**
78      * Verifies if the container calls the overriden methods for the callback methods PrePersist and PostPersist.
79      * @input -
80      * @output the correct method execution
81      *
82      */

83     @Test
84     public void testPersistWithOverridenListerners() {
85         sfsbListenerTester.testPersistCallbackMethods();
86     }
87
88     /**
89      * Verifies if the container calls the overriden methods for the callback methods PreRemove and PostRemove.
90      * @input -
91      * @output the correct method execution
92      *
93      */

94     @Test
95     public void testRemoveWithOverridenListerners() {
96         sfsbListenerTester.testRemoveCallbackMethods();
97     }
98
99     /**
100      * Verifies if the container calls the overriden methods for the callback methods PreUpdate and PostUpdate.
101      * @input -
102      * @output the correct method execution
103      *
104      */

105     @Test
106     public void testUpdateWithOverridenListerners() {
107         sfsbListenerTester.testUpdateCallbackMethods();
108     }
109
110     /**
111      * Verifies if the container calls the overriden method for the callback method PostLoad.
112      * @input -
113      * @output the correct method execution
114      *
115      */

116     @Test
117     public void testRefreshWithOverridenListerners() {
118         sfsbListenerTester.testLoadCallbackMethods();
119     }
120 }
121
Popular Tags