01: /*
02: * Copyright 2007 The Kuali Foundation
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package edu.iu.uis.eden.messaging;
17:
18: import org.kuali.rice.test.TestUtilities;
19:
20: import edu.iu.uis.eden.messaging.exceptionhandling.DefaultExceptionServiceImpl;
21:
22: public class TestExceptionRoutingServiceImpl extends
23: DefaultExceptionServiceImpl {
24:
25: public void placeInExceptionRouting(Throwable throwable,
26: PersistedMessage message, Object service) {
27: ExceptionThreader exceptionThreader = new ExceptionThreader(
28: throwable, message, service, this );
29: exceptionThreader.start();
30: }
31:
32: private static class ExceptionThreader extends Thread {
33:
34: private Throwable throwable;
35: private PersistedMessage message;
36: private Object service;
37: private TestExceptionRoutingServiceImpl testExceptionService;
38:
39: public ExceptionThreader(Throwable throwable,
40: PersistedMessage message, Object service,
41: TestExceptionRoutingServiceImpl testExceptionService) {
42: this .throwable = throwable;
43: this .message = message;
44: this .service = service;
45: this .testExceptionService = testExceptionService;
46: TestUtilities.setExceptionThreader(this );
47: }
48:
49: public void run() {
50: this .testExceptionService.callRealPlaceInExceptionRouting(
51: this .throwable, this .message, this .service);
52: }
53: }
54:
55: public void callRealPlaceInExceptionRouting(Throwable throwable,
56: PersistedMessage message, Object service) {
57: super.placeInExceptionRouting(throwable, message, service);
58: }
59:
60: }
|