01: /*
02: * All content copyright (c) 2003-2006 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 EDU.oswego.cs.dl.util.concurrent.CyclicBarrier;
08: import EDU.oswego.cs.dl.util.concurrent.SynchronizedInt;
09:
10: import com.tc.config.schema.builder.InstrumentedClassConfigBuilder;
11: import com.tc.config.schema.builder.LockConfigBuilder;
12: import com.tc.config.schema.builder.RootConfigBuilder;
13: import com.tc.config.schema.test.InstrumentedClassConfigBuilderImpl;
14: import com.tc.config.schema.test.L2ConfigBuilder;
15: import com.tc.config.schema.test.LockConfigBuilderImpl;
16: import com.tc.config.schema.test.RootConfigBuilderImpl;
17: import com.tc.config.schema.test.TerracottaConfigBuilder;
18:
19: public class ServerCrashAndRestartTest extends ServerCrashingTestBase {
20:
21: private static final int NODE_COUNT = 5;
22:
23: public ServerCrashAndRestartTest() {
24: super (NODE_COUNT);
25: }
26:
27: protected Class getApplicationClass() {
28: return ServerCrashAndRestartTestApp.class;
29: }
30:
31: protected void createConfig(TerracottaConfigBuilder cb) {
32: // persistent mode
33: cb.getServers().getL2s()[0]
34: .setPersistenceMode(L2ConfigBuilder.PERSISTENCE_MODE_PERMANENT_STORE);
35:
36: // locks
37: LockConfigBuilder[] locks = new LockConfigBuilder[] {
38: new LockConfigBuilderImpl(
39: LockConfigBuilder.TAG_AUTO_LOCK,
40: CyclicBarrier.class,
41: LockConfigBuilder.LEVEL_WRITE),
42: new LockConfigBuilderImpl(
43: LockConfigBuilder.TAG_AUTO_LOCK,
44: SynchronizedInt.class,
45: LockConfigBuilder.LEVEL_WRITE),
46: new LockConfigBuilderImpl(
47: LockConfigBuilder.TAG_AUTO_LOCK,
48: getApplicationClass(),
49: LockConfigBuilder.LEVEL_WRITE) };
50:
51: cb.getApplication().getDSO().setLocks(locks);
52:
53: // include classes
54: InstrumentedClassConfigBuilder[] instrClasses = new InstrumentedClassConfigBuilder[] {
55: new InstrumentedClassConfigBuilderImpl(
56: CyclicBarrier.class),
57: new InstrumentedClassConfigBuilderImpl(
58: SynchronizedInt.class),
59: new InstrumentedClassConfigBuilderImpl(
60: getApplicationClass()) };
61:
62: cb.getApplication().getDSO().setInstrumentedClasses(
63: instrClasses);
64:
65: // roots
66: RootConfigBuilder[] roots = new RootConfigBuilder[] { new RootConfigBuilderImpl(
67: getApplicationClass(), "barrier") };
68: cb.getApplication().getDSO().setRoots(roots);
69: }
70:
71: }
|