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
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
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
\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
\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
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