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 ServerCrashAndRestartL1ReconnectTest extends
20: ServerCrashingTestBase {
21:
22: private static final int NODE_COUNT = 5;
23:
24: public ServerCrashAndRestartL1ReconnectTest() {
25: super (NODE_COUNT);
26: }
27:
28: protected boolean enableL1Reconnect() {
29: return true;
30: }
31:
32: protected Class getApplicationClass() {
33: return ServerCrashAndRestartTestApp.class;
34: }
35:
36: protected void createConfig(TerracottaConfigBuilder cb) {
37: // persistent mode
38: cb.getServers().getL2s()[0]
39: .setPersistenceMode(L2ConfigBuilder.PERSISTENCE_MODE_PERMANENT_STORE);
40:
41: // locks
42: LockConfigBuilder[] locks = new LockConfigBuilder[] {
43: new LockConfigBuilderImpl(
44: LockConfigBuilder.TAG_AUTO_LOCK,
45: CyclicBarrier.class,
46: LockConfigBuilder.LEVEL_WRITE),
47: new LockConfigBuilderImpl(
48: LockConfigBuilder.TAG_AUTO_LOCK,
49: SynchronizedInt.class,
50: LockConfigBuilder.LEVEL_WRITE),
51: new LockConfigBuilderImpl(
52: LockConfigBuilder.TAG_AUTO_LOCK,
53: getApplicationClass(),
54: LockConfigBuilder.LEVEL_WRITE) };
55:
56: cb.getApplication().getDSO().setLocks(locks);
57:
58: // include classes
59: InstrumentedClassConfigBuilder[] instrClasses = new InstrumentedClassConfigBuilder[] {
60: new InstrumentedClassConfigBuilderImpl(
61: CyclicBarrier.class),
62: new InstrumentedClassConfigBuilderImpl(
63: SynchronizedInt.class),
64: new InstrumentedClassConfigBuilderImpl(
65: getApplicationClass()) };
66:
67: cb.getApplication().getDSO().setInstrumentedClasses(
68: instrClasses);
69:
70: // roots
71: RootConfigBuilder[] roots = new RootConfigBuilder[] { new RootConfigBuilderImpl(
72: getApplicationClass(), "barrier") };
73: cb.getApplication().getDSO().setRoots(roots);
74: }
75:
76: }
|