01: /*
02: * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
03: */
04: package com.tctest;
05:
06: import com.tc.exception.TCNonPortableObjectError;
07: import com.tc.object.config.ConfigVisitor;
08: import com.tc.object.config.DSOClientConfigHelper;
09: import com.tc.object.config.TransparencyClassSpec;
10: import com.tc.simulator.app.ApplicationConfig;
11: import com.tc.simulator.listener.ListenerProvider;
12: import com.tc.util.Assert;
13: import com.tctest.runner.AbstractTransparentApp;
14:
15: import javax.swing.Timer;
16:
17: public class UnsharedClassAsRootTestApp extends AbstractTransparentApp {
18:
19: private Timer timer;
20:
21: public UnsharedClassAsRootTestApp(String appId,
22: ApplicationConfig cfg, ListenerProvider listenerProvider) {
23: super (appId, cfg, listenerProvider);
24: try {
25: timer = new Timer(0, null);
26: throw new AssertionError("Should have failed");
27: } catch (TCNonPortableObjectError tnp) {
28: // Expected
29: }
30: }
31:
32: public void run() {
33: Assert.assertNull(timer);
34: System.err.println("Timer = " + timer);
35: }
36:
37: public static void visitL1DSOConfig(ConfigVisitor visitor,
38: DSOClientConfigHelper config) {
39: String testClass = UnsharedClassAsRootTestApp.class.getName();
40: TransparencyClassSpec spec = config.getOrCreateSpec(testClass);
41:
42: String methodExpression = "* " + testClass + "*.*(..)";
43: config.addWriteAutolock(methodExpression);
44:
45: spec.addRoot("timer", "timer");
46: }
47:
48: }
|