KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > runner > AbstractErrorCatchingTransparentApp


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest.runner;
5
6 import com.tc.object.config.ConfigVisitor;
7 import com.tc.object.config.DSOClientConfigHelper;
8 import com.tc.simulator.app.ApplicationConfig;
9 import com.tc.simulator.listener.ListenerProvider;
10
11 /**
12  * This is a different flavor of AbstractTransparentApp that takes care of catching any exceptions and reporting them. I
13  * found myself writing this pattern far too often in individual test cases
14  */

15 public abstract class AbstractErrorCatchingTransparentApp extends AbstractTransparentApp {
16
17   public AbstractErrorCatchingTransparentApp(String JavaDoc appId, ApplicationConfig cfg, ListenerProvider listenerProvider) {
18     super(appId, cfg, listenerProvider);
19   }
20
21   public final void run() {
22     try {
23       runTest();
24     } catch (Throwable JavaDoc t) {
25       notifyError(t);
26     }
27   }
28   
29   public static void visitL1DSOConfig(ConfigVisitor visitor, DSOClientConfigHelper config) {
30     config.addIncludePattern(AbstractErrorCatchingTransparentApp.class.getName());
31   }
32
33
34   protected abstract void runTest() throws Throwable JavaDoc;
35 }
36
Popular Tags