]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/CompositeTreeTestDefinition.java
Manage with Maven
[gpl/argeo-slc.git] / org.argeo.slc / src / main / java / org / argeo / slc / core / test / tree / CompositeTreeTestDefinition.java
index 1fc65ab57d9dff511b3eee670afa43680dc8b37c..25479069b70e66ab9578609e3528ec76a91c814f 100644 (file)
@@ -16,6 +16,10 @@ import org.argeo.slc.core.test.TestDefinition;
 import org.argeo.slc.core.test.TestResult;\r
 import org.argeo.slc.core.test.TestRun;\r
 \r
+/**\r
+ * Collection of test definitions propagating tree structure information to its\r
+ * children.\r
+ */\r
 public class CompositeTreeTestDefinition implements TestDefinition,\r
                StructureAware {\r
        private Log log = LogFactory.getLog(CompositeTreeTestDefinition.class);\r
@@ -23,6 +27,7 @@ public class CompositeTreeTestDefinition implements TestDefinition,
        private List<TestDefinition> tasks = null;\r
        private List<TreeSPath> taskPaths = null;\r
        private TreeSPath path;\r
+       private StructureRegistry registry;\r
 \r
        public void execute(TestRun testRun) {\r
                log.info("Execute sequence of test definitions...");\r
@@ -31,7 +36,7 @@ public class CompositeTreeTestDefinition implements TestDefinition,
                for (TestDefinition task : tasks) {\r
                        TestResult result = testRun.getTestResult();\r
                        if (result instanceof StructureAware) {\r
-                               ((StructureAware) result).notifyCurrentPath(null, taskPaths\r
+                               ((StructureAware) result).notifyCurrentPath(registry, taskPaths\r
                                                .get(i));\r
                        }\r
 \r
@@ -39,12 +44,13 @@ public class CompositeTreeTestDefinition implements TestDefinition,
 \r
                        // Reset current path in case it has been changed\r
                        if (result instanceof StructureAware) {\r
-                               ((StructureAware) result).notifyCurrentPath(null, path);\r
+                               ((StructureAware) result).notifyCurrentPath(registry, path);\r
                        }\r
                        i++;\r
                }\r
        }\r
 \r
+       /** Sets the list of children test definitions */\r
        public void setTasks(List<TestDefinition> tasks) {\r
                this.tasks = tasks;\r
                if (tasks != null) {\r
@@ -54,7 +60,8 @@ public class CompositeTreeTestDefinition implements TestDefinition,
 \r
        public void notifyCurrentPath(StructureRegistry registry, StructurePath path) {\r
                this.path = (TreeSPath) path;\r
-\r
+               this.registry = registry;\r
+               \r
                // clear task paths\r
                taskPaths.clear();\r
 \r
@@ -64,7 +71,7 @@ public class CompositeTreeTestDefinition implements TestDefinition,
                        if (task instanceof StructureElement) {\r
                                element = (StructureElement) task;\r
                        } else {\r
-                               element = new SimpleSElement("<no desc>");\r
+                               element = new SimpleSElement("[no desc]");\r
                        }\r
                        TreeSPath taskPath = this.path.createChild(count.toString());\r
                        registry.register(taskPath, element);\r