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