1 package org
.argeo
.slc
.core
.test
.tree
;
3 import org
.apache
.commons
.logging
.Log
;
4 import org
.apache
.commons
.logging
.LogFactory
;
6 import org
.argeo
.slc
.core
.test
.SimpleResultPart
;
7 import org
.argeo
.slc
.core
.test
.TestResult
;
8 import org
.argeo
.slc
.core
.test
.TestResultListener
;
9 import org
.argeo
.slc
.core
.test
.TestResultPart
;
10 import org
.argeo
.slc
.core
.test
.TestStatus
;
11 import org
.argeo
.slc
.core
.test
.tree
.AsynchronousTreeTestResultListener
.PartStruct
;
14 * Listener logging tree-based test results to the underlying logging system.
19 public class TreeTestResultLogger
implements TestResultListener
<TreeTestResult
> {
21 private static Log log
= LogFactory
.getLog(TreeTestResultLogger
.class);
23 public void resultPartAdded(TreeTestResult testResult
,
24 TestResultPart testResultPart
) {
25 String msg
= testResultPart
+ " - " + testResult
.getUuid() + ":"
26 + testResult
.getCurrentPath();
27 if (testResultPart
.getStatus().equals(TestStatus
.PASSED
)) {
29 } else if (testResultPart
.getStatus().equals(TestStatus
.FAILED
)) {
31 } else if (testResultPart
.getStatus().equals(TestStatus
.ERROR
)) {
32 log
.error(msg
+ "\n" + testResultPart
.getExceptionMessage());
34 log
.error("Unknow test status: " + msg
);
38 public void close(TreeTestResult testResult
) {
39 log
.info("Test result " + testResult
.getUuid() + " closed.");