]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc.core/src/main/java/org/argeo/slc/core/test/tree/CompositeTreeTestDefinition.java
Introduce examples modules
[gpl/argeo-slc.git] / org.argeo.slc.core / src / main / java / org / argeo / slc / core / test / tree / CompositeTreeTestDefinition.java
index 25479069b70e66ab9578609e3528ec76a91c814f..3468bcb255c434f56bbbcfd40127ee1e64aee814 100644 (file)
@@ -5,11 +5,10 @@ import java.util.Vector;
 \r
 import org.apache.commons.logging.Log;\r
 import org.apache.commons.logging.LogFactory;\r
-\r
 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.StructurePath;\r
+import org.argeo.slc.core.structure.StructureElementProvider;\r
 import org.argeo.slc.core.structure.StructureRegistry;\r
 import org.argeo.slc.core.structure.tree.TreeSPath;\r
 import org.argeo.slc.core.test.TestDefinition;\r
@@ -21,16 +20,17 @@ 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
+               if (log.isTraceEnabled())\r
+                       log.trace("Execute sequence of test definitions...");\r
 \r
                int i = 0;\r
                for (TestDefinition task : tasks) {\r
@@ -58,18 +58,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 +79,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