X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc.core%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Ftest%2FSimpleTestResult.java;h=c1d783a77618bfc7f9309d0dfc256393683a0a7f;hb=62e442adb36b006627b17061864dfa4edde0a99a;hp=a89ffe7370c718636bba02634db79ec8f55a0c22;hpb=d5d72139e7497923c2b8e2f4d25f366d01425498;p=gpl%2Fargeo-slc.git diff --git a/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/SimpleTestResult.java b/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/SimpleTestResult.java index a89ffe737..c1d783a77 100644 --- a/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/SimpleTestResult.java +++ b/org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/SimpleTestResult.java @@ -2,6 +2,7 @@ package org.argeo.slc.core.test; import java.util.Date; import java.util.List; +import java.util.UUID; import java.util.Vector; import org.apache.commons.logging.Log; @@ -15,16 +16,19 @@ import org.argeo.slc.core.SlcException; public class SimpleTestResult implements TestResult { private static Log log = LogFactory.getLog(SimpleTestResult.class); + private String uuid; + private String currentTestRunUuid; + private Boolean throwError = true; - private TestResultId testResultId; private Date closeDate; private List parts = new Vector(); public void addResultPart(TestResultPart part) { if (throwError && part.getStatus() == ERROR) { - throw new SlcException("There was an error in the underlying test", - part.getException()); + throw new SlcException( + "There was an error in the underlying test: " + + part.getExceptionMessage()); } parts.add(part); if (log.isDebugEnabled()) @@ -36,15 +40,6 @@ public class SimpleTestResult implements TestResult { closeDate = new Date(); } - public TestResultId getTestResultId() { - return testResultId; - } - - /** Sets the test result id. */ - public void setTestResultId(TestResultId testResultId) { - this.testResultId = testResultId; - } - public List getParts() { return parts; } @@ -57,4 +52,23 @@ public class SimpleTestResult implements TestResult { 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; + } + }