001: /**
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */package org.apache.openejb.test.stateful;
017:
018: import org.apache.openejb.test.TestManager;
019: import org.apache.openejb.test.TestFailureException;
020:
021: /**
022: * [4] Should be run as the fourth test suite of the StatefulTestClients
023: *
024: * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
025: * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
026: */
027: public class StatefulFieldInjectionTests extends StatefulTestClient {
028:
029: protected EncStatefulHome ejbHome;
030: protected EncStatefulObject ejbObject;
031:
032: public StatefulFieldInjectionTests() {
033: super ("EJB_CONTEXT_LOOKUP.");
034: }
035:
036: protected void setUp() throws Exception {
037: super .setUp();
038: Object obj = initialContext
039: .lookup("client/tests/stateful/FieldInjectionStatefulBean");
040: ejbHome = (EncStatefulHome) javax.rmi.PortableRemoteObject
041: .narrow(obj, EncStatefulHome.class);
042: ejbObject = ejbHome.create("Enc Bean");
043:
044: /*[2] Create database table */
045: TestManager.getDatabase().createEntityTable();
046: }
047:
048: /**
049: * Tears down the fixture, for example, close a network connection.
050: * This method is called after a test is executed.
051: */
052: protected void tearDown() throws Exception {
053: try {
054: /*[1] Drop database table */
055: TestManager.getDatabase().dropEntityTable();
056: } catch (Exception e) {
057: throw e;
058: } finally {
059: super .tearDown();
060: }
061: }
062:
063: public void test01_lookupStringEntry() {
064: try {
065: ejbObject.lookupStringEntry();
066: } catch (TestFailureException e) {
067: throw e.error;
068: } catch (Exception e) {
069: fail("Received Exception " + e.getClass() + " : "
070: + e.getMessage());
071: }
072: }
073:
074: public void test02_lookupDoubleEntry() {
075: try {
076: ejbObject.lookupDoubleEntry();
077: } catch (TestFailureException e) {
078: throw e.error;
079: } catch (Exception e) {
080: fail("Received Exception " + e.getClass() + " : "
081: + e.getMessage());
082: }
083: }
084:
085: public void test03_lookupLongEntry() {
086: try {
087: ejbObject.lookupLongEntry();
088: } catch (TestFailureException e) {
089: throw e.error;
090: } catch (Exception e) {
091: fail("Received Exception " + e.getClass() + " : "
092: + e.getMessage());
093: }
094: }
095:
096: public void test04_lookupFloatEntry() {
097: try {
098: ejbObject.lookupFloatEntry();
099: } catch (TestFailureException e) {
100: throw e.error;
101: } catch (Exception e) {
102: fail("Received Exception " + e.getClass() + " : "
103: + e.getMessage());
104: }
105: }
106:
107: public void test05_lookupIntegerEntry() {
108: try {
109: ejbObject.lookupIntegerEntry();
110: } catch (TestFailureException e) {
111: throw e.error;
112: } catch (Exception e) {
113: fail("Received Exception " + e.getClass() + " : "
114: + e.getMessage());
115: }
116: }
117:
118: public void test06_lookupShortEntry() {
119: try {
120: ejbObject.lookupShortEntry();
121: } catch (TestFailureException e) {
122: throw e.error;
123: } catch (Exception e) {
124: fail("Received Exception " + e.getClass() + " : "
125: + e.getMessage());
126: }
127: }
128:
129: public void test07_lookupBooleanEntry() {
130: try {
131: ejbObject.lookupBooleanEntry();
132: } catch (TestFailureException e) {
133: throw e.error;
134: } catch (Exception e) {
135: fail("Received Exception " + e.getClass() + " : "
136: + e.getMessage());
137: }
138: }
139:
140: public void test08_lookupByteEntry() {
141: try {
142: ejbObject.lookupByteEntry();
143: } catch (TestFailureException e) {
144: throw e.error;
145: } catch (Exception e) {
146: fail("Received Exception " + e.getClass() + " : "
147: + e.getMessage());
148: }
149: }
150:
151: public void test09_lookupCharacterEntry() {
152: try {
153: ejbObject.lookupCharacterEntry();
154: } catch (TestFailureException e) {
155: throw e.error;
156: } catch (Exception e) {
157: fail("Received Exception " + e.getClass() + " : "
158: + e.getMessage());
159: }
160: }
161:
162: public void test10_lookupEntityBean() {
163: try {
164: ejbObject.lookupEntityBean();
165: } catch (TestFailureException e) {
166: throw e.error;
167: } catch (Exception e) {
168: fail("Received Exception " + e.getClass() + " : "
169: + e.getMessage());
170: }
171: }
172:
173: public void test11_lookupStatefulBean() {
174: try {
175: ejbObject.lookupStatefulBean();
176: } catch (TestFailureException e) {
177: throw e.error;
178: } catch (Exception e) {
179: fail("Received Exception " + e.getClass() + " : "
180: + e.getMessage());
181: }
182: }
183:
184: public void test12_lookupStatelessBean() {
185: try {
186: ejbObject.lookupStatelessBean();
187: } catch (TestFailureException e) {
188: throw e.error;
189: } catch (Exception e) {
190: fail("Received Exception " + e.getClass() + " : "
191: + e.getMessage());
192: }
193: }
194:
195: public void test13_lookupResource() {
196: try {
197: ejbObject.lookupResource();
198: } catch (TestFailureException e) {
199: throw e.error;
200: } catch (Exception e) {
201: fail("Received Exception " + e.getClass() + " : "
202: + e.getMessage());
203: }
204: }
205:
206: public void test14_lookupPersistenceUnit() {
207: try {
208: ejbObject.lookupPersistenceUnit();
209: } catch (TestFailureException e) {
210: throw e.error;
211: } catch (Exception e) {
212: fail("Received Exception " + e.getClass() + " : "
213: + e.getMessage());
214: }
215: }
216:
217: public void test15_lookupPersistenceContext() {
218: try {
219: ejbObject.lookupPersistenceContext();
220: } catch (TestFailureException e) {
221: throw e.error;
222: } catch (Exception e) {
223: fail("Received Exception " + e.getClass() + " : "
224: + e.getMessage());
225: }
226: }
227:
228: public void test18_lookupSessionContext() {
229: try {
230: ejbObject.lookupSessionContext();
231: } catch (TestFailureException e) {
232: throw e.error;
233: } catch (Exception e) {
234: fail("Received Exception " + e.getClass() + " : "
235: + e.getMessage());
236: }
237: }
238:
239: public void test19_lookupStatelessBusinessLocal() {
240: try {
241: ejbObject.lookupStatelessBusinessLocal();
242: } catch (TestFailureException e) {
243: throw e.error;
244: } catch (Exception e) {
245: fail("Received Exception " + e.getClass() + " : "
246: + e.getMessage());
247: }
248: }
249:
250: public void test20_lookupStatelessBusinessRemote() {
251: try {
252: ejbObject.lookupStatelessBusinessRemote();
253: } catch (TestFailureException e) {
254: throw e.error;
255: } catch (Exception e) {
256: fail("Received Exception " + e.getClass() + " : "
257: + e.getMessage());
258: }
259: }
260:
261: public void test21_lookupStatefulBusinessLocal() {
262: try {
263: ejbObject.lookupStatefulBusinessLocal();
264: } catch (TestFailureException e) {
265: throw e.error;
266: } catch (Exception e) {
267: fail("Received Exception " + e.getClass() + " : "
268: + e.getMessage());
269: }
270: }
271:
272: public void test22_lookupStatefulBusinessRemote() {
273: try {
274: ejbObject.lookupStatefulBusinessRemote();
275: } catch (TestFailureException e) {
276: throw e.error;
277: } catch (Exception e) {
278: fail("Received Exception " + e.getClass() + " : "
279: + e.getMessage());
280: }
281: }
282:
283: public void test23_lookupJMSConnectionFactory() {
284: try {
285: ejbObject.lookupJMSConnectionFactory();
286: } catch (TestFailureException e) {
287: throw e.error;
288: } catch (Exception e) {
289: fail("Received Exception " + e.getClass() + " : "
290: + e.getMessage());
291: }
292: }
293: }
|