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.stateless;
017:
018: import org.apache.openejb.test.stateful.StatefulTestClient;
019: import org.apache.openejb.test.stateful.EncStatefulHome;
020: import org.apache.openejb.test.stateful.EncStatefulObject;
021: import org.apache.openejb.test.TestManager;
022: import org.apache.openejb.test.TestFailureException;
023:
024: /**
025: * [4] Should be run as the fourth test suite of the StatefulTestClients
026: *
027: * @author <a href="mailto:david.blevins@visi.com">David Blevins</a>
028: * @author <a href="mailto:Richard@Monson-Haefel.com">Richard Monson-Haefel</a>
029: */
030: public class StatelessFieldInjectionTests extends StatefulTestClient {
031:
032: protected EncStatelessHome ejbHome;
033: protected EncStatelessObject ejbObject;
034:
035: public StatelessFieldInjectionTests() {
036: super ("FieldInjection.");
037: }
038:
039: protected void setUp() throws Exception {
040: super .setUp();
041: Object obj = initialContext
042: .lookup("client/tests/stateless/FieldInjectionStatelessBean");
043: ejbHome = (EncStatelessHome) javax.rmi.PortableRemoteObject
044: .narrow(obj, EncStatelessHome.class);
045: ejbObject = ejbHome.create();
046:
047: /*[2] Create database table */
048: TestManager.getDatabase().createEntityTable();
049: }
050:
051: /**
052: * Tears down the fixture, for example, close a network connection.
053: * This method is called after a test is executed.
054: */
055: protected void tearDown() throws Exception {
056: try {
057: /*[1] Drop database table */
058: TestManager.getDatabase().dropEntityTable();
059: } catch (Exception e) {
060: throw e;
061: } finally {
062: super .tearDown();
063: }
064: }
065:
066: public void test01_lookupStringEntry() {
067: try {
068: ejbObject.lookupStringEntry();
069: } catch (TestFailureException e) {
070: throw e.error;
071: } catch (Exception e) {
072: fail("Received Exception " + e.getClass() + " : "
073: + e.getMessage());
074: }
075: }
076:
077: public void test02_lookupDoubleEntry() {
078: try {
079: ejbObject.lookupDoubleEntry();
080: } catch (TestFailureException e) {
081: throw e.error;
082: } catch (Exception e) {
083: fail("Received Exception " + e.getClass() + " : "
084: + e.getMessage());
085: }
086: }
087:
088: public void test03_lookupLongEntry() {
089: try {
090: ejbObject.lookupLongEntry();
091: } catch (TestFailureException e) {
092: throw e.error;
093: } catch (Exception e) {
094: fail("Received Exception " + e.getClass() + " : "
095: + e.getMessage());
096: }
097: }
098:
099: public void test04_lookupFloatEntry() {
100: try {
101: ejbObject.lookupFloatEntry();
102: } catch (TestFailureException e) {
103: throw e.error;
104: } catch (Exception e) {
105: fail("Received Exception " + e.getClass() + " : "
106: + e.getMessage());
107: }
108: }
109:
110: public void test05_lookupIntegerEntry() {
111: try {
112: ejbObject.lookupIntegerEntry();
113: } catch (TestFailureException e) {
114: throw e.error;
115: } catch (Exception e) {
116: fail("Received Exception " + e.getClass() + " : "
117: + e.getMessage());
118: }
119: }
120:
121: public void test06_lookupShortEntry() {
122: try {
123: ejbObject.lookupShortEntry();
124: } catch (TestFailureException e) {
125: throw e.error;
126: } catch (Exception e) {
127: fail("Received Exception " + e.getClass() + " : "
128: + e.getMessage());
129: }
130: }
131:
132: public void test07_lookupBooleanEntry() {
133: try {
134: ejbObject.lookupBooleanEntry();
135: } catch (TestFailureException e) {
136: throw e.error;
137: } catch (Exception e) {
138: fail("Received Exception " + e.getClass() + " : "
139: + e.getMessage());
140: }
141: }
142:
143: public void test08_lookupByteEntry() {
144: try {
145: ejbObject.lookupByteEntry();
146: } catch (TestFailureException e) {
147: throw e.error;
148: } catch (Exception e) {
149: fail("Received Exception " + e.getClass() + " : "
150: + e.getMessage());
151: }
152: }
153:
154: public void test09_lookupCharacterEntry() {
155: try {
156: ejbObject.lookupCharacterEntry();
157: } catch (TestFailureException e) {
158: throw e.error;
159: } catch (Exception e) {
160: fail("Received Exception " + e.getClass() + " : "
161: + e.getMessage());
162: }
163: }
164:
165: public void test10_lookupEntityBean() {
166: try {
167: ejbObject.lookupEntityBean();
168: } catch (TestFailureException e) {
169: throw e.error;
170: } catch (Exception e) {
171: fail("Received Exception " + e.getClass() + " : "
172: + e.getMessage());
173: }
174: }
175:
176: public void test11_lookupStatefulBean() {
177: try {
178: ejbObject.lookupStatefulBean();
179: } catch (TestFailureException e) {
180: throw e.error;
181: } catch (Exception e) {
182: fail("Received Exception " + e.getClass() + " : "
183: + e.getMessage());
184: }
185: }
186:
187: public void test12_lookupStatelessBean() {
188: try {
189: ejbObject.lookupStatelessBean();
190: } catch (TestFailureException e) {
191: throw e.error;
192: } catch (Exception e) {
193: fail("Received Exception " + e.getClass() + " : "
194: + e.getMessage());
195: }
196: }
197:
198: public void test13_lookupResource() {
199: try {
200: ejbObject.lookupResource();
201: } catch (TestFailureException e) {
202: throw e.error;
203: } catch (Exception e) {
204: fail("Received Exception " + e.getClass() + " : "
205: + e.getMessage());
206: }
207: }
208:
209: public void test14_lookupPersistenceUnit() {
210: try {
211: ejbObject.lookupPersistenceUnit();
212: } catch (TestFailureException e) {
213: throw e.error;
214: } catch (Exception e) {
215: fail("Received Exception " + e.getClass() + " : "
216: + e.getMessage());
217: }
218: }
219:
220: public void test15_lookupPersistenceContext() {
221: try {
222: ejbObject.lookupPersistenceContext();
223: } catch (TestFailureException e) {
224: throw e.error;
225: } catch (Exception e) {
226: fail("Received Exception " + e.getClass() + " : "
227: + e.getMessage());
228: }
229: }
230:
231: public void test18_lookupSessionContext() {
232: try {
233: ejbObject.lookupSessionContext();
234: } catch (TestFailureException e) {
235: throw e.error;
236: } catch (Exception e) {
237: fail("Received Exception " + e.getClass() + " : "
238: + e.getMessage());
239: }
240: }
241:
242: public void test19_lookupStatelessBusinessLocal() {
243: try {
244: ejbObject.lookupStatelessBusinessLocal();
245: } catch (TestFailureException e) {
246: throw e.error;
247: } catch (Exception e) {
248: fail("Received Exception " + e.getClass() + " : "
249: + e.getMessage());
250: }
251: }
252:
253: public void test20_lookupStatelessBusinessRemote() {
254: try {
255: ejbObject.lookupStatelessBusinessRemote();
256: } catch (TestFailureException e) {
257: throw e.error;
258: } catch (Exception e) {
259: fail("Received Exception " + e.getClass() + " : "
260: + e.getMessage());
261: }
262: }
263:
264: public void test21_lookupStatefulBusinessLocal() {
265: try {
266: ejbObject.lookupStatefulBusinessLocal();
267: } catch (TestFailureException e) {
268: throw e.error;
269: } catch (Exception e) {
270: fail("Received Exception " + e.getClass() + " : "
271: + e.getMessage());
272: }
273: }
274:
275: public void test22_lookupStatefulBusinessRemote() {
276: try {
277: ejbObject.lookupStatefulBusinessRemote();
278: } catch (TestFailureException e) {
279: throw e.error;
280: } catch (Exception e) {
281: fail("Received Exception " + e.getClass() + " : "
282: + e.getMessage());
283: }
284: }
285:
286: public void test23_lookupJMSConnectionFactory() {
287: try {
288: ejbObject.lookupJMSConnectionFactory();
289: } catch (TestFailureException e) {
290: throw e.error;
291: } catch (Exception e) {
292: fail("Received Exception " + e.getClass() + " : "
293: + e.getMessage());
294: }
295: }
296: }
|