bump product version to 4.1.6.2
[LibreOffice.git] / qadevOOo / runner / lib / SimpleStatus.java
blobcafdc3208db23aa589c1c785e67b5a93eb03d25b
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 EXCLUDED runtime state.
42 public final static int EXCLUDED = 2;
44 /**
45 * The constant represents SKIPPED runtime state.
47 public final static int SKIPPED = 1;
49 /**
50 * This is a private indicator for a user defined runtime state
52 private final static int USER_DEFINED = 4;
54 /* Test states */
56 /**
57 * The constant represents FAILED state.
59 public final static boolean FAILED = false;
61 /**
62 * The constant represents OK state.
64 public final static boolean OK = true;
66 /**
67 * The field is holding state of the status.
69 protected final boolean state;
71 /**
72 * The field is holding reason of the status.
74 protected final int runState;
76 /**
77 * This is the run state: either SKIPPED, PASSED, etc.
78 * or user defined. Deriving classes can overwrite it for own run states.
80 protected String runStateString;
82 /**
83 * The constructor initialize state and reason field.
85 protected SimpleStatus( int runState, boolean state ) {
86 this.state = state;
87 this.runState = runState;
88 if ( runState == PASSED ) {
89 runStateString = "PASSED";
90 } else if ( runState == EXCLUDED ) {
91 runStateString = "EXCLUDED";
92 } else if ( runState == SKIPPED ) {
93 runStateString = "SKIPPED";
94 } else if ( runState == EXCEPTION ) {
95 runStateString = "EXCEPTION";
96 } else {
97 runStateString = "UNKNOWN";
102 * The constructor initialize state and reson field.
104 protected SimpleStatus(String runStateString, boolean state) {
105 this.state = state;
106 this.runState = USER_DEFINED;
107 this.runStateString = runStateString;
111 * getState implementation. Just returns the state field value.
113 public boolean getState() {
114 return state;
118 * getRunState() implementation. Just returns th runState field value.
120 public int getRunState() {
121 return runState;
125 * getReason implementation. Just returns the reason field value.
127 public String getRunStateString() {
128 return runStateString;
132 * Get the ressult: passed or failed.
134 public String getStateString() {
135 if (state)
136 return "OK";
137 return "FAILED";