aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Rogan Creswick <creswick@gmail.com>2013-06-24 18:55:29 -0700
committerGravatar Rogan Creswick <creswick@gmail.com>2013-06-24 18:55:29 -0700
commit750bb02df87cb2731ee593b3206f1ac442fcd69d (patch)
tree5e067684309355b8050db4c4b6e0e8fbbfeb52e9 /src
parent40342e3311a773827c5ed30a4539675d9f6c0a3a (diff)
further UI refinements for the batch runner reports
Diffstat (limited to 'src')
-rw-r--r--src/batchtools/headless/src/main/java/com/galois/fiveui/BatchRunner.java20
-rw-r--r--src/batchtools/headless/src/main/java/com/galois/fiveui/Reporter.java54
2 files changed, 42 insertions, 32 deletions
diff --git a/src/batchtools/headless/src/main/java/com/galois/fiveui/BatchRunner.java b/src/batchtools/headless/src/main/java/com/galois/fiveui/BatchRunner.java
index 345f997..934620a 100644
--- a/src/batchtools/headless/src/main/java/com/galois/fiveui/BatchRunner.java
+++ b/src/batchtools/headless/src/main/java/com/galois/fiveui/BatchRunner.java
@@ -19,27 +19,23 @@ package com.galois.fiveui;
import java.io.File;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
+import com.galois.fiveui.drivers.Drivers;
import com.google.common.collect.ImmutableList;
-import com.google.common.collect.Maps;
import com.google.common.collect.ImmutableList.Builder;
+import com.google.common.collect.Maps;
import com.google.common.io.Files;
-import com.galois.fiveui.Result;
-import com.galois.fiveui.RuleSet;
-import com.galois.fiveui.Utils;
-import com.galois.fiveui.drivers.Drivers;
import edu.uci.ics.crawler4j.util.IO;
-
-import org.apache.log4j.Logger; // System.out.* is old fashioned
+// System.out.* is old fashioned
/**
@@ -54,10 +50,8 @@ public class BatchRunner {
private JavascriptExecutor _exe;
private String _root; // FiveUI root directory
- private static final String JS_SRC_ROOT = "src/js/";
-
private static Logger logger = Logger.getLogger("com.galois.fiveui.BatchRunner");
-
+
private void registerDriver(WebDriver driver) {
logger.debug("registering new webdriver...");
this._driver = driver;
@@ -294,7 +288,7 @@ public class BatchRunner {
logger.debug("building webdrivers ...");
ImmutableList<WebDriver> r = ImmutableList.<WebDriver>of(
Drivers.buildFFDriver(ffProfile)
- // , Drivers.buildChromeDriver()
+ //, Drivers.buildChromeDriver()
);
logger.debug("built: " + r.toString());
return r;
diff --git a/src/batchtools/headless/src/main/java/com/galois/fiveui/Reporter.java b/src/batchtools/headless/src/main/java/com/galois/fiveui/Reporter.java
index b1c60af..f0461d4 100644
--- a/src/batchtools/headless/src/main/java/com/galois/fiveui/Reporter.java
+++ b/src/batchtools/headless/src/main/java/com/galois/fiveui/Reporter.java
@@ -175,24 +175,11 @@ public class Reporter {
ul();
int i = 0;
for (Result r : scopedMap.get(url)) {
- String cAttr = i % 2 == 0 ? "regRow" : "hlRow";
+ String cAttr = i % 2 == 0 ? "hlRow" : "regRow";
// format an individual Result for this url:
li().classAttr(cAttr).b().text(r.getRuleName()).end();
-
- ul();
- li().classAttr(cAttr).b().text("Description:").end();
- text(r.getRuleDesc()).end();
-
- li().classAttr(cAttr).b().text("Message:").end();
- text(r.getMsg()).end();
-
- li().classAttr(cAttr).b().text("xpath:").end();
- text(r.getXpath()).end();
-
- li().classAttr(cAttr).b().text("Severity:").end();
- text(r.getType().toString()).end();
- end();
+ resultToHtml(this, r, cAttr);
end();
i++;
}
@@ -202,10 +189,13 @@ public class Reporter {
endAll();
done();
}
+
};
return byURLPage.getBuffer().toString();
}
+
+
/**
* Build the HTML markup for a report page sorted by rule name.
*
@@ -231,10 +221,11 @@ public class Reporter {
ul();
int i = 0;
for (Result r : scopedMap.get(rule)) {
- li().classAttr(i % 2 == 0 ? "regRow" : "hlRow");
- text("Problem: " + r.getProblem()).br();
- text("URL: ").a().href(r.getURL()).text(r.getURL())
- .end().end();
+ String cAttr = i % 2 == 0 ? "hlRow" : "regRow";
+
+ li().classAttr(cAttr).b().text(r.getURL()).end();
+ resultToHtml(this, r, cAttr);
+ end();
i++;
}
end();
@@ -247,6 +238,31 @@ public class Reporter {
return byRulePage.getBuffer().toString();
}
+
+ private void resultToHtml(Html html, Result r, String cAttr) {
+
+ html.ul();
+ html.li().b().text("Description:").end();
+ html.text(r.getRuleDesc()).end();
+
+ html.li().b().text("Message:").end();
+ html.text(r.getMsg()).end();
+
+ html.li().b().text("xpath:").end();
+ html.text(r.getXpath()).end();
+
+ html.li().b().text("Severity:").end();
+ html.text(r.getType().toString()).end();
+
+ html.li().b().text("Browser:").end();
+ html.text(r.getDriver().toString()).end();
+
+ html.li().b().text("Url:").end();
+ html.a().href(r.getURL()).text(r.getURL()).end().end();
+
+ html.end();
+ }
+
/**
* Utility method to take all the reports and write them to standard file
* names under a given directory.