summaryrefslogtreecommitdiff
path: root/qadevOOo
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-10-16 09:15:58 +0200
committerNoel Grandin <noel@peralex.com>2015-10-16 10:19:30 +0200
commit4e1a015d54b030818fdd491a81f47db2191034b0 (patch)
tree8ba58680c622729a0ca6579c4292a7b08ef579fd /qadevOOo
parentcb2c4d775664121c3034abda5a8b5cdd5044f148 (diff)
convert runState to a proper enum
Change-Id: I6f74e597fe9834b18023e73ee8b8bf50d10c82e2
Diffstat (limited to 'qadevOOo')
-rw-r--r--qadevOOo/Jar_OOoRunner.mk1
-rw-r--r--qadevOOo/runner/lib/ExceptionStatus.java2
-rw-r--r--qadevOOo/runner/lib/RunState.java43
-rw-r--r--qadevOOo/runner/lib/SimpleStatus.java35
-rw-r--r--qadevOOo/runner/lib/Status.java8
5 files changed, 56 insertions, 33 deletions
diff --git a/qadevOOo/Jar_OOoRunner.mk b/qadevOOo/Jar_OOoRunner.mk
index 4912f93a146c..1e7483d119e7 100644
--- a/qadevOOo/Jar_OOoRunner.mk
+++ b/qadevOOo/Jar_OOoRunner.mk
@@ -83,6 +83,7 @@ $(eval $(call gb_Jar_add_sourcefiles,OOoRunner,\
qadevOOo/runner/lib/ExceptionStatus \
qadevOOo/runner/lib/MultiMethodTest \
qadevOOo/runner/lib/MultiPropertyTest \
+ qadevOOo/runner/lib/RunState \
qadevOOo/runner/lib/SimpleStatus \
qadevOOo/runner/lib/Status \
qadevOOo/runner/lib/StatusException \
diff --git a/qadevOOo/runner/lib/ExceptionStatus.java b/qadevOOo/runner/lib/ExceptionStatus.java
index 31bca4bfdc3a..8fee550588da 100644
--- a/qadevOOo/runner/lib/ExceptionStatus.java
+++ b/qadevOOo/runner/lib/ExceptionStatus.java
@@ -29,7 +29,7 @@ class ExceptionStatus extends Status {
* @param t the exception an activity terminated with.
*/
ExceptionStatus( Throwable t ) {
- super(EXCEPTION, FAILED);
+ super(RunState.EXCEPTION, FAILED);
String message = t.getMessage();
if (message != null)
runStateString = message;
diff --git a/qadevOOo/runner/lib/RunState.java b/qadevOOo/runner/lib/RunState.java
new file mode 100644
index 000000000000..eeee2d842b50
--- /dev/null
+++ b/qadevOOo/runner/lib/RunState.java
@@ -0,0 +1,43 @@
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+package lib;
+
+public enum RunState {
+
+ /**
+ * The constant represents PASSED runtime state.
+ */
+ PASSED,
+
+ /**
+ * The constant represents EXCEPTION runtime state.
+ */
+ EXCEPTION,
+
+ /**
+ * The constant represents SKIPPED runtime state.
+ */
+ SKIPPED,
+
+ /**
+ * This is a private indicator for a user defined runtime state
+ */
+ USER_DEFINED
+
+}
diff --git a/qadevOOo/runner/lib/SimpleStatus.java b/qadevOOo/runner/lib/SimpleStatus.java
index 320ae202b45c..11e3b7e65dc6 100644
--- a/qadevOOo/runner/lib/SimpleStatus.java
+++ b/qadevOOo/runner/lib/SimpleStatus.java
@@ -24,27 +24,6 @@ package lib;
* the SimpleSTatus instance.
*/
class SimpleStatus {
- /* Run states. */
-
- /**
- * The constatnt represents PASSED runtime state.
- */
- public static final int PASSED = 0;
-
- /**
- * The constant represents EXCEPTION runtime state.
- */
- public static final int EXCEPTION = 3;
-
- /**
- * The constant represents SKIPPED runtime state.
- */
- public static final int SKIPPED = 1;
-
- /**
- * This is a private indicator for a user defined runtime state
- */
- private static final int USER_DEFINED = 4;
/* Test states */
@@ -63,7 +42,7 @@ class SimpleStatus {
/**
* The field is holding reason of the status.
*/
- private final int runState;
+ private final RunState runState;
/**
* This is the run state: either SKIPPED, PASSED, etc.
@@ -74,14 +53,14 @@ class SimpleStatus {
/**
* The constructor initialize state and reason field.
*/
- protected SimpleStatus( int runState, boolean state ) {
+ protected SimpleStatus( RunState runState, boolean state ) {
this.state = state;
this.runState = runState;
- if ( runState == PASSED ) {
+ if ( runState == RunState.PASSED ) {
runStateString = "PASSED";
- } else if ( runState == SKIPPED ) {
+ } else if ( runState == RunState.SKIPPED ) {
runStateString = "SKIPPED";
- } else if ( runState == EXCEPTION ) {
+ } else if ( runState == RunState.EXCEPTION ) {
runStateString = "EXCEPTION";
} else {
runStateString = "UNKNOWN";
@@ -93,7 +72,7 @@ class SimpleStatus {
*/
protected SimpleStatus(String runStateString, boolean state) {
this.state = state;
- this.runState = USER_DEFINED;
+ this.runState = RunState.USER_DEFINED;
this.runStateString = runStateString;
}
@@ -107,7 +86,7 @@ class SimpleStatus {
/**
* getRunState() implementation. Just returns th runState field value.
*/
- public int getRunState() {
+ public RunState getRunState() {
return runState;
}
diff --git a/qadevOOo/runner/lib/Status.java b/qadevOOo/runner/lib/Status.java
index 593fc6ed3605..dcab93c7a0a8 100644
--- a/qadevOOo/runner/lib/Status.java
+++ b/qadevOOo/runner/lib/Status.java
@@ -41,7 +41,7 @@ public class Status extends SimpleStatus {
* @param runState either PASSED, SKIPPED, etc.
* @param state OK or FAILED.
*/
- public Status(int runState, boolean state ) {
+ public Status(RunState runState, boolean state ) {
super(runState, state);
}
@@ -62,7 +62,7 @@ public class Status extends SimpleStatus {
* otherwise).
*/
public static Status passed( boolean state ) {
- return new Status(PASSED, state );
+ return new Status(RunState.PASSED, state );
}
/**
@@ -83,7 +83,7 @@ public class Status extends SimpleStatus {
* otherwise).
*/
public static Status skipped( boolean state ) {
- return new Status( SKIPPED, state );
+ return new Status( RunState.SKIPPED, state );
}
@@ -115,7 +115,7 @@ public class Status extends SimpleStatus {
* Checks whether the status runstate is passed.
*/
public boolean isPassed() {
- return getRunState() == PASSED;
+ return getRunState() == RunState.PASSED;
}
/**