]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/tree/CompositeTreeTestDefinition.java
Add web service notification of results.
[gpl/argeo-slc.git] / org.argeo.slc.core / src / main / java / org / argeo / slc / core / test / tree / CompositeTreeTestDefinition.java
index 25479069b70e66ab9578609e3528ec76a91c814f..f26c085807285b0e2ba487364ea039a19da111bf 100644 (file)
@@ -9,6 +9,7 @@ import org.apache.commons.logging.LogFactory;
 import org.argeo.slc.core.structure.SimpleSElement;\r
 import org.argeo.slc.core.structure.StructureAware;\r
 import org.argeo.slc.core.structure.StructureElement;\r
+import org.argeo.slc.core.structure.StructureElementProvider;\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
@@ -21,13 +22,13 @@ import org.argeo.slc.core.test.TestRun;
  * children.\r
  */\r
 public class CompositeTreeTestDefinition implements TestDefinition,\r
-               StructureAware {\r
+               StructureAware<TreeSPath> {\r
        private Log log = LogFactory.getLog(CompositeTreeTestDefinition.class);\r
 \r
        private List<TestDefinition> tasks = null;\r
        private List<TreeSPath> taskPaths = null;\r
        private TreeSPath path;\r
-       private StructureRegistry registry;\r
+       private StructureRegistry<TreeSPath> registry;\r
 \r
        public void execute(TestRun testRun) {\r
                log.info("Execute sequence of test definitions...");\r
@@ -58,18 +59,20 @@ public class CompositeTreeTestDefinition implements TestDefinition,
                }\r
        }\r
 \r
-       public void notifyCurrentPath(StructureRegistry registry, StructurePath path) {\r
-               this.path = (TreeSPath) path;\r
+       public void notifyCurrentPath(StructureRegistry<TreeSPath> registry,\r
+                       TreeSPath path) {\r
+               this.path = path;\r
                this.registry = registry;\r
-               \r
+\r
                // clear task paths\r
                taskPaths.clear();\r
 \r
                Integer count = 0;\r
                for (TestDefinition task : tasks) {\r
                        final StructureElement element;\r
-                       if (task instanceof StructureElement) {\r
-                               element = (StructureElement) task;\r
+                       if (task instanceof StructureElementProvider) {\r
+                               element = ((StructureElementProvider) task)\r
+                                               .createStructureElement();\r
                        } else {\r
                                element = new SimpleSElement("[no desc]");\r
                        }\r
@@ -77,7 +80,8 @@ public class CompositeTreeTestDefinition implements TestDefinition,
                        registry.register(taskPath, element);\r
                        taskPaths.add(taskPath);\r
                        if (task instanceof StructureAware) {\r
-                               ((StructureAware) task).notifyCurrentPath(registry, taskPath);\r
+                               ((StructureAware<TreeSPath>) task).notifyCurrentPath(registry,\r
+                                               taskPath);\r
                        }\r
                        count++;\r
                }\r