]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/tree/TreeTestResult.java
Add Slc execution notification to results
[gpl/argeo-slc.git] / org.argeo.slc.core / src / main / java / org / argeo / slc / core / test / tree / TreeTestResult.java
index 3124b055fcb3339c3aff75c241faa58cd6dfcd91..3ce0c99b5a6408d324a990c048c1df93f3366357 100644 (file)
@@ -10,8 +10,10 @@ import org.apache.commons.logging.Log;
 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.StructurePath;\r
 import org.argeo.slc.core.structure.StructureRegistry;\r
 import org.argeo.slc.core.structure.tree.TreeSPath;\r
 import org.argeo.slc.core.test.NumericTRId;\r
@@ -24,7 +26,7 @@ import org.argeo.slc.core.test.TestResultPart;
  * Complex implementation of a test result compatible with a tree based\r
  * structure.\r
  */\r
-public class TreeTestResult implements TestResult, StructureAware {\r
+public class TreeTestResult implements TestResult, StructureAware<TreeSPath>, SlcExecutionAware {\r
        private Log log = LogFactory.getLog(TreeTestResult.class);\r
        /** For ORM */\r
        private Long tid;\r
@@ -33,14 +35,17 @@ public class TreeTestResult implements TestResult, StructureAware {
        private List<TestResultListener> listeners = new Vector<TestResultListener>();\r
 \r
        private TreeSPath currentPath;\r
+       private String currentSlcExecutionUuid;\r
+       private String currentSlcExecutionStepUuid;\r
 \r
        private Date closeDate;\r
 \r
        private boolean isClosed = false;\r
 \r
        private SortedMap<TreeSPath, PartSubList> resultParts = new TreeMap<TreeSPath, PartSubList>();\r
+       private SortedMap<TreeSPath, String> pathNames = new TreeMap<TreeSPath, String>();\r
 \r
-       private StructureRegistry registry;\r
+       private StructureRegistry<TreeSPath> registry;\r
 \r
        public TestResultId getTestResultId() {\r
                return testResultId;\r
@@ -71,6 +76,8 @@ public class TreeTestResult implements TestResult, StructureAware {
                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
                subList.getParts().add(part);\r
@@ -83,7 +90,7 @@ public class TreeTestResult implements TestResult, StructureAware {
                }\r
        }\r
 \r
-       public void notifyCurrentPath(StructureRegistry registry, StructurePath path) {\r
+       public void notifyCurrentPath(StructureRegistry<TreeSPath> registry, TreeSPath path) {\r
                currentPath = (TreeSPath) path;\r
                this.registry = registry;\r
        }\r
@@ -130,14 +137,14 @@ public class TreeTestResult implements TestResult, StructureAware {
        }\r
 \r
        /** Gets the related registry (can be null). */\r
-       public StructureRegistry getRegistry() {\r
+       public StructureRegistry<TreeSPath> getRegistry() {\r
                return registry;\r
        }\r
 \r
        /** Sets the related registry. */\r
-       public void setRegistry(StructureRegistry registry) {\r
-               this.registry = registry;\r
-       }\r
+//     public void setRegistry(StructureRegistry<TreeSPath> registry) {\r
+//             this.registry = registry;\r
+//     }\r
 \r
        public Date getCloseDate() {\r
                return closeDate;\r
@@ -148,4 +155,12 @@ public class TreeTestResult implements TestResult, StructureAware {
                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
+       }\r
+\r
 }\r