1 package org
.argeo
.slc
.core
.test
;
6 import java
.util
.TreeMap
;
8 import java
.util
.Vector
;
10 import org
.apache
.commons
.logging
.Log
;
11 import org
.apache
.commons
.logging
.LogFactory
;
13 import org
.argeo
.slc
.SlcException
;
14 import org
.argeo
.slc
.test
.TestResult
;
15 import org
.argeo
.slc
.test
.TestResultPart
;
16 import org
.argeo
.slc
.test
.TestRun
;
19 * Basic implementation of a test result containing only a list of result parts.
21 public class SimpleTestResult
implements TestResult
{
22 private static Log log
= LogFactory
.getLog(SimpleTestResult
.class);
25 private String currentTestRunUuid
;
27 private Boolean throwError
= true;
29 private Date closeDate
;
30 private List
<TestResultPart
> parts
= new Vector
<TestResultPart
>();
32 private Map
<String
, String
> attributes
= new TreeMap
<String
, String
>();
34 public void addResultPart(TestResultPart part
) {
35 if (throwError
&& part
.getStatus() == ERROR
) {
36 throw new SlcException(
37 "There was an error in the underlying test: "
38 + part
.getExceptionMessage());
41 if (log
.isDebugEnabled())
47 closeDate
= new Date();
50 public List
<TestResultPart
> getParts() {
54 public Date
getCloseDate() {
58 public void setThrowError(Boolean throwError
) {
59 this.throwError
= throwError
;
62 public void notifyTestRun(TestRun testRun
) {
63 currentTestRunUuid
= testRun
.getUuid();
66 public String
getUuid() {
68 uuid
= UUID
.randomUUID().toString();
73 public void setUuid(String uuid
) {
77 public String
getCurrentTestRunUuid() {
78 return currentTestRunUuid
;
81 public Map
<String
, String
> getAttributes() {