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
>();
29 public TestResultId
getTestResultId() {
33 public NumericTRId
getNumericResultId() {
37 public void setNumericResultId(NumericTRId testResultId
) {
38 this.testResultId
= testResultId
;
41 public void setListeners(List
<TestResultListener
> listeners
) {
42 this.listeners
= listeners
;
45 public void addResultPart(TestResultPart part
) {
46 if (currentPath
== null) {
47 throw new SlcException("No current path set.");
49 PartSubList subList
= resultParts
.get(currentPath
);
50 if (subList
== null) {
51 subList
= new PartSubList();
52 resultParts
.put(currentPath
, subList
);
54 subList
.getParts().add(part
);
57 synchronized (listeners
) {
58 for (TestResultListener listener
: listeners
) {
59 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
;
81 synchronized (listeners
) {
82 for (TestResultListener listener
: listeners
) {
93 void setTid(Long tid
) {