X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.slc%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Fslc%2Fcore%2Ftest%2Ftree%2Fhtmlreport%2FFullHtmlTreeReport.java;h=4afd8dc634a5708fffcccebcf64257c3e9f5bd4b;hb=b5c4e0c9c2fcf788a56d6ce72989fe15182e057d;hp=076da8f86dea7625243d21accca67731272a086a;hpb=875f97b054c6e996fa2d03c299c83cc80d336b54;p=gpl%2Fargeo-slc.git
diff --git a/org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/htmlreport/FullHtmlTreeReport.java b/org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/htmlreport/FullHtmlTreeReport.java
index 076da8f86..4afd8dc63 100644
--- a/org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/htmlreport/FullHtmlTreeReport.java
+++ b/org.argeo.slc/src/main/java/org/argeo/slc/core/test/tree/htmlreport/FullHtmlTreeReport.java
@@ -2,16 +2,17 @@ package org.argeo.slc.core.test.tree.htmlreport;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.text.SimpleDateFormat;
+import java.util.Comparator;
import java.util.List;
+import java.util.SortedSet;
+import java.util.TreeSet;
-import org.dbunit.dataset.IDataSet;
-import org.dbunit.dataset.xml.FlatXmlDataSet;
-import org.hsqldb.lib.FileUtil;
-
-import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.argeo.slc.core.SlcException;
import org.argeo.slc.core.structure.StructureAware;
@@ -30,7 +31,8 @@ import org.argeo.slc.dao.test.TestResultDao;
* only the passed TestResult
.
*/
public class FullHtmlTreeReport implements TestReport, StructureAware {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd hh:mm:ss");
+ private static final Log log = LogFactory.getLog(FullHtmlTreeReport.class);
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
private TestResultDao testResultDao;
private TreeSRegistryDao treeSRegistryDao;
@@ -58,11 +60,24 @@ public class FullHtmlTreeReport implements TestReport, StructureAware {
reportDir.mkdirs();
resourceToFile("index.html");
- resourceToFile("style.css");
ResultsList index = new ResultsList(this);
List list = testResultDao.listTestResults();
- for (TestResult testRes : list) {
+ SortedSet sortedSet = new TreeSet(
+ new Comparator() {
+
+ public int compare(TestResult o1, TestResult o2) {
+ if (o1.getCloseDate() == null
+ || o2.getCloseDate() == null)
+ return 0;
+ // inverse date order (last first)
+ return o2.getCloseDate().compareTo(
+ o1.getCloseDate());
+ }
+
+ });
+ sortedSet.addAll(list);
+ for (TestResult testRes : sortedSet) {
TreeTestResult result = (TreeTestResult) testRes;
index.addTestResult(result);
@@ -71,6 +86,7 @@ public class FullHtmlTreeReport implements TestReport, StructureAware {
}
index.close();
}
+ log.info("Generated HTML test result report to "+reportDir);
}
/**
@@ -120,6 +136,20 @@ public class FullHtmlTreeReport implements TestReport, StructureAware {
return reportDir;
}
+ void addStyles(StringBuffer buf) {
+ try {
+ buf.append("\n");
+ } catch (IOException e) {
+ throw new SlcException("Cannot load styles", e);
+ }
+ }
+
private void resourceToFile(String resourceName) {
try {
File file = new File(getReportDir() + File.separator + resourceName);