]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/FullHtmlTreeReport.java
Introduce complex tree test definition
[gpl/argeo-slc.git] / org.argeo.slc / src / main / java / org / argeo / slc / core / test / tree / FullHtmlTreeReport.java
index 9dd7610335181fee1e8341c5cee21be2515a1197..38345d7b6df862d31a69bd7aa5c6fb7b1813dbc7 100644 (file)
@@ -5,6 +5,10 @@ import java.io.FileWriter;
 import java.io.IOException;\r
 import java.util.List;\r
 \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.StructureRegistry;\r
 import org.argeo.slc.core.structure.tree.TreeSPath;\r
 import org.argeo.slc.core.test.SimpleResultPart;\r
 import org.argeo.slc.core.test.TestReport;\r
@@ -12,10 +16,12 @@ import org.argeo.slc.core.test.TestResult;
 import org.argeo.slc.core.test.TestResultPart;\r
 import org.argeo.slc.dao.test.TestResultDao;\r
 \r
-public class FullHtmlTreeReport implements TestReport {\r
+public class FullHtmlTreeReport implements TestReport, StructureAware {\r
        private TestResultDao testResultDao;\r
        private File reportDir;\r
 \r
+       private StructureRegistry registry;\r
+\r
        public void generateTestReport(TestResult testResult) {\r
                if (testResultDao == null) {\r
                        TreeTestResult result = (TreeTestResult) testResult;\r
@@ -71,7 +77,17 @@ public class FullHtmlTreeReport implements TestReport {
 \r
                buf.append("<table border=1>\n");\r
                for (TreeSPath path : result.getResultParts().keySet()) {\r
-                       buf.append("<tr><td>").append(path).append("</td>\n");\r
+                       buf.append("<tr><td>");\r
+                       buf.append(path);\r
+                       StructureElement element = registry.getElement(path);\r
+                       if (registry != null) {\r
+                               if (element != null) {\r
+                                       buf.append("<br/><b>");\r
+                                       buf.append(element.getDescription());\r
+                                       buf.append("</b>");\r
+                               }\r
+                       }\r
+                       buf.append("</td>\n");\r
                        buf.append("<td>");\r
                        PartSubList subList = (PartSubList) result.getResultParts().get(\r
                                        path);\r
@@ -121,4 +137,8 @@ public class FullHtmlTreeReport implements TestReport {
                this.reportDir = reportDir;\r
        }\r
 \r
+       public void notifyCurrentPath(StructureRegistry registry, StructurePath path) {\r
+               this.registry = registry;\r
+       }\r
+\r
 }\r