001: /**
002: *
003: * Licensed to the Apache Software Foundation (ASF) under one or more
004: * contributor license agreements. See the NOTICE file distributed with
005: * this work for additional information regarding copyright ownership.
006: * The ASF licenses this file to You under the Apache License, Version 2.0
007: * (the "License"); you may not use this file except in compliance with
008: * the License. You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */package org.apache.openejb.test.mdb;
018:
019: import org.apache.openejb.test.TestManager;
020: import org.apache.openejb.test.TestFailureException;
021:
022: import javax.jms.Destination;
023:
024: /**
025: * [4] Should be run as the fourth test suite of the EncStatelessTestClients
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 MdbContextLookupTests extends MdbTestClient {
031: protected EncMdbObject ejbObject;
032:
033: public MdbContextLookupTests() {
034: super ("ContextLookup.");
035: }
036:
037: protected void setUp() throws Exception {
038: super .setUp();
039: Destination destination = (Destination) initialContext
040: .lookup("ContextLookupMdbBean");
041: ejbObject = MdbProxy.newProxyInstance(EncMdbObject.class,
042: connectionFactory, destination);
043: TestManager.getDatabase().createEntityTable();
044: }
045:
046: protected void tearDown() throws Exception {
047: MdbProxy.destroyProxy(ejbObject);
048: try {
049: TestManager.getDatabase().dropEntityTable();
050: } catch (Exception e) {
051: throw e;
052: } finally {
053: super .tearDown();
054: }
055: }
056:
057: public void test01_lookupStringEntry() {
058: try {
059: ejbObject.lookupStringEntry();
060: } catch (TestFailureException e) {
061: throw e.error;
062: } catch (Exception e) {
063: fail("Received Exception " + e.getClass() + " : "
064: + e.getMessage());
065: }
066: }
067:
068: public void test02_lookupDoubleEntry() {
069: try {
070: ejbObject.lookupDoubleEntry();
071: } catch (TestFailureException e) {
072: throw e.error;
073: } catch (Exception e) {
074: fail("Received Exception " + e.getClass() + " : "
075: + e.getMessage());
076: }
077: }
078:
079: public void test03_lookupLongEntry() {
080: try {
081: ejbObject.lookupLongEntry();
082: } catch (TestFailureException e) {
083: throw e.error;
084: } catch (Exception e) {
085: fail("Received Exception " + e.getClass() + " : "
086: + e.getMessage());
087: }
088: }
089:
090: public void test04_lookupFloatEntry() {
091: try {
092: ejbObject.lookupFloatEntry();
093: } catch (TestFailureException e) {
094: throw e.error;
095: } catch (Exception e) {
096: fail("Received Exception " + e.getClass() + " : "
097: + e.getMessage());
098: }
099: }
100:
101: public void test05_lookupIntegerEntry() {
102: try {
103: ejbObject.lookupIntegerEntry();
104: } catch (TestFailureException e) {
105: throw e.error;
106: } catch (Exception e) {
107: fail("Received Exception " + e.getClass() + " : "
108: + e.getMessage());
109: }
110: }
111:
112: public void test06_lookupShortEntry() {
113: try {
114: ejbObject.lookupShortEntry();
115: } catch (TestFailureException e) {
116: throw e.error;
117: } catch (Exception e) {
118: fail("Received Exception " + e.getClass() + " : "
119: + e.getMessage());
120: }
121: }
122:
123: public void test07_lookupBooleanEntry() {
124: try {
125: ejbObject.lookupBooleanEntry();
126: } catch (TestFailureException e) {
127: throw e.error;
128: } catch (Exception e) {
129: fail("Received Exception " + e.getClass() + " : "
130: + e.getMessage());
131: }
132: }
133:
134: public void test08_lookupByteEntry() {
135: try {
136: ejbObject.lookupByteEntry();
137: } catch (TestFailureException e) {
138: throw e.error;
139: } catch (Exception e) {
140: fail("Received Exception " + e.getClass() + " : "
141: + e.getMessage());
142: }
143: }
144:
145: public void test09_lookupCharacterEntry() {
146: try {
147: ejbObject.lookupCharacterEntry();
148: } catch (TestFailureException e) {
149: throw e.error;
150: } catch (Exception e) {
151: fail("Received Exception " + e.getClass() + " : "
152: + e.getMessage());
153: }
154: }
155:
156: public void test10_lookupEntityBean() {
157: try {
158: ejbObject.lookupEntityBean();
159: } catch (TestFailureException e) {
160: throw e.error;
161: } catch (Exception e) {
162: fail("Received Exception " + e.getClass() + " : "
163: + e.getMessage());
164: }
165: }
166:
167: public void test11_lookupStatefulBean() {
168: try {
169: ejbObject.lookupStatefulBean();
170: } catch (TestFailureException e) {
171: throw e.error;
172: } catch (Exception e) {
173: fail("Received Exception " + e.getClass() + " : "
174: + e.getMessage());
175: }
176: }
177:
178: public void test12_lookupStatelessBean() {
179: try {
180: ejbObject.lookupStatelessBean();
181: } catch (TestFailureException e) {
182: throw e.error;
183: } catch (Exception e) {
184: fail("Received Exception " + e.getClass() + " : "
185: + e.getMessage());
186: }
187: }
188:
189: public void test13_lookupResource() {
190: try {
191: ejbObject.lookupResource();
192: } catch (TestFailureException e) {
193: throw e.error;
194: } catch (Exception e) {
195: fail("Received Exception " + e.getClass() + " : "
196: + e.getMessage());
197: }
198: }
199:
200: public void test14_lookupPersistenceUnit() {
201: try {
202: ejbObject.lookupPersistenceUnit();
203: } catch (TestFailureException e) {
204: throw e.error;
205: } catch (Exception e) {
206: fail("Received Exception " + e.getClass() + " : "
207: + e.getMessage());
208: }
209: }
210:
211: public void test15_lookupPersistenceContext() {
212: try {
213: ejbObject.lookupPersistenceContext();
214: } catch (TestFailureException e) {
215: throw e.error;
216: } catch (Exception e) {
217: fail("Received Exception " + e.getClass() + " : "
218: + e.getMessage());
219: }
220: }
221:
222: public void test18_lookupMessageDrivenContext() {
223: try {
224: ejbObject.lookupMessageDrivenContext();
225: } catch (TestFailureException e) {
226: throw e.error;
227: } catch (Exception e) {
228: fail("Received Exception " + e.getClass() + " : "
229: + e.getMessage());
230: }
231: }
232:
233: public void test23_lookupJMSConnectionFactory() {
234: try {
235: ejbObject.lookupJMSConnectionFactory();
236: } catch (TestFailureException e) {
237: throw e.error;
238: } catch (Exception e) {
239: fail("Received Exception " + e.getClass() + " : "
240: + e.getMessage());
241: }
242: }
243: }
|