Refactor Argeo API
[gpl/argeo-slc.git] / org.argeo.slc.runtime / src / org / argeo / slc / runtime / test / SimpleTestResult.java
index b4437d71f53953437b74cf9a10062e3c338fb68b..649e5d390f6ef661c786b958d9bd2d5ae78151a1 100644 (file)
-/*\r
- * Copyright (C) 2007-2012 Argeo GmbH\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- *         http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-package org.argeo.slc.runtime.test;\r
-\r
-import java.util.Date;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.TreeMap;\r
-import java.util.UUID;\r
-import java.util.Vector;\r
-\r
-import org.apache.commons.logging.Log;\r
-import org.apache.commons.logging.LogFactory;\r
-import org.argeo.slc.SlcException;\r
-import org.argeo.slc.test.TestResult;\r
-import org.argeo.slc.test.TestResultPart;\r
-import org.argeo.slc.test.TestRun;\r
-\r
-/**\r
- * Basic implementation of a test result containing only a list of result parts.\r
- */\r
-public class SimpleTestResult implements TestResult {\r
-       private static Log log = LogFactory.getLog(SimpleTestResult.class);\r
-\r
-       private String uuid;\r
-       private String currentTestRunUuid;\r
-\r
-       private Boolean throwError = true;\r
-\r
-       private Date closeDate;\r
-       private List<TestResultPart> parts = new Vector<TestResultPart>();\r
-\r
-       private Map<String, String> attributes = new TreeMap<String, String>();\r
-\r
-       public void addResultPart(TestResultPart part) {\r
-               if (throwError && part.getStatus() == ERROR) {\r
-                       throw new SlcException(\r
-                                       "There was an error in the underlying test: "\r
-                                                       + part.getExceptionMessage());\r
-               }\r
-               parts.add(part);\r
-               if (log.isDebugEnabled())\r
-                       log.debug(part);\r
-       }\r
-\r
-       public void close() {\r
-               parts.clear();\r
-               closeDate = new Date();\r
-       }\r
-\r
-       public List<TestResultPart> getParts() {\r
-               return parts;\r
-       }\r
-\r
-       public Date getCloseDate() {\r
-               return closeDate;\r
-       }\r
-\r
-       public void setThrowError(Boolean throwError) {\r
-               this.throwError = throwError;\r
-       }\r
-\r
-       public void notifyTestRun(TestRun testRun) {\r
-               currentTestRunUuid = testRun.getUuid();\r
-       }\r
-\r
-       public String getUuid() {\r
-               if (uuid == null) {\r
-                       uuid = UUID.randomUUID().toString();\r
-               }\r
-               return uuid;\r
-       }\r
-\r
-       public void setUuid(String uuid) {\r
-               this.uuid = uuid;\r
-       }\r
-\r
-       public String getCurrentTestRunUuid() {\r
-               return currentTestRunUuid;\r
-       }\r
-\r
-       public Map<String, String> getAttributes() {\r
-               return attributes;\r
-       }\r
-\r
-       public void setAttributes(Map<String, String> attributes) {\r
-               this.attributes = attributes;\r
-       }\r
-\r
-}\r
+package org.argeo.slc.runtime.test;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+import java.util.UUID;
+import java.util.Vector;
+
+import org.argeo.api.slc.SlcException;
+import org.argeo.api.slc.test.TestResult;
+import org.argeo.api.slc.test.TestResultPart;
+import org.argeo.api.slc.test.TestRun;
+
+/**
+ * Basic implementation of a test result containing only a list of result parts.
+ */
+public class SimpleTestResult implements TestResult {
+       private String uuid;
+       private String currentTestRunUuid;
+
+       private Boolean throwError = true;
+
+       private Date closeDate;
+       private List<TestResultPart> parts = new Vector<TestResultPart>();
+
+       private Map<String, String> attributes = new TreeMap<String, String>();
+
+       public void addResultPart(TestResultPart part) {
+               if (throwError && part.getStatus() == ERROR) {
+                       throw new SlcException("There was an error in the underlying test: " + part.getExceptionMessage());
+               }
+               parts.add(part);
+//             if (log.isDebugEnabled())
+//                     log.debug(part);
+       }
+
+       public void close() {
+               parts.clear();
+               closeDate = new Date();
+       }
+
+       public List<TestResultPart> getParts() {
+               return parts;
+       }
+
+       public Date getCloseDate() {
+               return closeDate;
+       }
+
+       public void setThrowError(Boolean throwError) {
+               this.throwError = throwError;
+       }
+
+       public void notifyTestRun(TestRun testRun) {
+               currentTestRunUuid = testRun.getUuid();
+       }
+
+       public String getUuid() {
+               if (uuid == null) {
+                       uuid = UUID.randomUUID().toString();
+               }
+               return uuid;
+       }
+
+       public void setUuid(String uuid) {
+               this.uuid = uuid;
+       }
+
+       public String getCurrentTestRunUuid() {
+               return currentTestRunUuid;
+       }
+
+       public Map<String, String> getAttributes() {
+               return attributes;
+       }
+
+       public void setAttributes(Map<String, String> attributes) {
+               this.attributes = attributes;
+       }
+
+}