KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openejb > test > stateful > StatefulJndiEncTests


1 /**
2  * Redistribution and use of this software and associated documentation
3  * ("Software"), with or without modification, are permitted provided
4  * that the following conditions are met:
5  *
6  * 1. Redistributions of source code must retain copyright
7  * statements and notices. Redistributions must also contain a
8  * copy of this document.
9  *
10  * 2. Redistributions in binary form must reproduce the
11  * above copyright notice, this list of conditions and the
12  * following disclaimer in the documentation and/or other
13  * materials provided with the distribution.
14  *
15  * 3. The name "Exolab" must not be used to endorse or promote
16  * products derived from this Software without prior written
17  * permission of Exoffice Technologies. For written permission,
18  * please contact info@exolab.org.
19  *
20  * 4. Products derived from this Software may not be called "Exolab"
21  * nor may "Exolab" appear in their names without prior written
22  * permission of Exoffice Technologies. Exolab is a registered
23  * trademark of Exoffice Technologies.
24  *
25  * 5. Due credit should be given to the Exolab Project
26  * (http://www.exolab.org/).
27  *
28  * THIS SOFTWARE IS PROVIDED BY EXOFFICE TECHNOLOGIES AND CONTRIBUTORS
29  * ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
30  * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
31  * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
32  * EXOFFICE TECHNOLOGIES OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
33  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
34  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
35  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
37  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
39  * OF THE POSSIBILITY OF SUCH DAMAGE.
40  *
41  * Copyright 1999 (C) Exoffice Technologies Inc. All Rights Reserved.
42  *
43  * $Id: StatefulJndiEncTests.java 1096 2004-03-26 21:41:16Z dblevins $
44  */

45 package org.openejb.test.stateful;
46
47 import org.openejb.test.TestFailureException;
48 import org.openejb.test.TestManager;
49
50 /**
51  * [4] Should be run as the fourth test suite of the StatefulTestClients
52  *
53  * @author <a HREF="mailto:david.blevins@visi.com">David Blevins</a>
54  * @author <a HREF="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
55  */

56 public class StatefulJndiEncTests extends StatefulTestClient{
57     
58     protected EncStatefulHome ejbHome;
59     protected EncStatefulObject ejbObject;
60     
61     public StatefulJndiEncTests(){
62         super("JNDI_ENC.");
63     }
64
65     protected void setUp() throws Exception JavaDoc{
66         super.setUp();
67         Object JavaDoc obj = initialContext.lookup("client/tests/stateful/EncBean");
68         ejbHome = (EncStatefulHome)javax.rmi.PortableRemoteObject.narrow( obj, EncStatefulHome.class);
69         ejbObject = ejbHome.create("Enc Bean");
70         
71         /*[2] Create database table */
72         TestManager.getDatabase().createEntityTable();
73     }
74     
75     /**
76      * Tears down the fixture, for example, close a network connection.
77      * This method is called after a test is executed.
78      */

79     protected void tearDown() throws Exception JavaDoc {
80         try {
81             /*[1] Drop database table */
82             TestManager.getDatabase().dropEntityTable();
83         } catch (Exception JavaDoc e){
84             throw e;
85         } finally {
86             super.tearDown();
87         }
88     }
89     
90     public void test01_lookupStringEntry() {
91         try{
92             ejbObject.lookupStringEntry();
93         } catch (TestFailureException e){
94             throw e.error;
95         } catch (Exception JavaDoc e){
96             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
97         }
98     }
99     
100     public void test02_lookupDoubleEntry() {
101         try{
102             ejbObject.lookupDoubleEntry();
103         } catch (TestFailureException e){
104             throw e.error;
105         } catch (Exception JavaDoc e){
106             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
107         }
108     }
109     
110     public void test03_lookupLongEntry() {
111         try{
112             ejbObject.lookupLongEntry();
113         } catch (TestFailureException e){
114             throw e.error;
115         } catch (Exception JavaDoc e){
116             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
117         }
118     }
119     
120     public void test04_lookupFloatEntry() {
121         try{
122             ejbObject.lookupFloatEntry();
123         } catch (TestFailureException e){
124             throw e.error;
125         } catch (Exception JavaDoc e){
126             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
127         }
128     }
129     
130     public void test05_lookupIntegerEntry() {
131         try{
132             ejbObject.lookupIntegerEntry();
133         } catch (TestFailureException e){
134             throw e.error;
135         } catch (Exception JavaDoc e){
136             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
137         }
138     }
139     
140     public void test06_lookupShortEntry() {
141         try{
142             ejbObject.lookupShortEntry();
143         } catch (TestFailureException e){
144             throw e.error;
145         } catch (Exception JavaDoc e){
146             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
147         }
148     }
149     
150     public void test07_lookupBooleanEntry() {
151         try{
152             ejbObject.lookupBooleanEntry();
153         } catch (TestFailureException e){
154             throw e.error;
155         } catch (Exception JavaDoc e){
156             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
157         }
158     }
159     
160     public void test08_lookupByteEntry() {
161         try{
162             ejbObject.lookupByteEntry();
163         } catch (TestFailureException e){
164             throw e.error;
165         } catch (Exception JavaDoc e){
166             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
167         }
168     }
169     
170     public void test09_lookupEntityBean() {
171         try{
172             ejbObject.lookupEntityBean();
173         } catch (TestFailureException e){
174             throw e.error;
175         } catch (Exception JavaDoc e){
176             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
177         }
178     }
179     
180     public void test10_lookupStatefulBean() {
181         try{
182             ejbObject.lookupStatefulBean();
183         } catch (TestFailureException e){
184             throw e.error;
185         } catch (Exception JavaDoc e){
186             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
187         }
188     }
189     
190     public void test11_lookupStatelessBean() {
191         try{
192             ejbObject.lookupStatelessBean();
193         } catch (TestFailureException e){
194             throw e.error;
195         } catch (Exception JavaDoc e){
196             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
197         }
198     }
199     
200     public void test12_lookupResource() {
201         try{
202             ejbObject.lookupResource();
203         } catch (TestFailureException e){
204             throw e.error;
205         } catch (Exception JavaDoc e){
206             fail("Received Exception "+e.getClass()+ " : "+e.getMessage());
207         }
208     }
209     
210 }
211
Popular Tags