bump product version to 5.0.4.1
[LibreOffice.git] / qadevOOo / runner / lib / SimpleStatus.java
blob6866d7e7a24d1ba07f931c17135553ab7151e9c9
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package lib;
21 /**
22 * The class is a simple implementation of Status class. It implements simple
23 * Status behaviour: its state, reason and log are defined when creating
24 * the SimpleSTatus instance.
26 class SimpleStatus {
27 /* Run states. */
29 /**
30 * The constatnt represents PASSED runtime state.
32 public final static int PASSED = 0;
34 /**
35 * The constant represents EXCEPTION runtime state.
37 public final static int EXCEPTION = 3;
39 /**
40 * The constant represents SKIPPED runtime state.
42 public final static int SKIPPED = 1;
44 /**
45 * This is a private indicator for a user defined runtime state
47 private final static int USER_DEFINED = 4;
49 /* Test states */
51 /**
52 * The constant represents FAILED state.
54 public final static boolean FAILED = false;
58 /**
59 * The field is holding state of the status.
61 private final boolean state;
63 /**
64 * The field is holding reason of the status.
66 private final int runState;
68 /**
69 * This is the run state: either SKIPPED, PASSED, etc.
70 * or user defined. Deriving classes can overwrite it for own run states.
72 protected String runStateString;
74 /**
75 * The constructor initialize state and reason field.
77 protected SimpleStatus( int runState, boolean state ) {
78 this.state = state;
79 this.runState = runState;
80 if ( runState == PASSED ) {
81 runStateString = "PASSED";
82 } else if ( runState == SKIPPED ) {
83 runStateString = "SKIPPED";
84 } else if ( runState == EXCEPTION ) {
85 runStateString = "EXCEPTION";
86 } else {
87 runStateString = "UNKNOWN";
91 /**
92 * The constructor initialize state and reson field.
94 protected SimpleStatus(String runStateString, boolean state) {
95 this.state = state;
96 this.runState = USER_DEFINED;
97 this.runStateString = runStateString;
101 * getState implementation. Just returns the state field value.
103 public boolean getState() {
104 return state;
108 * getRunState() implementation. Just returns th runState field value.
110 public int getRunState() {
111 return runState;
115 * getReason implementation. Just returns the reason field value.
117 public String getRunStateString() {
118 return runStateString;
122 * Get the ressult: passed or failed.
124 public String getStateString() {
125 if (state)
126 return "OK";
127 return "FAILED";