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.runner;
06:
07: public class DistributedTestRunnerConfig {
08: private static final boolean DEBUG = false;
09:
10: private final long defaultExecutionTimeout;
11: private final long startTimeout = 30 * 1000;
12: private long executionTimeout;
13:
14: public DistributedTestRunnerConfig(long defaultExecutionTimeoutInSec) {
15: defaultExecutionTimeout = defaultExecutionTimeoutInSec * 1000;
16: executionTimeout = this .defaultExecutionTimeout;
17: debugPrintln("***** setting default execution timeout and execution timeout: "
18: + defaultExecutionTimeout);
19: }
20:
21: public long executionTimeout() {
22: debugPrintln("***** getting execution timeout: "
23: + executionTimeout);
24: return this .executionTimeout;
25: }
26:
27: public long startTimeout() {
28: debugPrintln("***** getting start timeout: " + startTimeout);
29: return this .startTimeout;
30: }
31:
32: public void setExecutionTimeout(long executionTimeout) {
33: if (executionTimeout > defaultExecutionTimeout) {
34: throw new AssertionError(
35: "Cannot set execution timeout to be greater than the test timeout.");
36: }
37: debugPrintln("***** setting execution timeout: "
38: + executionTimeout);
39: this .executionTimeout = executionTimeout;
40: }
41:
42: private void debugPrintln(String s) {
43: if (DEBUG) {
44: System.err.println(s);
45: }
46: }
47: }
|