KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > easybeans > tests > ejb2view > TestEjb2DeployDescRemote


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

25 package org.objectweb.easybeans.tests.ejb2view;
26
27 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.ejb2view.ItfEjb2Client;
28 import org.objectweb.easybeans.tests.common.ejbs.stateful.containermanaged.ejb2view.SFSBEjb2ClientDeployDesc;
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 compatibility between the ejb 2.1 and the ejb 3.0. More
35  * specifically, it verifies if the access to the remote home works properly.
36  * All interfaces are defined by deployemnt descriptor.
37  * @reference JSR 220-FINAL RELEASE
38  * @requirement Application Server must be running; the beans SFSBEjb2ClientDeployDesc
39  * and SimpleEjb2BeanBase with the xml file (that is in the same package where the class is) must be deployed.
40  * @setup gets a reference of the bean SFSBEjb2ClientDeployDesc.
41  * @author Gisele Pinheiro Souza
42  * @author Eduardo Studzinski Estima de Castro
43  */

44 public class TestEjb2DeployDescRemote {
45
46     /**
47      * Bean that access the bean with ejb 2.1 remote view.
48      */

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

55     @BeforeMethod
56     public void setup() throws Exception JavaDoc {
57         // Gets a bean instance.
58
bean = EJBHelper.getBeanRemoteInstance(SFSBEjb2ClientDeployDesc.class, ItfEjb2Client.class);
59     }
60
61     /**
62      * Tests if the definition of the create method as ejbCreate in the bean
63      * class works. The interface home here is goten by the annotation ejb.
64      * @input -
65      * @output the correct method execution.
66      * @throws Exception If an error occurs during the test.
67      */

68     @Test
69     public void testCreateWithoutParameters() throws Exception JavaDoc {
70         bean.createWithoutParameters();
71     }
72
73     /**
74      * Tests if the definition of the create method with the annotation init in
75      * the bean class works. The interface home here is goten by the annotation
76      * ejb.
77      * @input -
78      * @output the correct method execution.
79      * @throws Exception If an error occurs during the test.
80      */

81     @Test
82     public void testCreateWithParameters() throws Exception JavaDoc {
83         bean.createWithParameters();
84     }
85
86     /**
87      * Verifies if theclient can get a bean by lookup.
88      * @input -
89      * @output the correct method execution.
90      * @throws Exception If an error occurs during the test.
91      */

92     @Test
93     public void testGetBeanByLookup() throws Exception JavaDoc {
94         bean.getBeanByLookup();
95     }
96
97     /**
98      * Verifies if the method isIdentical that is defined in the EJBObject
99      * interface.
100      * @input -
101      * @output the correct method execution.
102      * @throws Exception If an error occurs during the test.
103      */

104     @Test
105     public void testIsIdentical() throws Exception JavaDoc {
106         bean.verifyIdentity();
107     }
108
109     /**
110      * Verifies if the method remove from the interface EJBHome works.
111      * @input -
112      * @output the correct method execution.
113      * @throws Exception If an error occurs during the test.
114      */

115     @Test
116     public void testRemove() throws Exception JavaDoc {
117         bean.removeObject();
118     }
119
120     /**
121      * Verifies if the method getMetaData from the interface EJBHome works.
122      * @input -
123      * @output the correct method execution.
124      * @throws Exception If an error occurs during the test.
125      */

126     @Test
127     public void testMetadata() throws Exception JavaDoc {
128         bean.getEJBMetaData();
129     }
130 }
131
Popular Tags