01: /*
02: * All content copyright (c) 2003-2007 Terracotta, Inc., except as may otherwise be noted in a separate copyright
03: * notice. All rights reserved.
04: */
05: package com.tctest;
06:
07: import net.sf.ehcache.CacheManager;
08: import EDU.oswego.cs.dl.util.concurrent.CyclicBarrier;
09:
10: import com.tc.object.config.ConfigVisitor;
11: import com.tc.object.config.DSOClientConfigHelper;
12: import com.tc.object.config.TransparencyClassSpec;
13: import com.tc.object.config.spec.CyclicBarrierSpec;
14: import com.tc.simulator.app.ApplicationConfig;
15: import com.tc.simulator.listener.ListenerProvider;
16: import com.tc.util.TIMUtil;
17:
18: public class CacheEvictor130TestApp extends CacheEvictorTestApp {
19: private CyclicBarrier barrier;
20: private CacheManager cacheManager;
21:
22: public CacheEvictor130TestApp(String appId, ApplicationConfig cfg,
23: ListenerProvider listenerProvider) {
24: super (appId, cfg, listenerProvider);
25: barrier = new CyclicBarrier(cfg.getGlobalParticipantCount());
26: cacheManager = CacheManager.create(getClass().getResource(
27: "cache-evictor-test.xml"));
28: }
29:
30: protected int barrier() throws Exception {
31: return barrier.barrier();
32: }
33:
34: protected CacheManager getCacheManger() {
35: return cacheManager;
36: }
37:
38: public static void visitL1DSOConfig(ConfigVisitor visitor,
39: DSOClientConfigHelper config) {
40: config.addModule(TIMUtil.EHCACHE_1_3, TIMUtil
41: .getVersion(TIMUtil.EHCACHE_1_3));
42: String testClass = CacheEvictor130TestApp.class.getName();
43: TransparencyClassSpec spec = config.getOrCreateSpec(testClass);
44: spec.addRoot("barrier", "barrier");
45: spec.addRoot("cacheManager", "cacheManager");
46:
47: new CyclicBarrierSpec().visit(visitor, config);
48: }
49: }
|