Remove old license headers
[gpl/argeo-slc.git] / org.argeo.slc.runtime / src / org / argeo / slc / runtime / test / SimpleResultPart.java
index 2c7726fcdd51d138e8535af84eca9c32aff41954..7ba74646331283d97667807794473197e549b1d9 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.io.Serializable;\r
-\r
-import org.argeo.slc.test.TestResultPart;\r
-import org.argeo.slc.test.TestRun;\r
-import org.argeo.slc.test.TestRunAware;\r
-import org.argeo.slc.test.TestStatus;\r
-\r
-/**\r
- * <p>\r
- * Basic implementation of a result part, implementing the standard three status\r
- * approach for test results.\r
- * </p>\r
- * \r
- * @see TestStatus\r
- */\r
-public class SimpleResultPart implements TestResultPart, TestStatus,\r
-               TestRunAware, Serializable {\r
-       private static final long serialVersionUID = 6669675957685071901L;\r
-\r
-       private Long tid;\r
-\r
-       private String testRunUuid;\r
-\r
-       /** The status. Default to ERROR since it should always be explicitely set. */\r
-       private Integer status = ERROR;\r
-       private String message;\r
-       private String exceptionMessage;\r
-\r
-       public SimpleResultPart() {\r
-       }\r
-\r
-       public SimpleResultPart(Integer status, String message) {\r
-               this(status, message, null);\r
-       }\r
-\r
-       public SimpleResultPart(Integer status, String message, Exception exception) {\r
-               this.status = status;\r
-               this.message = message;\r
-               setException(exception);\r
-       }\r
-\r
-       public String getMessage() {\r
-               return message;\r
-       }\r
-\r
-       public void setMessage(String message) {\r
-               this.message = message;\r
-       }\r
-\r
-       public void setStatus(Integer status) {\r
-               this.status = status;\r
-       }\r
-\r
-       public Integer getStatus() {\r
-               return status;\r
-       }\r
-\r
-       public String getExceptionMessage() {\r
-               return exceptionMessage;\r
-       }\r
-\r
-       public void setException(Exception exception) {\r
-               if (exception == null)\r
-                       return;\r
-\r
-               StringBuffer buf = new StringBuffer("");\r
-               buf.append(exception.toString());\r
-               buf.append('\n');\r
-               for (StackTraceElement elem : exception.getStackTrace()) {\r
-                       buf.append('\t').append(elem.toString()).append('\n');\r
-               }\r
-\r
-               if (exception.getCause() != null)\r
-                       addRootCause(buf, exception.getCause());\r
-\r
-               this.exceptionMessage = buf.toString();\r
-       }\r
-\r
-       protected void addRootCause(StringBuffer buf, Throwable cause) {\r
-               if (cause == null)\r
-                       return;\r
-\r
-               buf.append("Caused by: " + cause.getMessage());\r
-               for (StackTraceElement elem : cause.getStackTrace()) {\r
-                       buf.append('\t').append(elem.toString()).append('\n');\r
-               }\r
-\r
-               if (cause.getCause() != null) {\r
-                       addRootCause(buf, cause.getCause());\r
-               }\r
-       }\r
-\r
-       @Override\r
-       public String toString() {\r
-               StringBuffer buf = new StringBuffer("");\r
-               buf.append(SlcTestUtils.statusToString(status));\r
-               if (status == PASSED || status == FAILED) {\r
-                       buf.append(' ');\r
-               } else if (status == ERROR) {\r
-                       buf.append("  ");\r
-               }\r
-               buf.append(message);\r
-               return buf.toString();\r
-       }\r
-\r
-       /** @deprecated */\r
-       Long getTid() {\r
-               return tid;\r
-       }\r
-\r
-       /** @deprecated */\r
-       void setTid(Long tid) {\r
-               this.tid = tid;\r
-       }\r
-\r
-       public String getTestRunUuid() {\r
-               return testRunUuid;\r
-       }\r
-\r
-       /** For ORM */\r
-       public void setTestRunUuid(String testRunUuid) {\r
-               this.testRunUuid = testRunUuid;\r
-       }\r
-\r
-       public void notifyTestRun(TestRun testRun) {\r
-               testRunUuid = testRun.getUuid();\r
-       }\r
-\r
-       public void setExceptionMessage(String exceptionMessage) {\r
-               this.exceptionMessage = exceptionMessage;\r
-       }\r
-\r
-}\r
+package org.argeo.slc.runtime.test;
+
+import java.io.Serializable;
+
+import org.argeo.slc.test.TestResultPart;
+import org.argeo.slc.test.TestRun;
+import org.argeo.slc.test.TestRunAware;
+import org.argeo.slc.test.TestStatus;
+
+/**
+ * <p>
+ * Basic implementation of a result part, implementing the standard three status
+ * approach for test results.
+ * </p>
+ * 
+ * @see TestStatus
+ */
+public class SimpleResultPart implements TestResultPart, TestStatus,
+               TestRunAware, Serializable {
+       private static final long serialVersionUID = 6669675957685071901L;
+
+       private Long tid;
+
+       private String testRunUuid;
+
+       /** The status. Default to ERROR since it should always be explicitely set. */
+       private Integer status = ERROR;
+       private String message;
+       private String exceptionMessage;
+
+       public SimpleResultPart() {
+       }
+
+       public SimpleResultPart(Integer status, String message) {
+               this(status, message, null);
+       }
+
+       public SimpleResultPart(Integer status, String message, Exception exception) {
+               this.status = status;
+               this.message = message;
+               setException(exception);
+       }
+
+       public String getMessage() {
+               return message;
+       }
+
+       public void setMessage(String message) {
+               this.message = message;
+       }
+
+       public void setStatus(Integer status) {
+               this.status = status;
+       }
+
+       public Integer getStatus() {
+               return status;
+       }
+
+       public String getExceptionMessage() {
+               return exceptionMessage;
+       }
+
+       public void setException(Exception exception) {
+               if (exception == null)
+                       return;
+
+               StringBuffer buf = new StringBuffer("");
+               buf.append(exception.toString());
+               buf.append('\n');
+               for (StackTraceElement elem : exception.getStackTrace()) {
+                       buf.append('\t').append(elem.toString()).append('\n');
+               }
+
+               if (exception.getCause() != null)
+                       addRootCause(buf, exception.getCause());
+
+               this.exceptionMessage = buf.toString();
+       }
+
+       protected void addRootCause(StringBuffer buf, Throwable cause) {
+               if (cause == null)
+                       return;
+
+               buf.append("Caused by: " + cause.getMessage());
+               for (StackTraceElement elem : cause.getStackTrace()) {
+                       buf.append('\t').append(elem.toString()).append('\n');
+               }
+
+               if (cause.getCause() != null) {
+                       addRootCause(buf, cause.getCause());
+               }
+       }
+
+       @Override
+       public String toString() {
+               StringBuffer buf = new StringBuffer("");
+               buf.append(SlcTestUtils.statusToString(status));
+               if (status == PASSED || status == FAILED) {
+                       buf.append(' ');
+               } else if (status == ERROR) {
+                       buf.append("  ");
+               }
+               buf.append(message);
+               return buf.toString();
+       }
+
+       /** @deprecated */
+       Long getTid() {
+               return tid;
+       }
+
+       /** @deprecated */
+       void setTid(Long tid) {
+               this.tid = tid;
+       }
+
+       public String getTestRunUuid() {
+               return testRunUuid;
+       }
+
+       /** For ORM */
+       public void setTestRunUuid(String testRunUuid) {
+               this.testRunUuid = testRunUuid;
+       }
+
+       public void notifyTestRun(TestRun testRun) {
+               testRunUuid = testRun.getUuid();
+       }
+
+       public void setExceptionMessage(String exceptionMessage) {
+               this.exceptionMessage = exceptionMessage;
+       }
+
+}