summaryrefslogtreecommitdiff
path: root/qadevOOo/runner/lib
diff options
context:
space:
mode:
authorPascal Junck <pjunck@openoffice.org>2004-11-02 10:38:30 +0000
committerPascal Junck <pjunck@openoffice.org>2004-11-02 10:38:30 +0000
commit8e4972aea9411b716637bfbb73d7a0a691866262 (patch)
tree6b016fde0edd51caa5fadfb03af51d5a1e34a668 /qadevOOo/runner/lib
parent91f04c09ab2898fb8fa8c049b6749aa6afc43874 (diff)
INTEGRATION: CWS qadev19 (1.2.78); FILE MERGED
2004/09/17 12:00:27 sg 1.2.78.1: #i32878#CHG: fixed bugs
Diffstat (limited to 'qadevOOo/runner/lib')
-rw-r--r--qadevOOo/runner/lib/SimpleStatus.java108
-rw-r--r--qadevOOo/runner/lib/Status.java105
2 files changed, 100 insertions, 113 deletions
diff --git a/qadevOOo/runner/lib/SimpleStatus.java b/qadevOOo/runner/lib/SimpleStatus.java
index 040356fd1812..6f73b2356ef9 100644
--- a/qadevOOo/runner/lib/SimpleStatus.java
+++ b/qadevOOo/runner/lib/SimpleStatus.java
@@ -2,9 +2,9 @@
*
* $RCSfile: SimpleStatus.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change:$Date: 2003-11-18 16:15:38 $
+ * last change:$Date: 2004-11-02 11:37:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,7 +66,46 @@ package lib;
* Status behaviour: its state, reason and log are defined when creating
* the SimpleSTatus instance.
*/
-class SimpleStatus extends Status {
+class SimpleStatus {
+ /* Run states. */
+
+ /**
+ * The constatnt represents PASSED runtime state.
+ */
+ public final static int PASSED = 0;
+
+ /**
+ * The constant represents EXCEPTION runtime state.
+ */
+ public final static int EXCEPTION = 3;
+
+ /**
+ * The constant represents EXCLUDED runtime state.
+ */
+ public final static int EXCLUDED = 2;
+
+ /**
+ * The constant represents SKIPPED runtime state.
+ */
+ public final static int SKIPPED = 1;
+
+ /**
+ * This is a private indicator for a user defined runtime state
+ */
+ private final static int USER_DEFINED = 4;
+
+ /* Test states */
+
+ /**
+ * The constant represents FAILED state.
+ */
+ public final static boolean FAILED = false;
+
+ /**
+ * The constant represents OK state.
+ */
+ public final static boolean OK = true;
+
/**
* The field is holding state of the status.
*/
@@ -78,18 +117,44 @@ class SimpleStatus extends Status {
protected final int runState;
/**
- * The constructor initialize state and reson field.
+ * This is the run state: either SKIPPED, PASSED, etc.
+ * or user defined. Deriving classes can overwrite it for own run states.
+ */
+ protected String runStateString;
+
+ /**
+ * The constructor initialize state and reason field.
*/
protected SimpleStatus( int runState, boolean state ) {
this.state = state;
this.runState = runState;
+ if ( runState == PASSED ) {
+ runStateString = "PASSED";
+ } else if ( runState == EXCLUDED ) {
+ runStateString = "EXCLUDED";
+ } else if ( runState == SKIPPED ) {
+ runStateString = "SKIPPED";
+ } else if ( runState == EXCEPTION ) {
+ runStateString = "EXCEPTION";
+ } else {
+ runStateString = "UNKNOWN";
+ }
+ }
+
+ /**
+ * The constructor initialize state and reson field.
+ */
+ protected SimpleStatus(String runStateString, boolean state) {
+ this.state = state;
+ this.runState = USER_DEFINED;
+ this.runStateString = runStateString;
}
/**
* getState implementation. Just returns the state field value.
*/
- public int getState() {
- return (state ? OK : FAILED);
+ public boolean getState() {
+ return state;
}
/**
@@ -103,33 +168,16 @@ class SimpleStatus extends Status {
* getReason implementation. Just returns the reason field value.
*/
public String getRunStateString() {
- int runState = getRunState();
-
- if ( runState == PASSED ) {
- return "PASSED";
- } else if ( runState == EXCLUDED ) {
- return "EXCLUDED";
- } else if ( runState == SKIPPED ) {
- return "SKIPPED";
- } else {
- return "UNKNOWN";
- }
+ return runStateString;
}
/**
- * Compares this Status with obj.
- *
- * @return <tt>true</tt> if obj is a SimpleStatus instance and it has
- * the same state and runstate, <tt>false</tt> otherwise.
+ * Get the ressult: passed or failed.
*/
-/* public boolean equals(Object obj) {
- if (obj == null || !(obj instanceof SimpleStatus)) {
- return false;
- }
+ public String getStateString() {
+ if (state)
+ return "OK";
+ return "FAILED";
- SimpleStatus other = (SimpleStatus)obj;
-
- return this.getState() == other.getState()
- && this.getRunState() == other.getRunState();
- } */
+ }
} \ No newline at end of file
diff --git a/qadevOOo/runner/lib/Status.java b/qadevOOo/runner/lib/Status.java
index 410b2f1eb53d..313928355896 100644
--- a/qadevOOo/runner/lib/Status.java
+++ b/qadevOOo/runner/lib/Status.java
@@ -2,9 +2,9 @@
*
* $RCSfile: Status.java,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change:$Date: 2003-11-18 16:15:48 $
+ * last change:$Date: 2004-11-02 11:38:30 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -79,56 +79,25 @@ import java.io.PrintWriter;
* - other variants are not formalized now and can be represented by
* Status.failed() method. They always have a FAILED state.
*/
-public abstract class Status {
- /* Run states. */
+public class Status extends SimpleStatus {
/**
- * The constatnt represents PASSED runtime state.
+ * Construct a status: use runState and state
+ * @param runState: either PASSED, SKIPPED, etc.
+ * @param state: OK or FAILED.
*/
- public final static int PASSED = 0;
-
- /**
- * The constant represents EXCEPTION runtime state.
- */
- public final static int EXCEPTION = 4;
-
- /**
- * The constant represents EXCLUDED runtime state.
- */
- public final static int EXCLUDED = 5;
-
- /**
- * The constant represents SKIPPED runtime state.
- */
- public final static int SKIPPED = 2;
-
- /* Test states */
-
- /**
- * The constant represents FAILED state.
- */
- public final static int FAILED = 1;
-
- /**
- * The constant represents OK state.
- */
- public final static int OK = 3;
-
- /**
- * Returns the test state of the Status.
- */
- public abstract int getState();
-
- /**
- * Returns the run state of the Status.
- */
- public abstract int getRunState();
+ public Status(int runState, boolean state ) {
+ super(runState, state);
+ }
/**
- * Returns the string describing run state of the Status. For example,
- * "PASSED", "SKIPPED", "File file.txt is not found".
+ * Construct a status: use own message and state.
+ * @parame messaeg An own message for the status.
+ * @param state: OK or FAILED.
*/
- public abstract String getRunStateString();
+ public Status(String message, boolean state) {
+ super( message, state );
+ }
/**
* This is a factory method for creating a Status representing normal
@@ -138,7 +107,7 @@ public abstract class Status {
* otherwise).
*/
public static Status passed( boolean state ) {
- return new SimpleStatus(PASSED, state );
+ return new Status(PASSED, state );
}
/**
@@ -159,7 +128,7 @@ public abstract class Status {
* otherwise).
*/
public static Status skipped( boolean state ) {
- return new SimpleStatus( SKIPPED, state );
+ return new Status( SKIPPED, state );
}
/**
@@ -167,7 +136,7 @@ public abstract class Status {
* result of the activity was excluded. It alwas has FAILED state.
*/
public static Status excluded() {
- return new SimpleStatus( EXCLUDED, false );
+ return new Status( EXCLUDED, false );
}
/**
@@ -177,27 +146,7 @@ public abstract class Status {
* @param reason describes why the activity failed
*/
public static Status failed(final String reason) {
- return new Status() {
- public int getState() {
- return FAILED;
- }
-
- public int getRunState() {
- return SKIPPED;
- }
-
- public String getRunStateString() {
- return reason;
- }
-
-/* public boolean equals(Object obj) {
- if (obj == null || this.getClass() != obj.getClass()) {
- return false;
- }
- return this.getRunStateString().equals(
- ((Status)obj).getRunStateString());
- } */
- };
+ return new Status(reason, FAILED);
}
/**
@@ -207,17 +156,7 @@ public abstract class Status {
* "FAILED.The getLabel works wrong", "PASSED.OK".
*/
public String toString() {
- String str = getRunStateString() + ".";
-
- // Getting state of the status and converting it to string.
- int state = getState();
- if (state == OK) {
- str += "OK";
- } else {
- // Although, normally, there should be only FAILED state,
- // all other marked as failed too.
- str += "FAILED";
- }
+ String str = getRunStateString() + "." + getStateString();;
return str;
}
@@ -254,14 +193,14 @@ public abstract class Status {
* Checks whether the status state is failed.
*/
public boolean isFailed() {
- return getState() == FAILED;
+ return !getState();
}
/**
* Checks whether the status state is ok.
*/
public boolean isOK() {
- return getState() == OK;
+ return getState();
}
public String getDescription () {