KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tctest > GCTestBase


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tctest;
5
6 import com.tc.config.schema.SettableConfigItem;
7 import com.tc.config.schema.setup.TestTVSConfigurationSetupManagerFactory;
8 import com.terracottatech.config.PersistenceMode;
9
10 public abstract class GCTestBase extends TransparentTestBase implements TestConfigurator {
11
12   int NODE_COUNT = 3;
13   int LOOP_ITERATION_COUNT = 1;
14   int GARBAGE_COLLECTION_INTERVAL = 10;
15
16   public void setUp() throws Exception JavaDoc {
17     super.setUp();
18     doSetUp(this);
19   }
20
21   public void doSetUp(TransparentTestIface t) throws Exception JavaDoc {
22     t.getTransparentAppConfig().setClientCount(getNodeCount()).setIntensity(LOOP_ITERATION_COUNT);
23
24     TestTVSConfigurationSetupManagerFactory factory = (TestTVSConfigurationSetupManagerFactory) t.getConfigFactory();
25
26     ((SettableConfigItem) factory.l2DSOConfig().garbageCollectionEnabled()).setValue(true);
27     ((SettableConfigItem) factory.l2DSOConfig().garbageCollectionVerbose()).setValue(true);
28     ((SettableConfigItem) factory.l2DSOConfig().garbageCollectionInterval()).setValue(getGarbageCollectionInterval());
29     ((SettableConfigItem) factory.l2DSOConfig().persistenceMode()).setValue(PersistenceMode.TEMPORARY_SWAP_ONLY);
30
31     t.getRunnerConfig().setExecutionTimeout(Long.MAX_VALUE);
32     t.initializeTestRunner();
33   }
34
35   protected int getGarbageCollectionInterval() {
36     return GARBAGE_COLLECTION_INTERVAL;
37   }
38
39   protected int getNodeCount() {
40     return NODE_COUNT;
41   }
42
43 }
44
Popular Tags