1 package org
.argeo
.slc
.runtime
.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
;
12 import org
.argeo
.slc
.SlcException
;
13 import org
.argeo
.slc
.test
.TestResult
;
14 import org
.argeo
.slc
.test
.TestResultPart
;
15 import org
.argeo
.slc
.test
.TestRun
;
18 * Basic implementation of a test result containing only a list of result parts.
20 public class SimpleTestResult
implements TestResult
{
21 private static Log log
= LogFactory
.getLog(SimpleTestResult
.class);
24 private String currentTestRunUuid
;
26 private Boolean throwError
= true;
28 private Date closeDate
;
29 private List
<TestResultPart
> parts
= new Vector
<TestResultPart
>();
31 private Map
<String
, String
> attributes
= new TreeMap
<String
, String
>();
33 public void addResultPart(TestResultPart part
) {
34 if (throwError
&& part
.getStatus() == ERROR
) {
35 throw new SlcException(
36 "There was an error in the underlying test: "
37 + part
.getExceptionMessage());
40 if (log
.isDebugEnabled())
46 closeDate
= new Date();
49 public List
<TestResultPart
> getParts() {
53 public Date
getCloseDate() {
57 public void setThrowError(Boolean throwError
) {
58 this.throwError
= throwError
;
61 public void notifyTestRun(TestRun testRun
) {
62 currentTestRunUuid
= testRun
.getUuid();
65 public String
getUuid() {
67 uuid
= UUID
.randomUUID().toString();
72 public void setUuid(String uuid
) {
76 public String
getCurrentTestRunUuid() {
77 return currentTestRunUuid
;
80 public Map
<String
, String
> getAttributes() {
84 public void setAttributes(Map
<String
, String
> attributes
) {
85 this.attributes
= attributes
;