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:
09: import EDU.oswego.cs.dl.util.concurrent.CyclicBarrier;
10:
11: import com.tc.object.config.ConfigVisitor;
12: import com.tc.object.config.DSOClientConfigHelper;
13: import com.tc.object.config.TransparencyClassSpec;
14: import com.tc.object.config.spec.CyclicBarrierSpec;
15: import com.tc.simulator.app.ApplicationConfig;
16: import com.tc.simulator.listener.ListenerProvider;
17: import com.tc.util.TIMUtil;
18:
19: public class CacheEvictor124TestApp extends CacheEvictorTestApp {
20: private CyclicBarrier barrier;
21: private CacheManager cacheManager;
22:
23: public CacheEvictor124TestApp(String appId, ApplicationConfig cfg,
24: ListenerProvider listenerProvider) {
25: super (appId, cfg, listenerProvider);
26: barrier = new CyclicBarrier(cfg.getGlobalParticipantCount());
27: cacheManager = CacheManager.create(getClass().getResource(
28: "cache-evictor-test.xml"));
29: }
30:
31: protected int barrier() throws Exception {
32: return barrier.barrier();
33: }
34:
35: protected CacheManager getCacheManger() {
36: return cacheManager;
37: }
38:
39: public static void visitL1DSOConfig(ConfigVisitor visitor,
40: DSOClientConfigHelper config) {
41: config.addModule(TIMUtil.EHCACHE_1_2_4, TIMUtil
42: .getVersion(TIMUtil.EHCACHE_1_2_4));
43: String testClass = CacheEvictor124TestApp.class.getName();
44: TransparencyClassSpec spec = config.getOrCreateSpec(testClass);
45: spec.addRoot("barrier", "barrier");
46: spec.addRoot("cacheManager", "cacheManager");
47:
48: new CyclicBarrierSpec().visit(visitor, config);
49: }
50: }
|