1 4 package com.tctest; 5 6 import com.tc.object.config.ConfigVisitor; 7 import com.tc.object.config.DSOClientConfigHelper; 8 import com.tc.object.config.TransparencyClassSpec; 9 import com.tc.simulator.app.ApplicationConfig; 10 import com.tc.simulator.listener.ListenerProvider; 11 import com.tctest.runner.AbstractTransparentApp; 12 13 import java.util.HashMap ; 14 import java.util.Map ; 15 16 19 public class TransparencyExceptionTestApp extends AbstractTransparentApp { 20 private Map myRoot = new HashMap (); 21 private boolean fail = true; 22 23 public TransparencyExceptionTestApp (String appId, ApplicationConfig cfg, ListenerProvider listenerProvider) { 24 super(appId, cfg, listenerProvider); 25 } 26 27 public static void visitL1DSOConfig(ConfigVisitor visitor, DSOClientConfigHelper config) { 28 TransparencyClassSpec spec = config.getOrCreateSpec("com.tctest.TransparencyExceptionTestApp"); 29 spec.addRoot("myRoot", "rootBabyRoot"); 30 String methodExpression = "void com.tctest.TransparencyExceptionTestApp.test1()"; 31 config.addWriteAutolock(methodExpression); 32 } 33 34 public void run() { 35 test(); 36 fail = false; 37 test(); 38 } 39 40 public void test() { 41 try { 42 test1(); 43 } catch (AssertionError e) { 44 if(fail) { 45 System.out.println("SUCCESS"); 46 } else { 47 throw new AssertionError ("Failed !!"); 48 } 49 return; 50 } 51 if(fail) { 52 throw new AssertionError ("Failed !!"); 53 } else { 54 System.out.println("SUCCESS"); 55 } 56 } 57 58 public void test1() { 59 synchronized (myRoot) { 60 myRoot.put(new Long (1), new Long (1)); 61 if(fail) throw new AssertionError ("Testing one two three"); 62 } 63 } 64 65 }
| Popular Tags
|