1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
31 * The class is a simple implementation of Status class. It implements simple
32 * Status behaviour: its state, reason and log are defined when creating
33 * the SimpleSTatus instance.
39 * The constatnt represents PASSED runtime state.
41 public final static int PASSED
= 0;
44 * The constant represents EXCEPTION runtime state.
46 public final static int EXCEPTION
= 3;
49 * The constant represents EXCLUDED runtime state.
51 public final static int EXCLUDED
= 2;
54 * The constant represents SKIPPED runtime state.
56 public final static int SKIPPED
= 1;
59 * This is a private indicator for a user defined runtime state
61 private final static int USER_DEFINED
= 4;
66 * The constant represents FAILED state.
68 public final static boolean FAILED
= false;
71 * The constant represents OK state.
73 public final static boolean OK
= true;
76 * The field is holding state of the status.
78 protected final boolean state
;
81 * The field is holding reason of the status.
83 protected final int runState
;
86 * This is the run state: either SKIPPED, PASSED, etc.
87 * or user defined. Deriving classes can overwrite it for own run states.
89 protected String runStateString
;
92 * The constructor initialize state and reason field.
94 protected SimpleStatus( int runState
, boolean state
) {
96 this.runState
= runState
;
97 if ( runState
== PASSED
) {
98 runStateString
= "PASSED";
99 } else if ( runState
== EXCLUDED
) {
100 runStateString
= "EXCLUDED";
101 } else if ( runState
== SKIPPED
) {
102 runStateString
= "SKIPPED";
103 } else if ( runState
== EXCEPTION
) {
104 runStateString
= "EXCEPTION";
106 runStateString
= "UNKNOWN";
111 * The constructor initialize state and reson field.
113 protected SimpleStatus(String runStateString
, boolean state
) {
115 this.runState
= USER_DEFINED
;
116 this.runStateString
= runStateString
;
120 * getState implementation. Just returns the state field value.
122 public boolean getState() {
127 * getRunState() implementation. Just returns th runState field value.
129 public int getRunState() {
134 * getReason implementation. Just returns the reason field value.
136 public String
getRunStateString() {
137 return runStateString
;
141 * Get the ressult: passed or failed.
143 public String
getStateString() {