1 package org
.argeo
.slc
.core
.test
.tree
;
4 import java
.util
.SortedMap
;
5 import java
.util
.TreeMap
;
7 import org
.argeo
.slc
.core
.SlcException
;
8 import org
.argeo
.slc
.core
.structure
.StructureAware
;
9 import org
.argeo
.slc
.core
.structure
.StructurePath
;
10 import org
.argeo
.slc
.core
.structure
.StructureRegistry
;
11 import org
.argeo
.slc
.core
.structure
.tree
.TreeSPath
;
12 import org
.argeo
.slc
.core
.test
.NumericTRId
;
13 import org
.argeo
.slc
.core
.test
.TestResult
;
14 import org
.argeo
.slc
.core
.test
.TestResultId
;
15 import org
.argeo
.slc
.core
.test
.TestResultListener
;
16 import org
.argeo
.slc
.core
.test
.TestResultPart
;
18 public class TreeTestResult
implements TestResult
, StructureAware
{
22 private NumericTRId testResultId
;
23 private List
<TestResultListener
> listeners
;
25 private TreeSPath currentPath
;
27 private SortedMap
<TreeSPath
, PartSubList
> resultParts
= new TreeMap
<TreeSPath
, PartSubList
>();
31 public TestResultId
getTestResultId() {
35 public NumericTRId
getNumericResultId() {
39 public void setNumericResultId(NumericTRId testResultId
) {
40 this.testResultId
= testResultId
;
43 public void setListeners(List
<TestResultListener
> listeners
) {
44 this.listeners
= listeners
;
47 public void addResultPart(TestResultPart part
) {
48 if (currentPath
== null) {
49 throw new SlcException("No current path set.");
51 PartSubList subList
= resultParts
.get(currentPath
);
52 if (subList
== null) {
53 subList
= new PartSubList();
54 resultParts
.put(currentPath
, subList
);
56 subList
.getParts().add(part
);
59 for (TestResultListener listener
: listeners
) {
60 listener
.resultPartAdded(this, part
);
64 public void notifyCurrentPath(StructureRegistry registry
, StructurePath path
) {
65 currentPath
= (TreeSPath
) path
;
68 public TreeSPath
getCurrentPath() {
72 public SortedMap
<TreeSPath
, PartSubList
> getResultParts() {
76 void setResultParts(SortedMap
<TreeSPath
, PartSubList
> resultParts
) {
77 this.resultParts
= resultParts
;
84 void setTid(Long tid
) {