01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tctest.runner;
06:
07: import com.tc.object.config.ConfigVisitor;
08: import com.tc.object.config.DSOClientConfigHelper;
09: import com.tc.simulator.app.ApplicationConfig;
10: import com.tc.simulator.listener.ListenerProvider;
11:
12: /**
13: * This is a different flavor of AbstractTransparentApp that takes care of catching any exceptions and reporting them. I
14: * found myself writing this pattern far too often in individual test cases
15: */
16: public abstract class AbstractErrorCatchingTransparentApp extends
17: AbstractTransparentApp {
18:
19: public AbstractErrorCatchingTransparentApp(String appId,
20: ApplicationConfig cfg, ListenerProvider listenerProvider) {
21: super (appId, cfg, listenerProvider);
22: }
23:
24: // used by external clients
25: public AbstractErrorCatchingTransparentApp() {
26: super ();
27: }
28:
29: public final void run() {
30: try {
31: runTest();
32: } catch (Throwable t) {
33: notifyError(t);
34: }
35: }
36:
37: public static void visitL1DSOConfig(ConfigVisitor visitor,
38: DSOClientConfigHelper config) {
39: config
40: .addIncludePattern(AbstractErrorCatchingTransparentApp.class
41: .getName());
42: }
43:
44: protected abstract void runTest() throws Throwable;
45: }
|