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.TestFailureException;
020: import org.apache.openejb.test.TestManager;
021:
022: import javax.jms.Destination;
023:
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 MdbPojoContextLookupTests extends MdbTestClient {
029: protected EncMdbObject ejbObject;
030:
031: public MdbPojoContextLookupTests() {
032: super ("PojoContextLookup.");
033: }
034:
035: protected void setUp() throws Exception {
036: super .setUp();
037: Destination destination = (Destination) initialContext
038: .lookup("ContextLookupMdbPojoBean");
039: ejbObject = MdbProxy.newProxyInstance(EncMdbObject.class,
040: connectionFactory, destination);
041: TestManager.getDatabase().createEntityTable();
042: }
043:
044: protected void tearDown() throws Exception {
045: MdbProxy.destroyProxy(ejbObject);
046: try {
047: TestManager.getDatabase().dropEntityTable();
048: } catch (Exception e) {
049: throw e;
050: } finally {
051: super .tearDown();
052: }
053: }
054:
055: public void test01_lookupStringEntry() {
056: try {
057: ejbObject.lookupStringEntry();
058: } catch (TestFailureException e) {
059: throw e.error;
060: } catch (Exception e) {
061: fail("Received Exception " + e.getClass() + " : "
062: + e.getMessage());
063: }
064: }
065:
066: public void test02_lookupDoubleEntry() {
067: try {
068: ejbObject.lookupDoubleEntry();
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 test03_lookupLongEntry() {
078: try {
079: ejbObject.lookupLongEntry();
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 test04_lookupFloatEntry() {
089: try {
090: ejbObject.lookupFloatEntry();
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 test05_lookupIntegerEntry() {
100: try {
101: ejbObject.lookupIntegerEntry();
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 test06_lookupShortEntry() {
111: try {
112: ejbObject.lookupShortEntry();
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 test07_lookupBooleanEntry() {
122: try {
123: ejbObject.lookupBooleanEntry();
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 test08_lookupByteEntry() {
133: try {
134: ejbObject.lookupByteEntry();
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 test09_lookupCharacterEntry() {
144: try {
145: ejbObject.lookupCharacterEntry();
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 test10_lookupEntityBean() {
155: try {
156: ejbObject.lookupEntityBean();
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 test11_lookupStatefulBean() {
166: try {
167: ejbObject.lookupStatefulBean();
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 test12_lookupStatelessBean() {
177: try {
178: ejbObject.lookupStatelessBean();
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 test13_lookupResource() {
188: try {
189: ejbObject.lookupResource();
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 test14_lookupPersistenceUnit() {
199: try {
200: ejbObject.lookupPersistenceUnit();
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 test15_lookupPersistenceContext() {
210: try {
211: ejbObject.lookupPersistenceContext();
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 test18_lookupMessageDrivenContext() {
221: try {
222: ejbObject.lookupMessageDrivenContext();
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 test23_lookupJMSConnectionFactory() {
232: try {
233: ejbObject.lookupJMSConnectionFactory();
234: } catch (TestFailureException e) {
235: throw e.error;
236: } catch (Exception e) {
237: fail("Received Exception " + e.getClass() + " : "
238: + e.getMessage());
239: }
240: }
241: }
|