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 BlockingCache130TestApp extends BlockingCacheTestApp {
19: private CyclicBarrier barrier;
20: private CacheManager cacheManager;
21:
22: public BlockingCache130TestApp(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:
43: String testClass = BlockingCache130TestApp.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: }
|