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