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.perf.collections;
06:
07: import com.tctest.TransparentTestBase;
08: import com.tctest.TransparentTestIface;
09:
10: import java.util.Properties;
11:
12: public class AbstractPerfTestBase extends TransparentTestBase {
13:
14: private int nodes = 3;
15: private int threads = 3;
16: private int intensity = 10;
17: private long maxTimeout = 25; // in minutes
18: private Class TestClass;
19:
20: static final String PERF_NODE_COUNT = "PerfNodeCount";
21: static final String PERF_THREAD_COUNT = "PerfThreadCount";
22: static final String PERF_INTENSITY = "PerfIntensity";
23: static final String PERF_TIMEOUT = "PerfTimeoutMinutes";
24:
25: public AbstractPerfTestBase(Class appCls) {
26: Properties props = System.getProperties();
27: nodes = new Integer(props.getProperty(PERF_NODE_COUNT, String
28: .valueOf(nodes))).intValue();
29: threads = new Integer(props.getProperty(PERF_THREAD_COUNT,
30: String.valueOf(threads))).intValue();
31: intensity = new Integer(props.getProperty(PERF_INTENSITY,
32: String.valueOf(intensity))).intValue();
33: maxTimeout = new Long(props.getProperty(PERF_TIMEOUT, String
34: .valueOf(maxTimeout))).longValue();
35: TestClass = appCls;
36: }
37:
38: public void doSetUp(TransparentTestIface t) throws Exception {
39: t.getTransparentAppConfig().setClientCount(nodes)
40: .setApplicationInstancePerClientCount(threads)
41: .setIntensity(intensity);
42: t.getRunnerConfig().setExecutionTimeout(maxTimeout * 60 * 1000);
43: t.initializeTestRunner();
44: }
45:
46: protected Class getApplicationClass() {
47: return TestClass;
48: }
49:
50: }
|