KickJava   Java API By Example, From Geeks To Geeks.

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


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: TestListeners05.java 912 2006-07-24 14:27:58Z pinheirg $
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.SLSBListenerTester05;
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 and does not define as callback
36  * methods the methods overriden. In the specification, in this case the methods
37  * in the superclass must be called. for example:
38  * <br>class Father{
39  * <br> @PrePersist
40  * <br> public void prePersist(){...} <br>
41  * <br>
42  * <br>}
43  * <br>class Son extends class Father{
44  * <br>@Override
45  * <br> public void prePersist(){...} <br>
46  * <br>
47  * <br>}
48  * <br>The item tested isthe 3.5.4, note 22.
49  */

50   public class TestListeners05 {
51
52      /**
53       * The bean used during the tests.
54       */

55     private ItfListenerTester sfsbListenerTester;
56
57     /**
58      * Creates the stateless bean used during the tests.
59      * @throws Exception if an error occurs during the lookup.
60      */

61     @BeforeMethod
62     public void setup() throws Exception JavaDoc {
63          sfsbListenerTester = EJBHelper.getBeanRemoteInstance(SLSBListenerTester05.class,
64                 ItfListenerTester.class);
65      }
66
67     /**
68      * Verifies if the container call the superclass methods for the PrePersist
69      * and PostPersist callback methods.
70      * @input -
71      * @output the correct method execution
72      */

73     @Test
74     public void testPersistWithOverridenListeners(){
75         sfsbListenerTester.testPersistCallbackMethods();
76     }
77
78     /**
79      * Verifies if the container call the superclass methods for the PreRemove
80      * and PostRemove callback methods.
81      * @input -
82      * @output the correct method execution
83      */

84     @Test
85     public void testRemoveWithOverridenListeners(){
86         sfsbListenerTester.testRemoveCallbackMethods();
87     }
88
89     /**
90      * Verifies if the container call the superclass methods for the PreUpdate
91      * and PostUpdate callback methods.
92      * @input -
93      * @output the correct method execution
94      */

95     @Test
96     public void testUpdateWithOverridenListeners(){
97         sfsbListenerTester.testUpdateCallbackMethods();
98     }
99
100     /**
101      * Verifies if the container call the superclass methods for the PostLoad callback method.
102      * @input -
103      * @output the correct method execution
104      */

105     @Test
106     public void testRefreshWithOverridenListeners(){
107         sfsbListenerTester.testLoadCallbackMethods();
108     }
109 }
110
Popular Tags