01: /**
02: *
03: * Licensed to the Apache Software Foundation (ASF) under one or more
04: * contributor license agreements. See the NOTICE file distributed with
05: * this work for additional information regarding copyright ownership.
06: * The ASF licenses this file to You under the Apache License, Version 2.0
07: * (the "License"); you may not use this file except in compliance with
08: * the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing, software
13: * distributed under the License is distributed on an "AS IS" BASIS,
14: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15: * See the License for the specific language governing permissions and
16: * limitations under the License.
17: */package org.apache.openejb.test.mdb;
18:
19: import org.apache.openejb.test.TestFailureException;
20: import org.apache.openejb.test.TestManager;
21:
22: import javax.jms.Destination;
23:
24: public class MdbInterceptorTests extends MdbTestClient {
25:
26: public MdbInterceptorTests() {
27: super ("MDBInterceptor.");
28: // TODO Auto-generated constructor stub
29: }
30:
31: protected InterceptorMdbObject ejbObject;
32:
33: protected void setUp() throws Exception {
34: super .setUp();
35: Destination destination = (Destination) initialContext
36: .lookup("InterceptorMdbBean");
37: ejbObject = MdbProxy.newProxyInstance(
38: InterceptorMdbObject.class, connectionFactory,
39: destination);
40: TestManager.getDatabase().createEntityTable();
41: }
42:
43: protected void tearDown() throws Exception {
44: MdbProxy.destroyProxy(ejbObject);
45: try {
46: TestManager.getDatabase().dropEntityTable();
47: } catch (Exception e) {
48: throw e;
49: } finally {
50: super .tearDown();
51: }
52: }
53:
54: public void test01_checkClassLevelBusinessMethodInterception() {
55: try {
56: ejbObject.checkClassLevelBusinessMethodInterception();
57: } catch (TestFailureException e) {
58: throw e.error;
59: } catch (Exception e) {
60: fail("Received Exception " + e.getClass() + " : "
61: + e.getMessage());
62: }
63: }
64:
65: public void test02_checkMethodLevelBusinessMethodInterception() {
66: try {
67: ejbObject.checkMethodLevelBusinessMethodInterception();
68: } catch (TestFailureException e) {
69: throw e.error;
70: } catch (Exception e) {
71: fail("Received Exception " + e.getClass() + " : "
72: + e.getMessage());
73: }
74: }
75:
76: public void test03_checkClassLevelCreateMethodInterception() {
77: try {
78: ejbObject.checkClassLevelCreateMethodInterception();
79: } catch (TestFailureException e) {
80: throw e.error;
81: } catch (Exception e) {
82: fail("Received Exception " + e.getClass() + " : "
83: + e.getMessage());
84: }
85: }
86:
87: public void test04_checkMethodLevelCreateMethodInterception() {
88: try {
89: ejbObject.checkMethodLevelCreateMethodInterception();
90: } catch (TestFailureException e) {
91: throw e.error;
92: } catch (Exception e) {
93: fail("Received Exception " + e.getClass() + " : "
94: + e.getMessage());
95: }
96: }
97:
98: }
|