01: package fit.decorator.performance;
02:
03: import fit.Fixture;
04: import fit.Parse;
05: import fit.decorator.exceptions.InvalidInputException;
06: import fit.decorator.util.Timer;
07:
08: public class MaxTime extends TimeBasedFixtureDecorator {
09: public static final String MAX_TIME = "maxTime";
10: protected long maxTime;
11:
12: public MaxTime() {
13: super ();
14: }
15:
16: MaxTime(Timer stopWatch) {
17: super (stopWatch);
18: }
19:
20: protected void run(Fixture fixture, Parse table) {
21: super .run(fixture, table);
22: summary.put(ACTUAL_TIME_TAKEN, new Long(elapsedTime));
23: }
24:
25: protected void setupDecorator(String[] arguments)
26: throws InvalidInputException {
27: if (arguments.length != 1) {
28: throw new InvalidInputException(
29: "Max Time must be specified");
30: }
31: maxTime = Long.parseLong(arguments[0]);
32: summary.put(MAX_TIME, new Long(maxTime));
33: }
34:
35: protected void updateColumnsBasedOnResults(Parse table) {
36: updateColumns(table.parts.parts.more, elapsedTime, maxTime,
37: true);
38: }
39: }
|