KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > sessionbean > misc > TestObjectIdentity


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: TestObjectIdentity.java 979 2006-07-28 13:19:50Z studzine $
23  * --------------------------------------------------------------------------
24  */

25 package org.objectweb.easybeans.tests.sessionbean.misc;
26
27 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.basic.ItfSessionObjectIdentity;
28 import org.objectweb.easybeans.tests.common.ejbs.stateless.containermanaged.basic.SLSBSessionObjectIdentity;
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 the method equals in a seesion beans works as the specified.
35  * @reference JSR 220-FINAL RELEASE
36  * @requirement Application Server must be running; the beans
37  * SLSBSessionObjectIdentity, SLSBDeployTest and SFSBDeployTest
38  * must be deployed.
39  * @setup gets a reference of the bean SLSBSessionObjectIdentity.
40  * @author Gisele Pinheiro Souza
41  * @author Eduardo Studzinski Estima de Castro
42  */

43 public class TestObjectIdentity {
44
45     /**
46      * Bean used during the test.
47      */

48     private ItfSessionObjectIdentity bean;
49
50     /**
51      * Gets an instance of the bean.
52      * @throws Exception if an error occurs.
53      */

54     @BeforeMethod
55     public void setup() throws Exception JavaDoc {
56         // Gets a bean instance.
57
bean = EJBHelper.getBeanRemoteInstance(SLSBSessionObjectIdentity.class, ItfSessionObjectIdentity.class);
58     }
59
60     /**
61      * Verifies the identity of the same stateful bean(example:
62      * bean1.equals(bean1)). The bean was goten by injection.
63      * @input a bean injected
64      * @output the correct method execution, the result of the comparison must
65      * be true
66      */

67     @Test
68     public void testSFSameInstanceInjected() {
69         bean.testSFSameInstanceIdentityInjected();
70     }
71
72     /**
73      * Verifies the identity of the same stateful bean(example:
74      * bean1.equals(bean1)). The bean was goten by lookup.
75      * @input a bean injected
76      * @output the correct method execution, the result of the comparison must
77      * be true
78      * @throws Exception if a lookup error occurs.
79      */

80     @Test
81     public void testSFSameInstanceLookup() throws Exception JavaDoc {
82         bean.testSFSameInstanceIdentityLookup();
83     }
84
85     /**
86      * Verifies the identity of the same stateless bean(example:
87      * bean1.equals(bean1)). The bean was goten by injection.
88      * @input a bean injected
89      * @output the correct method execution, the result of the comparison must
90      * be true
91      */

92     @Test
93     public void testSLSameInstanceInjected() {
94         bean.testSLSameInstanceIdentityInjected();
95     }
96
97     /**
98      * Verifies the identity of the same stateless bean(example:
99      * bean1.equals(bean1)). The bean was goten by lookup.
100      * @input a bean injected
101      * @output the correct method execution, the result of the comparison must
102      * be true
103      * @throws Exception if a lookup error occurs.
104      */

105     @Test
106     public void testSLSameInstanceLookup() throws Exception JavaDoc {
107         bean.testSLSameInstanceIdentityLookup();
108     }
109
110     /**
111      * Verifies the identity of two different stateful beans(example:
112      * bean1.equals(bean2)). The beans were goten by injection.
113      * @input the beans injected
114      * @output the correct method execution, the result of the comparison must
115      * be false
116      */

117     @Test
118     public void testSFDifferentInstanceInjected() {
119         bean.testSFDifferentInstanceIdentityInjected();
120     }
121
122     /**
123      * Verifies the identity of two different stateful beans(example:
124      * bean1.equals(bean2)). The beans were goten by lookup.
125      * @input the beans injected
126      * @output the correct method execution, the result of the comparison must
127      * be false
128      * @throws Exception if a lookup error occurs.
129      */

130     @Test
131     public void testSFDifferentInstanceLookup() throws Exception JavaDoc {
132         bean.testSFDifferentInstanceIdentityLookup();
133     }
134
135     /**
136      * Verifies the identity of two different stateless beans(example:
137      * bean1.equals(bean2)). The beans were goten by injection.
138      * @input the beans injected
139      * @output the correct method execution, the result of the comparison must
140      * be true
141      */

142     @Test
143     public void testSLDifferentInstanceInjected() {
144         bean.testSLDifferentInstanceIdentityInjected();
145     }
146
147     /**
148      * Verifies the identity of two different stateless beans(example:
149      * bean1.equals(bean2)). The beans were goten by lookup.
150      * @input the beans injected
151      * @output the correct method execution, the result of the comparison must
152      * be true
153      * @throws Exception if a lookup error occurs.
154      */

155     @Test
156     public void testSLDifferentInstanceLookup() throws Exception JavaDoc {
157         bean.testSLDifferentInstanceIdentityLookup();
158     }
159 }
160
Popular Tags