1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: SimpleStatus.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 * The class is a simple implementation of Status class. It implements simple
35 * Status behaviour: its state, reason and log are defined when creating
36 * the SimpleSTatus instance.
42 * The constatnt represents PASSED runtime state.
44 public final static int PASSED
= 0;
47 * The constant represents EXCEPTION runtime state.
49 public final static int EXCEPTION
= 3;
52 * The constant represents EXCLUDED runtime state.
54 public final static int EXCLUDED
= 2;
57 * The constant represents SKIPPED runtime state.
59 public final static int SKIPPED
= 1;
62 * This is a private indicator for a user defined runtime state
64 private final static int USER_DEFINED
= 4;
69 * The constant represents FAILED state.
71 public final static boolean FAILED
= false;
74 * The constant represents OK state.
76 public final static boolean OK
= true;
79 * The field is holding state of the status.
81 protected final boolean state
;
84 * The field is holding reason of the status.
86 protected final int runState
;
89 * This is the run state: either SKIPPED, PASSED, etc.
90 * or user defined. Deriving classes can overwrite it for own run states.
92 protected String runStateString
;
95 * The constructor initialize state and reason field.
97 protected SimpleStatus( int runState
, boolean state
) {
99 this.runState
= runState
;
100 if ( runState
== PASSED
) {
101 runStateString
= "PASSED";
102 } else if ( runState
== EXCLUDED
) {
103 runStateString
= "EXCLUDED";
104 } else if ( runState
== SKIPPED
) {
105 runStateString
= "SKIPPED";
106 } else if ( runState
== EXCEPTION
) {
107 runStateString
= "EXCEPTION";
109 runStateString
= "UNKNOWN";
114 * The constructor initialize state and reson field.
116 protected SimpleStatus(String runStateString
, boolean state
) {
118 this.runState
= USER_DEFINED
;
119 this.runStateString
= runStateString
;
123 * getState implementation. Just returns the state field value.
125 public boolean getState() {
130 * getRunState() implementation. Just returns th runState field value.
132 public int getRunState() {
137 * getReason implementation. Just returns the reason field value.
139 public String
getRunStateString() {
140 return runStateString
;
144 * Get the ressult: passed or failed.
146 public String
getStateString() {