[Lada-commits] [PATCH 1 of 5] Added protocol class for improved test logging

Wald Commits scm-commit at wald.intevation.org
Tue Feb 17 13:43:50 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1424176828 -3600
# Node ID 9be4f6f7c050e388dfed6bac24edc4f6ffa31d76
# Parent  492f549b15ac7822d08c4289d6368c21803f38ed
Added protocol class for improved test logging.

diff -r 492f549b15ac -r 9be4f6f7c050 src/test/java/de/intevation/lada/Protocol.java
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/test/java/de/intevation/lada/Protocol.java	Tue Feb 17 13:40:28 2015 +0100
@@ -0,0 +1,101 @@
+/* Copyright (C) 2013 by Bundesamt fuer Strahlenschutz
+ * Software engineering by Intevation GmbH
+ *
+ * This file is Free Software under the GNU GPL (v>=3) 
+ * and comes with ABSOLUTELY NO WARRANTY! Check out 
+ * the documentation coming with IMIS-Labordaten-Application for details. 
+ */
+package de.intevation.lada;
+
+import java.util.HashMap;
+import java.util.Map;
+
+public class Protocol {
+
+    private String name;
+
+    private String type;
+
+    private boolean passed;
+
+    private Map<String, Object> info;
+
+    public Protocol () {
+        info = new HashMap<String, Object>();
+    }
+
+    /**
+     * @return The name
+     */
+    public String getName() {
+        return name;
+    }
+
+    /**
+     * @param name The name of the test
+     */
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    /**
+     * @return The test type.
+     */
+    public String getType() {
+        return type;
+    }
+
+    /**
+     * @param type the type to set
+     */
+    public void setType(String type) {
+        this.type = type;
+    }
+
+    /**
+     * @return Test passed
+     */
+    public boolean isPassed() {
+        return passed;
+    }
+
+    /**
+     * @param passed Wether the passed or not.
+     */
+    public void setPassed(boolean passed) {
+        this.passed = passed;
+    }
+
+    /**
+     * @return Test infos.
+     */
+    public Map<String, Object> getInfo() {
+        return info;
+    }
+
+    /**
+     * @param info Test infos.
+     */
+    public void addInfo(String key, Object value) {
+        this.info.put(key, value);
+    }
+
+    public String toString(boolean verbose) {
+        String ret = "";
+
+        ret += this.name + " (" + this.type + "): ";
+        if (this.passed) {
+            ret += "success";
+        }
+        else {
+            ret += "failed";
+        }
+        if (verbose) {
+            ret += "\nInfo: ";
+            for (String key: info.keySet()) {
+                ret += "\n    " + key + ": " + info.get(key);
+            }
+        }
+        return ret;
+    }
+}


More information about the Lada-commits mailing list