KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > transparency > InstrumentNothingTest


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.transparency;
5
6 import com.tc.object.bytecode.TransparentAccess;
7 import com.tc.simulator.app.ApplicationConfig;
8 import com.tc.simulator.listener.ListenerProvider;
9 import com.tctest.TestConfigurator;
10 import com.tctest.TransparentTestBase;
11 import com.tctest.TransparentTestIface;
12 import com.tctest.runner.AbstractTransparentApp;
13
14 public class InstrumentNothingTest extends TransparentTestBase implements TestConfigurator {
15
16   protected Class JavaDoc getApplicationClass() {
17     return InstrumentNothingTestApp.class;
18   }
19
20   public void doSetUp(TransparentTestIface t) throws Exception JavaDoc {
21     t.getTransparentAppConfig().setClientCount(1).setIntensity(1);
22     t.initializeTestRunner();
23   }
24
25   public static final class InstrumentNothingTestApp extends AbstractTransparentApp {
26   
27     public InstrumentNothingTestApp(String JavaDoc appId, ApplicationConfig cfg, ListenerProvider listenerProvider) {
28       super(appId, cfg, listenerProvider);
29     }
30     
31     public void run() {
32       Class JavaDoc[] interfaces = getClass().getInterfaces();
33       for (int i=0; i<interfaces.length; i++) {
34         if (TransparentAccess.class.getName().equals(interfaces[i].getName())) {
35           throw new AssertionError JavaDoc("I shouldn't have been instrumented, but I was!");
36         }
37       }
38     }
39   }
40   
41 }
42
Popular Tags