import org.apache.commons.logging.LogFactory;\r
\r
import org.argeo.slc.core.SlcException;\r
-import org.argeo.slc.core.process.SlcExecution;\r
-import org.argeo.slc.core.process.SlcExecutionAware;\r
-import org.argeo.slc.core.process.SlcExecutionStep;\r
import org.argeo.slc.core.structure.StructureAware;\r
import org.argeo.slc.core.structure.StructureElement;\r
import org.argeo.slc.core.structure.StructureRegistry;\r
import org.argeo.slc.core.test.TestResult;\r
import org.argeo.slc.core.test.TestResultListener;\r
import org.argeo.slc.core.test.TestResultPart;\r
+import org.argeo.slc.core.test.TestRun;\r
+import org.argeo.slc.core.test.TestRunAware;\r
\r
/**\r
* Complex implementation of a test result compatible with a tree based\r
* structure.\r
*/\r
-public class TreeTestResult implements TestResult, StructureAware<TreeSPath>,\r
- SlcExecutionAware {\r
+public class TreeTestResult implements TestResult, StructureAware<TreeSPath> {\r
private Log log = LogFactory.getLog(TreeTestResult.class);\r
\r
private List<TestResultListener> listeners = new Vector<TestResultListener>();\r
\r
private TreeSPath currentPath;\r
- private String currentSlcExecutionUuid;\r
- private String currentSlcExecutionStepUuid;\r
+ private TestRun currentTestRun;\r
\r
private Date closeDate;\r
\r
PartSubList subList = resultParts.get(currentPath);\r
if (subList == null) {\r
subList = new PartSubList();\r
- subList.setSlcExecutionUuid(currentSlcExecutionUuid);\r
- subList.setSlcExecutionStepUuid(currentSlcExecutionStepUuid);\r
resultParts.put(currentPath, subList);\r
}\r
+ if (part instanceof TestRunAware && currentTestRun != null) {\r
+ ((TestRunAware) part).notifyTestRun(currentTestRun);\r
+ }\r
subList.getParts().add(part);\r
\r
// notify listeners\r
this.closeDate = closeDate;\r
}\r
\r
- public void notifySlcExecution(SlcExecution slcExecution) {\r
- currentSlcExecutionUuid = slcExecution.getUuid();\r
- SlcExecutionStep step = slcExecution.currentStep();\r
- if (step != null) {\r
- currentSlcExecutionStepUuid = step.getUuid();\r
- }\r
+ public void notifyTestRun(TestRun testRun) {\r
+ currentTestRun = testRun;\r
}\r
\r
public SortedMap<TreeSPath, StructureElement> getElements() {\r
this.uuid = uuid;\r
}\r
\r
+ public SortedMap<TreeSPath, StructureElement> getRelatedElements(\r
+ TreeSPath path) {\r
+ SortedMap<TreeSPath, StructureElement> relatedElements = new TreeMap<TreeSPath, StructureElement>();\r
+ List<TreeSPath> hierarchy = path.getHierarchyAsList();\r
+ for (TreeSPath currPath : elements.keySet()) {\r
+ if (hierarchy.contains(currPath)) {\r
+ relatedElements.put(currPath, elements.get(currPath));\r
+ }\r
+ }\r
+ return relatedElements;\r
+ }\r
+\r
+ public TestRun getCurrentTestRun() {\r
+ return currentTestRun;\r
+ }\r
+ \r
+ \r
}\r