aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Rogan Creswick <creswick@gmail.com>2013-06-07 15:37:25 -0700
committerGravatar Rogan Creswick <creswick@gmail.com>2013-06-07 15:37:25 -0700
commit04d3c6e96ed4dd528418fe71a85e72316ae5bba4 (patch)
treed3caef5a806e2d74b26139954cec1a250382ff9f
parent8690d56ff0bbd1031e8cc6788dd2159aac6b7adb (diff)
updated the headless tools to use the new rule set format and reorganized their locations to simplify building.
-rw-r--r--Makefile6
-rw-r--r--batchtools/headless/.classpath (renamed from testrunner/.classpath)5
-rw-r--r--batchtools/headless/.gitignore (renamed from headless/.gitignore)0
-rw-r--r--batchtools/headless/.settings/org.eclipse.core.resources.prefs (renamed from testrunner/.settings/org.eclipse.core.resources.prefs)1
-rw-r--r--batchtools/headless/.settings/org.eclipse.jdt.core.prefs (renamed from rsTester/.settings/org.eclipse.jdt.core.prefs)0
-rw-r--r--batchtools/headless/.settings/org.eclipse.m2e.core.prefs (renamed from rsTester/.settings/org.eclipse.m2e.core.prefs)0
-rw-r--r--batchtools/headless/bin/HeadlessRunner-0.0.1-SNAPSHOT.one-jar.jar (renamed from headless/bin/HeadlessRunner-0.0.1-SNAPSHOT.one-jar.jar)bin29292330 -> 29292330 bytes
-rwxr-xr-xbatchtools/headless/bin/runHeadless.sh (renamed from headless/bin/runHeadless.sh)0
-rw-r--r--batchtools/headless/pom.xml (renamed from headless/pom.xml)0
-rw-r--r--batchtools/headless/programs.properties.example (renamed from headless/programs.properties.example)0
-rw-r--r--batchtools/headless/src/main/java/com/galois/fiveui/BasicCrawler.java (renamed from headless/src/main/java/com/galois/fiveui/BasicCrawler.java)0
-rw-r--r--batchtools/headless/src/main/java/com/galois/fiveui/BasicCrawlerController.java (renamed from headless/src/main/java/com/galois/fiveui/BasicCrawlerController.java)0
-rw-r--r--batchtools/headless/src/main/java/com/galois/fiveui/BatchRunner.java (renamed from headless/src/main/java/com/galois/fiveui/BatchRunner.java)0
-rw-r--r--batchtools/headless/src/main/java/com/galois/fiveui/CrawlParameters.java (renamed from headless/src/main/java/com/galois/fiveui/CrawlParameters.java)0
-rw-r--r--batchtools/headless/src/main/java/com/galois/fiveui/HeadlessAtom.java (renamed from headless/src/main/java/com/galois/fiveui/HeadlessAtom.java)7
-rw-r--r--batchtools/headless/src/main/java/com/galois/fiveui/HeadlessRunDescription.java (renamed from headless/src/main/java/com/galois/fiveui/HeadlessRunDescription.java)0
-rw-r--r--batchtools/headless/src/main/java/com/galois/fiveui/HeadlessRunner.java (renamed from headless/src/main/java/com/galois/fiveui/HeadlessRunner.java)0
-rw-r--r--batchtools/headless/src/main/java/com/galois/fiveui/Reporter.java (renamed from headless/src/main/java/com/galois/fiveui/Reporter.java)0
-rw-r--r--batchtools/headless/src/test/java/com/galois/fiveui/BatchExecutorTest.java (renamed from headless/src/test/java/com/galois/fiveui/BatchExecutorTest.java)21
-rw-r--r--batchtools/headless/src/test/java/com/galois/fiveui/CrawlParametersTest.java (renamed from headless/src/test/java/com/galois/fiveui/CrawlParametersTest.java)0
-rw-r--r--batchtools/headless/src/test/java/com/galois/fiveui/CrawlTest.java (renamed from headless/src/test/java/com/galois/fiveui/CrawlTest.java)0
-rw-r--r--batchtools/headless/src/test/java/com/galois/fiveui/HeadlessTest.java (renamed from headless/src/test/java/com/galois/fiveui/HeadlessTest.java)22
-rw-r--r--batchtools/headless/src/test/java/com/galois/fiveui/NanoHTTPD.java (renamed from headless/src/test/java/com/galois/fiveui/NanoHTTPD.java)0
-rw-r--r--batchtools/headless/src/test/java/com/galois/fiveui/ReporterTest.java (renamed from headless/src/test/java/com/galois/fiveui/ReporterTest.java)0
-rw-r--r--batchtools/headless/src/test/resources/crawlTest/four.html (renamed from headless/src/test/resources/crawlTest/four.html)0
-rw-r--r--batchtools/headless/src/test/resources/crawlTest/one.html (renamed from headless/src/test/resources/crawlTest/one.html)0
-rw-r--r--batchtools/headless/src/test/resources/crawlTest/one_a.html (renamed from headless/src/test/resources/crawlTest/one_a.html)0
-rw-r--r--batchtools/headless/src/test/resources/crawlTest/one_b.html (renamed from headless/src/test/resources/crawlTest/one_b.html)0
-rw-r--r--batchtools/headless/src/test/resources/crawlTest/one_c.html (renamed from headless/src/test/resources/crawlTest/one_c.html)0
-rw-r--r--batchtools/headless/src/test/resources/crawlTest/one_d.html (renamed from headless/src/test/resources/crawlTest/one_d.html)0
-rw-r--r--batchtools/headless/src/test/resources/crawlTest/one_e.html (renamed from headless/src/test/resources/crawlTest/one_e.html)0
-rw-r--r--batchtools/headless/src/test/resources/crawlTest/three.html (renamed from headless/src/test/resources/crawlTest/three.html)0
-rw-r--r--batchtools/headless/src/test/resources/crawlTest/two.html (renamed from headless/src/test/resources/crawlTest/two.html)0
-rw-r--r--batchtools/headless/src/test/resources/ruleSets/emptyRuleSet.json (renamed from headless/src/test/resources/ruleSets/emptyRuleSet.json)0
-rw-r--r--batchtools/headless/src/test/resources/runDescriptions/headlessRunTest0.json (renamed from headless/src/test/resources/runDescriptions/headlessRunTest0.json)0
-rw-r--r--batchtools/headless/src/test/resources/runDescriptions/headlessRunTestCNN.json (renamed from headless/src/test/resources/runDescriptions/headlessRunTestCNN.json)0
-rw-r--r--batchtools/headless/src/test/resources/runDescriptions/headlessRunTestGalois.json (renamed from headless/src/test/resources/runDescriptions/headlessRunTestGalois.json)0
-rw-r--r--batchtools/headless/src/test/resources/runDescriptions/headlessSample0.json (renamed from headless/src/test/resources/runDescriptions/headlessSample0.json)0
-rw-r--r--batchtools/headless/src/test/resources/runDescriptions/headlessSample1.json8
-rw-r--r--batchtools/headless/src/test/resources/runDescriptions/headlessSample2.json (renamed from headless/src/test/resources/runDescriptions/headlessSample2.json)4
-rw-r--r--batchtools/headless/test.html (renamed from headless/test.html)0
-rw-r--r--batchtools/pom.xml36
-rw-r--r--batchtools/rsTester/.buildpath (renamed from rsTester/.buildpath)0
-rw-r--r--batchtools/rsTester/.classpath (renamed from rsTester/.classpath)0
-rw-r--r--batchtools/rsTester/.gitignore (renamed from rsTester/.gitignore)0
-rw-r--r--batchtools/rsTester/.settings/org.ebayopensource.vjet.eclipse.core.prefs (renamed from rsTester/.settings/org.ebayopensource.vjet.eclipse.core.prefs)0
-rw-r--r--batchtools/rsTester/.settings/org.eclipse.jdt.core.prefs (renamed from webdrivers/.settings/org.eclipse.jdt.core.prefs)0
-rw-r--r--batchtools/rsTester/.settings/org.eclipse.m2e.core.prefs (renamed from testrunner/.settings/org.eclipse.m2e.core.prefs)0
-rw-r--r--batchtools/rsTester/.settings/org.maven.ide.eclipse.prefs (renamed from rsTester/.settings/org.maven.ide.eclipse.prefs)0
-rw-r--r--batchtools/rsTester/pom.xml (renamed from rsTester/pom.xml)4
-rw-r--r--batchtools/rsTester/src/main/java/com/galois/fiveui/BatchRunner.java (renamed from rsTester/src/main/java/com/galois/fiveui/BatchRunner.java)0
-rw-r--r--batchtools/rsTester/src/main/java/com/galois/fiveui/RSTestDescription.java (renamed from rsTester/src/main/java/com/galois/fiveui/RSTestDescription.java)230
-rw-r--r--batchtools/rsTester/src/main/java/com/galois/fiveui/ResType.java (renamed from rsTester/src/main/java/com/galois/fiveui/ResType.java)0
-rw-r--r--batchtools/rsTester/src/main/java/com/galois/fiveui/Result.java (renamed from rsTester/src/main/java/com/galois/fiveui/Result.java)0
-rw-r--r--batchtools/rsTester/src/main/java/com/galois/fiveui/Rule.java (renamed from rsTester/src/main/java/com/galois/fiveui/Rule.java)2
-rw-r--r--batchtools/rsTester/src/main/java/com/galois/fiveui/RuleSet.java (renamed from rsTester/src/main/java/com/galois/fiveui/RuleSet.java)75
-rw-r--r--batchtools/rsTester/src/main/java/com/galois/fiveui/RuleSetTester.java (renamed from rsTester/src/main/java/com/galois/fiveui/RuleSetTester.java)0
-rw-r--r--batchtools/rsTester/src/main/java/com/galois/fiveui/RuleTest.java (renamed from rsTester/src/main/java/com/galois/fiveui/RuleTest.java)0
-rw-r--r--batchtools/rsTester/src/main/java/com/galois/fiveui/Utils.java (renamed from rsTester/src/main/java/com/galois/fiveui/Utils.java)0
-rw-r--r--batchtools/rsTester/src/main/resources/javascript/ruleEval.js (renamed from rsTester/src/main/resources/javascript/ruleEval.js)0
-rwxr-xr-xbatchtools/rsTester/src/main/resources/seleniumDrivers/linux64/chromedriver (renamed from rsTester/src/main/resources/seleniumDrivers/linux64/chromedriver)bin16328112 -> 16328112 bytes
-rw-r--r--batchtools/rsTester/src/test/java/com/galois/fiveui/BasicRuleSetParseTest.java115
-rw-r--r--batchtools/rsTester/src/test/java/com/galois/fiveui/BasicRunDescriptionParseTest.java126
-rw-r--r--batchtools/rsTester/src/test/java/com/galois/fiveui/RunDescriptionTest.java (renamed from rsTester/src/test/java/com/galois/fiveui/RunDescriptionTest.java)44
-rw-r--r--batchtools/rsTester/src/test/resources/ruleSets/emptyCheck.js (renamed from rsTester/src/test/resources/ruleSets/emptyCheck.js)0
-rw-r--r--batchtools/rsTester/src/test/resources/ruleSets/emptyRuleSet.json (renamed from rsTester/src/test/resources/ruleSets/emptyRuleSet.json)0
-rw-r--r--batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines-caps.js19
-rw-r--r--batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines-noEmptyHdrs.js12
-rw-r--r--batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines.json6
-rw-r--r--batchtools/rsTester/src/test/resources/ruleSets/simpleRuleSet1.json (renamed from rsTester/src/test/resources/ruleSets/simpleRuleSet1.json)0
-rw-r--r--batchtools/rsTester/src/test/resources/runDescriptions/headingSample-1-fails.json (renamed from rsTester/src/test/resources/runDescriptions/headingSample-1-fails.json)0
-rw-r--r--batchtools/rsTester/src/test/resources/runDescriptions/headingSample-2-fails.json (renamed from rsTester/src/test/resources/runDescriptions/headingSample-2-fails.json)4
-rw-r--r--batchtools/rsTester/src/test/resources/runDescriptions/headingSample.json (renamed from rsTester/src/test/resources/runDescriptions/headingSample.json)4
-rw-r--r--batchtools/rsTester/src/test/resources/runDescriptions/sample0.json (renamed from rsTester/src/test/resources/runDescriptions/sample0.json)0
-rw-r--r--batchtools/rsTester/src/test/resources/runDescriptions/sample1.json (renamed from rsTester/src/test/resources/runDescriptions/sample1.json)0
-rw-r--r--batchtools/rsTester/src/test/resources/runDescriptions/sample2-fails.json (renamed from rsTester/src/test/resources/runDescriptions/sample2.json)0
-rw-r--r--batchtools/rsTester/src/test/resources/runDescriptions/sample2.json10
-rw-r--r--batchtools/rsTester/src/test/resources/runDescriptions/sample3.json (renamed from rsTester/src/test/resources/runDescriptions/sample3.json)0
-rw-r--r--batchtools/rsTester/src/test/resources/runDescriptions/sample4.json (renamed from rsTester/src/test/resources/runDescriptions/sample4.json)0
-rw-r--r--batchtools/rsTester/src/test/resources/runDescriptions/sample5.json (renamed from rsTester/src/test/resources/runDescriptions/sample5.json)0
-rw-r--r--batchtools/rsTester/test.html (renamed from rsTester/test.html)0
-rw-r--r--batchtools/webdrivers/.classpath (renamed from webdrivers/.classpath)10
-rw-r--r--batchtools/webdrivers/.gitignore (renamed from webdrivers/.gitignore)0
-rw-r--r--batchtools/webdrivers/.settings/org.eclipse.jdt.core.prefs5
-rw-r--r--batchtools/webdrivers/.settings/org.eclipse.m2e.core.prefs (renamed from webdrivers/.settings/org.eclipse.m2e.core.prefs)0
-rw-r--r--batchtools/webdrivers/pom.xml (renamed from webdrivers/pom.xml)0
-rw-r--r--batchtools/webdrivers/src/main/java/com/galois/fiveui/drivers/Drivers.java (renamed from webdrivers/src/main/java/com/galois/fiveui/drivers/Drivers.java)2
-rw-r--r--headless/src/test/resources/ruleSets/headingGuidelines.json37
-rw-r--r--headless/src/test/resources/runDescriptions/headlessSample1.json4
-rw-r--r--rsTester/src/test/resources/ruleSets/headingGuidelines.json35
-rw-r--r--testrunner/.buildpath3
-rw-r--r--testrunner/.gitignore2
-rw-r--r--testrunner/.settings/org.ebayopensource.vjet.eclipse.core.prefs2
-rw-r--r--testrunner/.settings/org.maven.ide.eclipse.prefs8
-rw-r--r--testrunner/README10
-rw-r--r--testrunner/pom.xml89
-rw-r--r--testrunner/programs.properties.example2
-rw-r--r--testrunner/src/main/java/com/galois/fiveui/selenium/SelPredicates.java45
-rw-r--r--testrunner/src/main/java/com/galois/fiveui/selenium/SelUtils.java40
-rw-r--r--testrunner/src/main/java/com/galois/fiveui/testrunner/FileServer.java99
-rw-r--r--testrunner/src/main/java/com/galois/fiveui/testrunner/FiveUINav.java219
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/chrome/ChromeOptionsTest.java189
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/chrome/RuleEvaluationTest.java159
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/firefox/FirefoxExtensionRunsTest.java60
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/jstests/MessengerTest.java42
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/jstests/PreludeTest.java42
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/jstests/RulesTest.java42
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/jstests/SettingsTest.java42
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/jstests/StateTest.java42
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/testrunner/JSRunner.java174
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/testrunner/JSTestResult.java52
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/testrunner/PassFail.java26
-rw-r--r--testrunner/src/test/java/com/galois/fiveui/testrunner/ResultsUrl.java37
113 files changed, 583 insertions, 1697 deletions
diff --git a/Makefile b/Makefile
index f00f25c..f35a817 100644
--- a/Makefile
+++ b/Makefile
@@ -80,15 +80,15 @@ MVN_TEST_CMD := xvfb-run -a $(MVN_EXE) test
define pkg
.PHONY: pkg-$1
pkg-$1:
- cd $1 && xvfb-run -a $(MVN_EXE) install
+ cd batchtools/$1 && xvfb-run -a $(MVN_EXE) install
endef
$(eval $(call pkg,rsTester))
$(eval $(call pkg,headless))
TEST_RUNNER_DIR := testrunner
-HEADLESS_DIR := headless
-RSTESTER_DIR := rsTester
+HEADLESS_DIR := batchtools/headless
+RSTESTER_DIR := batchtools/rsTester
test: fiveui.crx fiveui.xpi $(topdir)/profiles/chrome $(topdir)/profiles/firefox pkg-rsTester
# cd $(TEST_RUNNER_DIR) && $(MVN_TEST_CMD)
diff --git a/testrunner/.classpath b/batchtools/headless/.classpath
index 0a1dadd..beba987 100644
--- a/testrunner/.classpath
+++ b/batchtools/headless/.classpath
@@ -12,6 +12,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
diff --git a/headless/.gitignore b/batchtools/headless/.gitignore
index 24c4165..24c4165 100644
--- a/headless/.gitignore
+++ b/batchtools/headless/.gitignore
diff --git a/testrunner/.settings/org.eclipse.core.resources.prefs b/batchtools/headless/.settings/org.eclipse.core.resources.prefs
index f9fe345..cdfe4f1 100644
--- a/testrunner/.settings/org.eclipse.core.resources.prefs
+++ b/batchtools/headless/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8
diff --git a/rsTester/.settings/org.eclipse.jdt.core.prefs b/batchtools/headless/.settings/org.eclipse.jdt.core.prefs
index abec6ca..abec6ca 100644
--- a/rsTester/.settings/org.eclipse.jdt.core.prefs
+++ b/batchtools/headless/.settings/org.eclipse.jdt.core.prefs
diff --git a/rsTester/.settings/org.eclipse.m2e.core.prefs b/batchtools/headless/.settings/org.eclipse.m2e.core.prefs
index f897a7f..f897a7f 100644
--- a/rsTester/.settings/org.eclipse.m2e.core.prefs
+++ b/batchtools/headless/.settings/org.eclipse.m2e.core.prefs
diff --git a/headless/bin/HeadlessRunner-0.0.1-SNAPSHOT.one-jar.jar b/batchtools/headless/bin/HeadlessRunner-0.0.1-SNAPSHOT.one-jar.jar
index 2c9219d..2c9219d 100644
--- a/headless/bin/HeadlessRunner-0.0.1-SNAPSHOT.one-jar.jar
+++ b/batchtools/headless/bin/HeadlessRunner-0.0.1-SNAPSHOT.one-jar.jar
Binary files differ
diff --git a/headless/bin/runHeadless.sh b/batchtools/headless/bin/runHeadless.sh
index 4c4d863..4c4d863 100755
--- a/headless/bin/runHeadless.sh
+++ b/batchtools/headless/bin/runHeadless.sh
diff --git a/headless/pom.xml b/batchtools/headless/pom.xml
index da5b348..da5b348 100644
--- a/headless/pom.xml
+++ b/batchtools/headless/pom.xml
diff --git a/headless/programs.properties.example b/batchtools/headless/programs.properties.example
index 97bd0c6..97bd0c6 100644
--- a/headless/programs.properties.example
+++ b/batchtools/headless/programs.properties.example
diff --git a/headless/src/main/java/com/galois/fiveui/BasicCrawler.java b/batchtools/headless/src/main/java/com/galois/fiveui/BasicCrawler.java
index 7f64b1a..7f64b1a 100644
--- a/headless/src/main/java/com/galois/fiveui/BasicCrawler.java
+++ b/batchtools/headless/src/main/java/com/galois/fiveui/BasicCrawler.java
diff --git a/headless/src/main/java/com/galois/fiveui/BasicCrawlerController.java b/batchtools/headless/src/main/java/com/galois/fiveui/BasicCrawlerController.java
index 79338ec..79338ec 100644
--- a/headless/src/main/java/com/galois/fiveui/BasicCrawlerController.java
+++ b/batchtools/headless/src/main/java/com/galois/fiveui/BasicCrawlerController.java
diff --git a/headless/src/main/java/com/galois/fiveui/BatchRunner.java b/batchtools/headless/src/main/java/com/galois/fiveui/BatchRunner.java
index 9f3f301..9f3f301 100644
--- a/headless/src/main/java/com/galois/fiveui/BatchRunner.java
+++ b/batchtools/headless/src/main/java/com/galois/fiveui/BatchRunner.java
diff --git a/headless/src/main/java/com/galois/fiveui/CrawlParameters.java b/batchtools/headless/src/main/java/com/galois/fiveui/CrawlParameters.java
index a07d43a..a07d43a 100644
--- a/headless/src/main/java/com/galois/fiveui/CrawlParameters.java
+++ b/batchtools/headless/src/main/java/com/galois/fiveui/CrawlParameters.java
diff --git a/headless/src/main/java/com/galois/fiveui/HeadlessAtom.java b/batchtools/headless/src/main/java/com/galois/fiveui/HeadlessAtom.java
index 32601f0..01ffae0 100644
--- a/headless/src/main/java/com/galois/fiveui/HeadlessAtom.java
+++ b/batchtools/headless/src/main/java/com/galois/fiveui/HeadlessAtom.java
@@ -10,9 +10,6 @@ import com.google.gson.Gson;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
-import com.galois.fiveui.RuleSet;
-import com.galois.fiveui.Utils;
-
/**
* A singular url to test with a RuleSet.
*
@@ -59,9 +56,7 @@ public class HeadlessAtom {
}
String rsPath = dir + File.separator + ruleSet;
- String ruleSetStr = Utils.readFile(rsPath);
-
- RuleSet parsed = RuleSet.parse(ruleSetStr);
+ RuleSet parsed = RuleSet.parseFile(rsPath);
return new HeadlessAtom(url, parsed);
}
diff --git a/headless/src/main/java/com/galois/fiveui/HeadlessRunDescription.java b/batchtools/headless/src/main/java/com/galois/fiveui/HeadlessRunDescription.java
index 92f2ef1..92f2ef1 100644
--- a/headless/src/main/java/com/galois/fiveui/HeadlessRunDescription.java
+++ b/batchtools/headless/src/main/java/com/galois/fiveui/HeadlessRunDescription.java
diff --git a/headless/src/main/java/com/galois/fiveui/HeadlessRunner.java b/batchtools/headless/src/main/java/com/galois/fiveui/HeadlessRunner.java
index aba0ad7..aba0ad7 100644
--- a/headless/src/main/java/com/galois/fiveui/HeadlessRunner.java
+++ b/batchtools/headless/src/main/java/com/galois/fiveui/HeadlessRunner.java
diff --git a/headless/src/main/java/com/galois/fiveui/Reporter.java b/batchtools/headless/src/main/java/com/galois/fiveui/Reporter.java
index 5c0b233..5c0b233 100644
--- a/headless/src/main/java/com/galois/fiveui/Reporter.java
+++ b/batchtools/headless/src/main/java/com/galois/fiveui/Reporter.java
diff --git a/headless/src/test/java/com/galois/fiveui/BatchExecutorTest.java b/batchtools/headless/src/test/java/com/galois/fiveui/BatchExecutorTest.java
index 8fcccec..f7f593f 100644
--- a/headless/src/test/java/com/galois/fiveui/BatchExecutorTest.java
+++ b/batchtools/headless/src/test/java/com/galois/fiveui/BatchExecutorTest.java
@@ -21,9 +21,12 @@
package com.galois.fiveui;
import java.io.File;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.BindException;
+import junit.framework.Assert;
+
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.LogManager;
@@ -32,12 +35,8 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-import com.galois.fiveui.BatchRunner;
-import com.galois.fiveui.HeadlessRunDescription;
-import com.galois.fiveui.Result;
-import com.google.common.collect.ImmutableList;
-import junit.framework.Assert;
+import com.google.common.collect.ImmutableList;
/**
@@ -101,18 +100,6 @@ public class BatchExecutorTest {
}
/**
- * This unit test requires internet access to http://www.cnn.com
- *
- * @throws IOException
- * @throws FileNotFoundException
- */
- @Ignore
- public void headlessRunTestMil() throws IOException {
- String jsonFileName = RUN_DESCRIPTION_DIR + "headlessRunTestMil.json";
- testHeadlessRun(jsonFileName);
- }
-
- /**
* Helper method for headless run unit tests.
*
* @param fn filename of a .json file containing a headless run description
diff --git a/headless/src/test/java/com/galois/fiveui/CrawlParametersTest.java b/batchtools/headless/src/test/java/com/galois/fiveui/CrawlParametersTest.java
index f5ffa35..f5ffa35 100644
--- a/headless/src/test/java/com/galois/fiveui/CrawlParametersTest.java
+++ b/batchtools/headless/src/test/java/com/galois/fiveui/CrawlParametersTest.java
diff --git a/headless/src/test/java/com/galois/fiveui/CrawlTest.java b/batchtools/headless/src/test/java/com/galois/fiveui/CrawlTest.java
index 0f932c2..0f932c2 100644
--- a/headless/src/test/java/com/galois/fiveui/CrawlTest.java
+++ b/batchtools/headless/src/test/java/com/galois/fiveui/CrawlTest.java
diff --git a/headless/src/test/java/com/galois/fiveui/HeadlessTest.java b/batchtools/headless/src/test/java/com/galois/fiveui/HeadlessTest.java
index c33d86c..804d9f6 100644
--- a/headless/src/test/java/com/galois/fiveui/HeadlessTest.java
+++ b/batchtools/headless/src/test/java/com/galois/fiveui/HeadlessTest.java
@@ -13,10 +13,6 @@ import org.apache.log4j.Logger;
import org.junit.BeforeClass;
import org.junit.Test;
-import com.galois.fiveui.HeadlessAtom;
-import com.galois.fiveui.HeadlessRunDescription;
-import com.galois.fiveui.RuleSet;
-import com.galois.fiveui.Utils;
import com.google.common.collect.ImmutableList;
/**
@@ -47,8 +43,7 @@ public class HeadlessTest {
String jsonFileName = RUN_DESCRIPTION_DIR + "headlessSample0.json";
String ruleSetLoc =
RUN_DESCRIPTION_DIR + "../ruleSets/emptyRuleSet.json";
- String ruleContent = Utils.readFile(ruleSetLoc);
- RuleSet ruleSetOracle = RuleSet.parse(ruleContent);
+ RuleSet ruleSetOracle = RuleSet.parseFile(ruleSetLoc);
HeadlessAtom headlessAtomOracle =
new HeadlessAtom("http://testhost", ruleSetOracle);
HeadlessRunDescription oracle =
@@ -68,9 +63,9 @@ public class HeadlessTest {
public final void testDeserialize_headlessSample1() throws IOException {
String jsonFileName = RUN_DESCRIPTION_DIR + "headlessSample1.json";
- String ruleSetLoc =
- RUN_DESCRIPTION_DIR + "../ruleSets/headingGuidelines.json";
- RuleSet ruleSetOracle = RuleSet.parse(Utils.readFile(ruleSetLoc));
+ String ruleSetLoc = RUN_DESCRIPTION_DIR +
+ "../../../../../rsTester/src/test/resources/ruleSets/headingGuidelines.json";
+ RuleSet ruleSetOracle = RuleSet.parseFile(ruleSetLoc);
HeadlessAtom headlessAtomOracle =
new HeadlessAtom("http://testhost", ruleSetOracle);
HeadlessRunDescription oracle =
@@ -93,13 +88,14 @@ public class HeadlessTest {
// manually build first HeadlessAtom
String ruleSetLoc1 =
RUN_DESCRIPTION_DIR + "../ruleSets/emptyRuleSet.json";
- RuleSet ruleSetOracle1 = RuleSet.parse(Utils.readFile(ruleSetLoc1));
+ RuleSet ruleSetOracle1 = RuleSet.parseFile(ruleSetLoc1);
HeadlessAtom headlessAtomOracle1 =
new HeadlessAtom("http://testhost1", ruleSetOracle1);
// manually build second HeadlessAtom
- String ruleSetLoc2 =
- RUN_DESCRIPTION_DIR + "../ruleSets/headingGuidelines.json";
- RuleSet ruleSetOracle2 = RuleSet.parse(Utils.readFile(ruleSetLoc2));
+ String ruleSetLoc2 = RUN_DESCRIPTION_DIR +
+ "../../../../../rsTester/src/test/resources/ruleSets/headingGuidelines.json";
+
+ RuleSet ruleSetOracle2 = RuleSet.parseFile(ruleSetLoc2);
HeadlessAtom headlessAtomOracle2 =
new HeadlessAtom("http://testhost2", ruleSetOracle2);
diff --git a/headless/src/test/java/com/galois/fiveui/NanoHTTPD.java b/batchtools/headless/src/test/java/com/galois/fiveui/NanoHTTPD.java
index 53434be..53434be 100644
--- a/headless/src/test/java/com/galois/fiveui/NanoHTTPD.java
+++ b/batchtools/headless/src/test/java/com/galois/fiveui/NanoHTTPD.java
diff --git a/headless/src/test/java/com/galois/fiveui/ReporterTest.java b/batchtools/headless/src/test/java/com/galois/fiveui/ReporterTest.java
index 39a8e5c..39a8e5c 100644
--- a/headless/src/test/java/com/galois/fiveui/ReporterTest.java
+++ b/batchtools/headless/src/test/java/com/galois/fiveui/ReporterTest.java
diff --git a/headless/src/test/resources/crawlTest/four.html b/batchtools/headless/src/test/resources/crawlTest/four.html
index a25405b..a25405b 100644
--- a/headless/src/test/resources/crawlTest/four.html
+++ b/batchtools/headless/src/test/resources/crawlTest/four.html
diff --git a/headless/src/test/resources/crawlTest/one.html b/batchtools/headless/src/test/resources/crawlTest/one.html
index d5fae55..d5fae55 100644
--- a/headless/src/test/resources/crawlTest/one.html
+++ b/batchtools/headless/src/test/resources/crawlTest/one.html
diff --git a/headless/src/test/resources/crawlTest/one_a.html b/batchtools/headless/src/test/resources/crawlTest/one_a.html
index 3dd01ae..3dd01ae 100644
--- a/headless/src/test/resources/crawlTest/one_a.html
+++ b/batchtools/headless/src/test/resources/crawlTest/one_a.html
diff --git a/headless/src/test/resources/crawlTest/one_b.html b/batchtools/headless/src/test/resources/crawlTest/one_b.html
index dbbf635..dbbf635 100644
--- a/headless/src/test/resources/crawlTest/one_b.html
+++ b/batchtools/headless/src/test/resources/crawlTest/one_b.html
diff --git a/headless/src/test/resources/crawlTest/one_c.html b/batchtools/headless/src/test/resources/crawlTest/one_c.html
index f1ef9bc..f1ef9bc 100644
--- a/headless/src/test/resources/crawlTest/one_c.html
+++ b/batchtools/headless/src/test/resources/crawlTest/one_c.html
diff --git a/headless/src/test/resources/crawlTest/one_d.html b/batchtools/headless/src/test/resources/crawlTest/one_d.html
index 2bfb0fd..2bfb0fd 100644
--- a/headless/src/test/resources/crawlTest/one_d.html
+++ b/batchtools/headless/src/test/resources/crawlTest/one_d.html
diff --git a/headless/src/test/resources/crawlTest/one_e.html b/batchtools/headless/src/test/resources/crawlTest/one_e.html
index 3016b17..3016b17 100644
--- a/headless/src/test/resources/crawlTest/one_e.html
+++ b/batchtools/headless/src/test/resources/crawlTest/one_e.html
diff --git a/headless/src/test/resources/crawlTest/three.html b/batchtools/headless/src/test/resources/crawlTest/three.html
index a6f1c32..a6f1c32 100644
--- a/headless/src/test/resources/crawlTest/three.html
+++ b/batchtools/headless/src/test/resources/crawlTest/three.html
diff --git a/headless/src/test/resources/crawlTest/two.html b/batchtools/headless/src/test/resources/crawlTest/two.html
index 9fe3c68..9fe3c68 100644
--- a/headless/src/test/resources/crawlTest/two.html
+++ b/batchtools/headless/src/test/resources/crawlTest/two.html
diff --git a/headless/src/test/resources/ruleSets/emptyRuleSet.json b/batchtools/headless/src/test/resources/ruleSets/emptyRuleSet.json
index a01bc68..a01bc68 100644
--- a/headless/src/test/resources/ruleSets/emptyRuleSet.json
+++ b/batchtools/headless/src/test/resources/ruleSets/emptyRuleSet.json
diff --git a/headless/src/test/resources/runDescriptions/headlessRunTest0.json b/batchtools/headless/src/test/resources/runDescriptions/headlessRunTest0.json
index e6c4c3b..e6c4c3b 100644
--- a/headless/src/test/resources/runDescriptions/headlessRunTest0.json
+++ b/batchtools/headless/src/test/resources/runDescriptions/headlessRunTest0.json
diff --git a/headless/src/test/resources/runDescriptions/headlessRunTestCNN.json b/batchtools/headless/src/test/resources/runDescriptions/headlessRunTestCNN.json
index 07aaab8..07aaab8 100644
--- a/headless/src/test/resources/runDescriptions/headlessRunTestCNN.json
+++ b/batchtools/headless/src/test/resources/runDescriptions/headlessRunTestCNN.json
diff --git a/headless/src/test/resources/runDescriptions/headlessRunTestGalois.json b/batchtools/headless/src/test/resources/runDescriptions/headlessRunTestGalois.json
index 5e1e5e6..5e1e5e6 100644
--- a/headless/src/test/resources/runDescriptions/headlessRunTestGalois.json
+++ b/batchtools/headless/src/test/resources/runDescriptions/headlessRunTestGalois.json
diff --git a/headless/src/test/resources/runDescriptions/headlessSample0.json b/batchtools/headless/src/test/resources/runDescriptions/headlessSample0.json
index 2b3a51a..2b3a51a 100644
--- a/headless/src/test/resources/runDescriptions/headlessSample0.json
+++ b/batchtools/headless/src/test/resources/runDescriptions/headlessSample0.json
diff --git a/batchtools/headless/src/test/resources/runDescriptions/headlessSample1.json b/batchtools/headless/src/test/resources/runDescriptions/headlessSample1.json
new file mode 100644
index 0000000..4b33419
--- /dev/null
+++ b/batchtools/headless/src/test/resources/runDescriptions/headlessSample1.json
@@ -0,0 +1,8 @@
+[{
+ 'url': 'http://testhost',
+<<<<<<< HEAD
+ 'ruleSet': '../../../../../rsTester/src/test/resources/ruleSets/headingGuidelines.json'
+=======
+ 'ruleSet': '../ruleSets/headingGuidelines.json'
+>>>>>>> ea59a5c829886959b30b2abdfe0a8308993795fd
+}]
diff --git a/headless/src/test/resources/runDescriptions/headlessSample2.json b/batchtools/headless/src/test/resources/runDescriptions/headlessSample2.json
index 277bd4d..3c348f7 100644
--- a/headless/src/test/resources/runDescriptions/headlessSample2.json
+++ b/batchtools/headless/src/test/resources/runDescriptions/headlessSample2.json
@@ -5,5 +5,9 @@
},
{
'url': 'http://testhost2',
+<<<<<<< HEAD
+ 'ruleSet': '../../../../../rsTester/src/test/resources/ruleSets/headingGuidelines.json'
+=======
'ruleSet': '../ruleSets/headingGuidelines.json'
+>>>>>>> ea59a5c829886959b30b2abdfe0a8308993795fd
}]
diff --git a/headless/test.html b/batchtools/headless/test.html
index e69de29..e69de29 100644
--- a/headless/test.html
+++ b/batchtools/headless/test.html
diff --git a/batchtools/pom.xml b/batchtools/pom.xml
new file mode 100644
index 0000000..548cc0f
--- /dev/null
+++ b/batchtools/pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Module : pom.xml -->
+<!-- Copyright : (c) 2011-2012, Galois, Inc. -->
+<!-- -->
+<!-- Maintainer : -->
+<!-- Stability : Provisional -->
+<!-- Portability: Portable -->
+<!-- -->
+<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
+<!-- you may not use this file except in compliance with the License. -->
+<!-- You may obtain a copy of the License at -->
+<!-- -->
+<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
+<!-- -->
+<!-- Unless required by applicable law or agreed to in writing, software -->
+<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
+<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
+<!-- See the License for the specific language governing permissions and -->
+<!-- limitations under the License. -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.galois.fiveui</groupId>
+ <artifactId>BatchTools</artifactId>
+ <version>1.0</version>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>webdrivers</module>
+ <module>rsTester</module>
+ <module>headless</module>
+ </modules>
+
+</project>
diff --git a/rsTester/.buildpath b/batchtools/rsTester/.buildpath
index 24e3b93..24e3b93 100644
--- a/rsTester/.buildpath
+++ b/batchtools/rsTester/.buildpath
diff --git a/rsTester/.classpath b/batchtools/rsTester/.classpath
index 9fc2de7..9fc2de7 100644
--- a/rsTester/.classpath
+++ b/batchtools/rsTester/.classpath
diff --git a/rsTester/.gitignore b/batchtools/rsTester/.gitignore
index 7e7291c..7e7291c 100644
--- a/rsTester/.gitignore
+++ b/batchtools/rsTester/.gitignore
diff --git a/rsTester/.settings/org.ebayopensource.vjet.eclipse.core.prefs b/batchtools/rsTester/.settings/org.ebayopensource.vjet.eclipse.core.prefs
index 6e8a644..6e8a644 100644
--- a/rsTester/.settings/org.ebayopensource.vjet.eclipse.core.prefs
+++ b/batchtools/rsTester/.settings/org.ebayopensource.vjet.eclipse.core.prefs
diff --git a/webdrivers/.settings/org.eclipse.jdt.core.prefs b/batchtools/rsTester/.settings/org.eclipse.jdt.core.prefs
index abec6ca..abec6ca 100644
--- a/webdrivers/.settings/org.eclipse.jdt.core.prefs
+++ b/batchtools/rsTester/.settings/org.eclipse.jdt.core.prefs
diff --git a/testrunner/.settings/org.eclipse.m2e.core.prefs b/batchtools/rsTester/.settings/org.eclipse.m2e.core.prefs
index f897a7f..f897a7f 100644
--- a/testrunner/.settings/org.eclipse.m2e.core.prefs
+++ b/batchtools/rsTester/.settings/org.eclipse.m2e.core.prefs
diff --git a/rsTester/.settings/org.maven.ide.eclipse.prefs b/batchtools/rsTester/.settings/org.maven.ide.eclipse.prefs
index 0512605..0512605 100644
--- a/rsTester/.settings/org.maven.ide.eclipse.prefs
+++ b/batchtools/rsTester/.settings/org.maven.ide.eclipse.prefs
diff --git a/rsTester/pom.xml b/batchtools/rsTester/pom.xml
index b935c0d..b3d637f 100644
--- a/rsTester/pom.xml
+++ b/batchtools/rsTester/pom.xml
@@ -102,8 +102,8 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.9</version>
+ <version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
-</project> \ No newline at end of file
+</project>
diff --git a/rsTester/src/main/java/com/galois/fiveui/BatchRunner.java b/batchtools/rsTester/src/main/java/com/galois/fiveui/BatchRunner.java
index e065128..e065128 100644
--- a/rsTester/src/main/java/com/galois/fiveui/BatchRunner.java
+++ b/batchtools/rsTester/src/main/java/com/galois/fiveui/BatchRunner.java
diff --git a/rsTester/src/main/java/com/galois/fiveui/RSTestDescription.java b/batchtools/rsTester/src/main/java/com/galois/fiveui/RSTestDescription.java
index 056bc08..8341c6f 100644
--- a/rsTester/src/main/java/com/galois/fiveui/RSTestDescription.java
+++ b/batchtools/rsTester/src/main/java/com/galois/fiveui/RSTestDescription.java
@@ -36,7 +36,7 @@ import com.google.gson.JsonParseException;
* 'oracle': [ { 'ruleName': "Headings are capitalized"
* , 'results': ['Error', 'Error']
* },
- * { 'ruleId': "Disallow Empty Headers"
+ * { 'ruleName': "Disallow Empty Headers"
* , 'results': ['Error']
* }
* ]
@@ -108,14 +108,14 @@ public class RSTestDescription {
// TODO if File.separator is not "/", then replace "\" with File.separator.
String rsPath = descDir + File.separator + ruleSet;
- String ruleSetStr;
- try {
- ruleSetStr = Utils.readFile(rsPath);
- } catch (IOException e) {
- throw new JsonParseException("Could not read " + rsPath);
- }
- Gson gson = new Gson();
- RuleSet parsed = gson.fromJson(ruleSetStr, RuleSet.class);
+ RuleSet parsed;
+ try {
+ parsed = RuleSet.parseFile(rsPath);
+ } catch (IOException e) {
+ e.printStackTrace();
+ throw new JsonParseException(e.getMessage());
+ }
+ //RuleSet parsed = gson.fromJson(rsPath, RuleSet.class);
return new RSTestDescription(rsPath, tests, parsed);
}
@@ -173,85 +173,57 @@ public class RSTestDescription {
Gson gson = new Gson();
return gson.toJson(this);
}
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result =
- prime * result + ((_ruleSet == null) ? 0 : _ruleSet.hashCode());
- result =
- prime * result
- + ((_ruleSetLoc == null) ? 0 : _ruleSetLoc.hashCode());
- result = prime * result + ((_tests == null) ? 0 : _tests.hashCode());
- return result;
- }
@Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RSTestDescription other = (RSTestDescription) obj;
- if (_ruleSet == null) {
- if (other._ruleSet != null)
- return false;
- } else if (!_ruleSet.equals(other._ruleSet))
- return false;
- if (_ruleSetLoc == null) {
- if (other._ruleSetLoc != null)
- return false;
- } else if (!_ruleSetLoc.equals(other._ruleSetLoc))
- return false;
- if (_tests == null) {
- if (other._tests != null)
- return false;
- } else if (!_tests.equals(other._tests))
- return false;
- return true;
- }
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((_ruleSet == null) ? 0 : _ruleSet.hashCode());
+ result = prime * result
+ + ((_ruleSetLoc == null) ? 0 : _ruleSetLoc.hashCode());
+ result = prime * result + ((_tests == null) ? 0 : _tests.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ RSTestDescription other = (RSTestDescription) obj;
+ if (_ruleSet == null) {
+ if (other._ruleSet != null)
+ return false;
+ } else if (!_ruleSet.equals(other._ruleSet))
+ return false;
+ if (_ruleSetLoc == null) {
+ if (other._ruleSetLoc != null)
+ return false;
+ } else if (!_ruleSetLoc.equals(other._ruleSetLoc))
+ return false;
+ if (_tests == null) {
+ if (other._tests != null)
+ return false;
+ } else if (!_tests.equals(other._tests))
+ return false;
+ return true;
+ }
- public static class URIMap {
+ public static class URIMap {
private URI url;
private List<RuleMap> oracle;
URIMap(){}
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result +
- ((getOracle() == null) ? 0 : getOracle().hashCode());
- result = prime * result +
- ((getUrl() == null) ? 0 : getUrl().hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- URIMap other = (URIMap) obj;
- if (getOracle() == null) {
- if (other.getOracle() != null)
- return false;
- } else if (!getOracle().equals(other.getOracle()))
- return false;
- if (getUrl() == null) {
- if (other.getUrl() != null)
- return false;
- } else if (!getUrl().equals(other.getUrl()))
- return false;
- return true;
- }
+ public URIMap(URI url, List<RuleMap> oracle) {
+ super();
+ this.url = url;
+ this.oracle = oracle;
+ }
public URI getUrl() {
return url;
@@ -260,40 +232,49 @@ public class RSTestDescription {
public List<RuleMap> getOracle() {
return oracle;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((oracle == null) ? 0 : oracle.hashCode());
+ result = prime * result + ((url == null) ? 0 : url.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ URIMap other = (URIMap) obj;
+ if (oracle == null) {
+ if (other.oracle != null)
+ return false;
+ } else if (!oracle.equals(other.oracle))
+ return false;
+ if (url == null) {
+ if (other.url != null)
+ return false;
+ } else if (!url.equals(other.url))
+ return false;
+ return true;
+ }
}
public static class RuleMap {
private String ruleName;
private List<ResType> results;
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((getResults() == null) ? 0 : getResults().hashCode());
- result = prime * result + getRuleName().hashCode();
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RuleMap other = (RuleMap) obj;
- if (getResults() == null) {
- if (other.getResults() != null)
- return false;
- } else if (!getResults().equals(other.getResults()))
- return false;
- if (getRuleName() != other.getRuleName())
- return false;
- return true;
- }
+ public RuleMap(String ruleName, List<ResType> results) {
+ super();
+ this.ruleName = ruleName;
+ this.results = results;
+ }
public String getRuleName() {
return ruleName;
@@ -302,6 +283,39 @@ public class RSTestDescription {
public List<ResType> getResults() {
return results;
}
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((results == null) ? 0 : results.hashCode());
+ result = prime * result
+ + ((ruleName == null) ? 0 : ruleName.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ RuleMap other = (RuleMap) obj;
+ if (results == null) {
+ if (other.results != null)
+ return false;
+ } else if (!results.equals(other.results))
+ return false;
+ if (ruleName == null) {
+ if (other.ruleName != null)
+ return false;
+ } else if (!ruleName.equals(other.ruleName))
+ return false;
+ return true;
+ }
}
}
diff --git a/rsTester/src/main/java/com/galois/fiveui/ResType.java b/batchtools/rsTester/src/main/java/com/galois/fiveui/ResType.java
index ef14a60..ef14a60 100644
--- a/rsTester/src/main/java/com/galois/fiveui/ResType.java
+++ b/batchtools/rsTester/src/main/java/com/galois/fiveui/ResType.java
diff --git a/rsTester/src/main/java/com/galois/fiveui/Result.java b/batchtools/rsTester/src/main/java/com/galois/fiveui/Result.java
index 6543476..6543476 100644
--- a/rsTester/src/main/java/com/galois/fiveui/Result.java
+++ b/batchtools/rsTester/src/main/java/com/galois/fiveui/Result.java
diff --git a/rsTester/src/main/java/com/galois/fiveui/Rule.java b/batchtools/rsTester/src/main/java/com/galois/fiveui/Rule.java
index 606fdd4..3f420cb 100644
--- a/rsTester/src/main/java/com/galois/fiveui/Rule.java
+++ b/batchtools/rsTester/src/main/java/com/galois/fiveui/Rule.java
@@ -38,7 +38,7 @@ public class Rule {
String desc = "";
String ruleStr = "";
HashMap<String, Object> res = null;
- String stmt = str + "; return exports;";
+ String stmt = "exports = {};\n"+str + "; return exports;";
try {
driver.get("http://localhost:8000/test.html");
res = (HashMap<String, Object>) driver.executeScript(stmt);
diff --git a/rsTester/src/main/java/com/galois/fiveui/RuleSet.java b/batchtools/rsTester/src/main/java/com/galois/fiveui/RuleSet.java
index 9b416a0..ed9bc99 100644
--- a/rsTester/src/main/java/com/galois/fiveui/RuleSet.java
+++ b/batchtools/rsTester/src/main/java/com/galois/fiveui/RuleSet.java
@@ -30,7 +30,7 @@ import com.google.gson.JsonSyntaxException;
public class RuleSet {
- public static RuleSet parse(String rsFileName) throws JsonSyntaxException, IOException {
+ public static RuleSet parseFile(String rsFileName) throws JsonSyntaxException, IOException {
String descDir = new File(rsFileName).getParent();
Gson gson = new Gson();
@@ -114,42 +114,41 @@ public class RuleSet {
return gson.toJson(this);
}
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result
- + ((description == null) ? 0 : description.hashCode());
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((rules == null) ? 0 : rules.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- RuleSet other = (RuleSet) obj;
- if (description == null) {
- if (other.description != null)
- return false;
- } else if (!description.equals(other.description))
- return false;
- if (name == null) {
- if (other.name != null)
- return false;
- } else if (!name.equals(other.name))
- return false;
- if (rules == null) {
- if (other.rules != null)
- return false;
- } else if (!rules.equals(other.rules))
- return false;
- return true;
- }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result
+ + ((description == null) ? 0 : description.hashCode());
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((rules == null) ? 0 : rules.hashCode());
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ RuleSet other = (RuleSet) obj;
+ if (description == null) {
+ if (other.description != null)
+ return false;
+ } else if (!description.equals(other.description))
+ return false;
+ if (name == null) {
+ if (other.name != null)
+ return false;
+ } else if (!name.equals(other.name))
+ return false;
+ if (rules == null) {
+ if (other.rules != null)
+ return false;
+ } else if (!rules.equals(other.rules))
+ return false;
+ return true;
+ }
}
diff --git a/rsTester/src/main/java/com/galois/fiveui/RuleSetTester.java b/batchtools/rsTester/src/main/java/com/galois/fiveui/RuleSetTester.java
index 3c85b22..3c85b22 100644
--- a/rsTester/src/main/java/com/galois/fiveui/RuleSetTester.java
+++ b/batchtools/rsTester/src/main/java/com/galois/fiveui/RuleSetTester.java
diff --git a/rsTester/src/main/java/com/galois/fiveui/RuleTest.java b/batchtools/rsTester/src/main/java/com/galois/fiveui/RuleTest.java
index acf6743..acf6743 100644
--- a/rsTester/src/main/java/com/galois/fiveui/RuleTest.java
+++ b/batchtools/rsTester/src/main/java/com/galois/fiveui/RuleTest.java
diff --git a/rsTester/src/main/java/com/galois/fiveui/Utils.java b/batchtools/rsTester/src/main/java/com/galois/fiveui/Utils.java
index 429997f..429997f 100644
--- a/rsTester/src/main/java/com/galois/fiveui/Utils.java
+++ b/batchtools/rsTester/src/main/java/com/galois/fiveui/Utils.java
diff --git a/rsTester/src/main/resources/javascript/ruleEval.js b/batchtools/rsTester/src/main/resources/javascript/ruleEval.js
index 04e81ba..04e81ba 100644
--- a/rsTester/src/main/resources/javascript/ruleEval.js
+++ b/batchtools/rsTester/src/main/resources/javascript/ruleEval.js
diff --git a/rsTester/src/main/resources/seleniumDrivers/linux64/chromedriver b/batchtools/rsTester/src/main/resources/seleniumDrivers/linux64/chromedriver
index b0a0e4a..b0a0e4a 100755
--- a/rsTester/src/main/resources/seleniumDrivers/linux64/chromedriver
+++ b/batchtools/rsTester/src/main/resources/seleniumDrivers/linux64/chromedriver
Binary files differ
diff --git a/batchtools/rsTester/src/test/java/com/galois/fiveui/BasicRuleSetParseTest.java b/batchtools/rsTester/src/test/java/com/galois/fiveui/BasicRuleSetParseTest.java
new file mode 100644
index 0000000..5db53f8
--- /dev/null
+++ b/batchtools/rsTester/src/test/java/com/galois/fiveui/BasicRuleSetParseTest.java
@@ -0,0 +1,115 @@
+/**
+ *
+ * Copyright (c) 2009-2013,
+ *
+ * Galois, Inc. (creswick)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The names of the contributors may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ */
+package com.galois.fiveui;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import com.google.common.collect.Lists;
+
+/**
+ * @author creswick
+ *
+ */
+@RunWith(Parameterized.class)
+public class BasicRuleSetParseTest {
+
+ /**
+ * Set up the tests via the parameterized runner:
+ *
+ * @return
+ * @throws Throwable
+ */
+ @Parameters(name = "{0} {1}")
+ public static Collection<Object[]> setup() throws Throwable {
+ List<Object[]> tests = Lists.newArrayList();
+
+ Object[][] rawTests = new Object[][] {
+ { "ruleSets/emptyRuleSet.json", true },
+ { "ruleSets/simpleRuleSet1.json", true },
+ { "ruleSets/headingGuidelines.json", true },
+ };
+
+ for (Object[] descr : rawTests) {
+ tests.add(descr);
+ }
+
+ return tests;
+ }
+
+ /**
+ * The path (relative to test resources) to the file to test.
+ */
+ private final String _filePath;
+
+ private final boolean _parses;
+
+ public BasicRuleSetParseTest(String path, boolean parses) {
+ this._filePath = path;
+ this._parses = parses;
+ }
+
+ /**
+ * Try and parse the file, no oracle other than the expected success/fail.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testParse() throws Exception{
+ boolean actual = false;
+ String msg = "";
+ try {
+ RuleSet desc = RuleSet.parseFile("src/test/resources/"+_filePath);
+ // if desc is not null, we assume the parse worked:
+ actual = (desc != null);
+ } catch (Exception e) {
+ // if an exception was thrown, then we assume the parse failed:
+ msg = e.getMessage();
+ actual = false;
+ } finally {
+ // test to see if the parse result matched the expectation.
+ Assert.assertEquals("Parse did not complete as expected: "+msg,
+ _parses, actual);
+ }
+ }
+}
diff --git a/batchtools/rsTester/src/test/java/com/galois/fiveui/BasicRunDescriptionParseTest.java b/batchtools/rsTester/src/test/java/com/galois/fiveui/BasicRunDescriptionParseTest.java
new file mode 100644
index 0000000..57cf772
--- /dev/null
+++ b/batchtools/rsTester/src/test/java/com/galois/fiveui/BasicRunDescriptionParseTest.java
@@ -0,0 +1,126 @@
+/**
+ *
+ * Copyright (c) 2009-2013,
+ *
+ * Galois, Inc. (creswick)
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * 3. The names of the contributors may not be used to endorse or promote
+ * products derived from this software without specific prior written
+ * permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ *
+ */
+package com.galois.fiveui;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
+
+import com.google.common.collect.Lists;
+
+/**
+ * @author creswick
+ *
+ */
+@RunWith(Parameterized.class)
+public class BasicRunDescriptionParseTest {
+
+ /**
+ * Set up the tests via the parameterized runner:
+ *
+ * @return
+ * @throws Throwable
+ */
+ @Parameters(name = "{0} {1}")
+ public static Collection<Object[]> setup() throws Throwable {
+ List<Object[]> tests = Lists.newArrayList();
+
+ Object[][] rawTests = new Object[][] {
+ { "runDescriptions/sample0.json", true },
+ { "runDescriptions/sample1.json", true },
+ { "runDescriptions/sample2.json", true },
+
+ // This should test that tests must have run ids,
+ // but that can't be enforced with gson's standard deserializers.
+ // { "runDescriptions/sample2-fails.json", false },
+
+ { "runDescriptions/sample3.json", true },
+ { "runDescriptions/sample4.json", true },
+ { "runDescriptions/sample5.json", true },
+ { "runDescriptions/headingSample.json", true },
+ { "runDescriptions/headingSample-1-fails.json", true },
+ { "runDescriptions/headingSample-2-fails.json", true },
+ };
+
+ for (Object[] descr : rawTests) {
+ tests.add(descr);
+ }
+
+ return tests;
+ }
+
+ /**
+ * The path (relative to test resources) to the file to test.
+ */
+ private final String _filePath;
+
+ private final boolean _parses;
+
+ public BasicRunDescriptionParseTest(String path, boolean parses) {
+ this._filePath = path;
+ this._parses = parses;
+ }
+
+ /**
+ * Try and parse the file, no oracle other than the expected success/fail.
+ *
+ * @throws Exception
+ */
+ @Test
+ public void testParse() throws Exception{
+ boolean actual = false;
+ String msg = "";
+ try {
+ RSTestDescription desc = RSTestDescription.parse("src/test/resources/"+_filePath);
+ // if desc is not null, we assume the parse worked:
+ actual = (desc != null);
+ } catch (Exception e) {
+ // if an exception was thrown, then we assume the parse failed:
+ msg = e.getMessage();
+ actual = false;
+ } finally {
+ // test to see if the parse result matched the expectation.
+ Assert.assertEquals("Parse did not complete as expected: "+msg,
+ _parses, actual);
+ }
+ }
+}
diff --git a/rsTester/src/test/java/com/galois/fiveui/RunDescriptionTest.java b/batchtools/rsTester/src/test/java/com/galois/fiveui/RunDescriptionTest.java
index 421e012..0d5d4c4 100644
--- a/rsTester/src/test/java/com/galois/fiveui/RunDescriptionTest.java
+++ b/batchtools/rsTester/src/test/java/com/galois/fiveui/RunDescriptionTest.java
@@ -6,13 +6,15 @@
package com.galois.fiveui;
import java.io.FileNotFoundException;
+import java.net.URI;
+import java.net.URISyntaxException;
import java.util.ArrayList;
-import junit.framework.Assert;
-
+import org.junit.Assert;
import org.junit.Test;
import com.google.common.collect.ImmutableList;
+import com.google.common.collect.Lists;
/**
* @author creswick
@@ -69,6 +71,44 @@ public class RunDescriptionTest {
assertObjEqual("Object deserialized incorrectly.", oracle, actual);
}
+ /**
+ * Test method for {@link com.galois.fiveui.RSTestDescription}.
+ * @throws FileNotFoundException
+ * @throws URISyntaxException
+ */
+ @Test
+ public final void testDeserialize_headingGuidelines() throws FileNotFoundException, URISyntaxException {
+
+ String jsonFileName = RUN_DESCRIPTION_DIR + "headingSample.json";
+ String ruleSetLoc =
+ RUN_DESCRIPTION_DIR + "../ruleSets/headingGuidelines.json";
+
+ RuleSet rsOracle = new RuleSet(
+ "Heading Guidelines",
+ "Guidelines pertaining to the formatting and content of headings.",
+ ImmutableList.of("headingGuidelines-caps.js",
+ "headingGuidelines-noEmptyHdrs.js"));
+ rsOracle.setDirectory(RUN_DESCRIPTION_DIR + "../ruleSets/");
+ rsOracle.getRules(); // force the rules to parse
+
+ RSTestDescription.URIMap uriMapOracle =
+ new RSTestDescription.URIMap(
+ new URI("http://localhost:8000/exampleData/basic/headings.html"),
+
+ Lists.newArrayList(
+ new RSTestDescription.RuleMap("Headings are capitalized",
+ Lists.newArrayList(ResType.Error, ResType.Error)),
+ new RSTestDescription.RuleMap("Disallow Empty Headers",
+ Lists.newArrayList(ResType.Error))));
+
+
+ RSTestDescription oracle =
+ new RSTestDescription(ruleSetLoc, Lists.newArrayList(uriMapOracle), rsOracle);
+
+
+ RSTestDescription actual = RSTestDescription.parse(jsonFileName);
+ assertObjEqual("Object deserialized incorrectly.", oracle, actual);
+ }
private void assertObjEqual(String msg, Object oracle, Object actual) {
Assert.assertTrue(msg + "; expected: "+oracle+" actual: "+actual,
oracle.equals(actual));
diff --git a/rsTester/src/test/resources/ruleSets/emptyCheck.js b/batchtools/rsTester/src/test/resources/ruleSets/emptyCheck.js
index 6588e5b..6588e5b 100644
--- a/rsTester/src/test/resources/ruleSets/emptyCheck.js
+++ b/batchtools/rsTester/src/test/resources/ruleSets/emptyCheck.js
diff --git a/rsTester/src/test/resources/ruleSets/emptyRuleSet.json b/batchtools/rsTester/src/test/resources/ruleSets/emptyRuleSet.json
index a01bc68..a01bc68 100644
--- a/rsTester/src/test/resources/ruleSets/emptyRuleSet.json
+++ b/batchtools/rsTester/src/test/resources/ruleSets/emptyRuleSet.json
diff --git a/batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines-caps.js b/batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines-caps.js
new file mode 100644
index 0000000..f6c1cb6
--- /dev/null
+++ b/batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines-caps.js
@@ -0,0 +1,19 @@
+exports.name = "Headings are capitalized";
+
+exports.description = "Check to see if all headings use leading capital letters.";
+
+exports.rule = function() {
+ var badHeadings =
+ fiveui.query(':header').filter(
+ function(idx) {
+ var ch = $(this).text()[0];
+ if (ch) {
+ return (ch == ch.toLowerCase() );
+ } else {
+ return false;
+ }
+ });
+ $(badHeadings).map(function(idx, elt){
+ report('Heading does not start with a capitol letter.', elt);
+ });
+};
diff --git a/batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines-noEmptyHdrs.js b/batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines-noEmptyHdrs.js
new file mode 100644
index 0000000..a70f71c
--- /dev/null
+++ b/batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines-noEmptyHdrs.js
@@ -0,0 +1,12 @@
+exports.name = "Disallow Empty Headers";
+
+exports.description = "Heading elements should contain text.";
+
+exports.rule = function() {
+ fiveui.query(':header').each(
+ function(ix, elt) {
+ if($(elt).text() == '') {
+ report('Heading does not contain text', elt);
+ }
+ });
+ };
diff --git a/batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines.json b/batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines.json
new file mode 100644
index 0000000..330f389
--- /dev/null
+++ b/batchtools/rsTester/src/test/resources/ruleSets/headingGuidelines.json
@@ -0,0 +1,6 @@
+{ "name": "Heading Guidelines"
+, "description": "Guidelines pertaining to the formatting and content of headings."
+, "rules": [ "headingGuidelines-caps.js",
+ "headingGuidelines-noEmptyHdrs.js"
+ ]
+} \ No newline at end of file
diff --git a/rsTester/src/test/resources/ruleSets/simpleRuleSet1.json b/batchtools/rsTester/src/test/resources/ruleSets/simpleRuleSet1.json
index 71905cd..71905cd 100644
--- a/rsTester/src/test/resources/ruleSets/simpleRuleSet1.json
+++ b/batchtools/rsTester/src/test/resources/ruleSets/simpleRuleSet1.json
diff --git a/rsTester/src/test/resources/runDescriptions/headingSample-1-fails.json b/batchtools/rsTester/src/test/resources/runDescriptions/headingSample-1-fails.json
index 23860b4..23860b4 100644
--- a/rsTester/src/test/resources/runDescriptions/headingSample-1-fails.json
+++ b/batchtools/rsTester/src/test/resources/runDescriptions/headingSample-1-fails.json
diff --git a/rsTester/src/test/resources/runDescriptions/headingSample-2-fails.json b/batchtools/rsTester/src/test/resources/runDescriptions/headingSample-2-fails.json
index e2176cc..8a1cb38 100644
--- a/rsTester/src/test/resources/runDescriptions/headingSample-2-fails.json
+++ b/batchtools/rsTester/src/test/resources/runDescriptions/headingSample-2-fails.json
@@ -1,10 +1,10 @@
{
'ruleSet': '../ruleSets/headingGuidelines.json',
'tests': [ { 'url': 'http://localhost:8000/exampleData/basic/headings.html',
- 'oracle': [ { 'ruleId': 1
+ 'oracle': [ { 'ruleName': "Headings are capitalized"
, 'results': ['Error', 'Error', 'Error'] /* actually only errors twice */
},
- { 'ruleId': 2
+ { 'ruleName': "Disallow Empty Headers"
, 'results': ['Error']
}
]
diff --git a/rsTester/src/test/resources/runDescriptions/headingSample.json b/batchtools/rsTester/src/test/resources/runDescriptions/headingSample.json
index e8228ca..69deb49 100644
--- a/rsTester/src/test/resources/runDescriptions/headingSample.json
+++ b/batchtools/rsTester/src/test/resources/runDescriptions/headingSample.json
@@ -1,10 +1,10 @@
{
'ruleSet': '../ruleSets/headingGuidelines.json',
'tests': [ { 'url': 'http://localhost:8000/exampleData/basic/headings.html',
- 'oracle': [ { 'ruleId': 1
+ 'oracle': [ { 'ruleName': "Headings are capitalized"
, 'results': ['Error', 'Error']
},
- { 'ruleId': 2
+ { 'ruleName': "Disallow Empty Headers"
, 'results': ['Error']
}
]
diff --git a/rsTester/src/test/resources/runDescriptions/sample0.json b/batchtools/rsTester/src/test/resources/runDescriptions/sample0.json
index 0c2bbb7..0c2bbb7 100644
--- a/rsTester/src/test/resources/runDescriptions/sample0.json
+++ b/batchtools/rsTester/src/test/resources/runDescriptions/sample0.json
diff --git a/rsTester/src/test/resources/runDescriptions/sample1.json b/batchtools/rsTester/src/test/resources/runDescriptions/sample1.json
index 91f8f34..91f8f34 100644
--- a/rsTester/src/test/resources/runDescriptions/sample1.json
+++ b/batchtools/rsTester/src/test/resources/runDescriptions/sample1.json
diff --git a/rsTester/src/test/resources/runDescriptions/sample2.json b/batchtools/rsTester/src/test/resources/runDescriptions/sample2-fails.json
index a8ea9ec..a8ea9ec 100644
--- a/rsTester/src/test/resources/runDescriptions/sample2.json
+++ b/batchtools/rsTester/src/test/resources/runDescriptions/sample2-fails.json
diff --git a/batchtools/rsTester/src/test/resources/runDescriptions/sample2.json b/batchtools/rsTester/src/test/resources/runDescriptions/sample2.json
new file mode 100644
index 0000000..acff2d7
--- /dev/null
+++ b/batchtools/rsTester/src/test/resources/runDescriptions/sample2.json
@@ -0,0 +1,10 @@
+{
+ 'ruleSet': '../ruleSets/simpleRuleSet1.json',
+ 'tests': [ { 'url': 'http://localhost:8000/',
+ 'oracle': [ { 'ruleName': 'Empty Rule'
+ , 'results': []
+ }
+ ]
+ }
+ ]
+}
diff --git a/rsTester/src/test/resources/runDescriptions/sample3.json b/batchtools/rsTester/src/test/resources/runDescriptions/sample3.json
index e4d1cea..e4d1cea 100644
--- a/rsTester/src/test/resources/runDescriptions/sample3.json
+++ b/batchtools/rsTester/src/test/resources/runDescriptions/sample3.json
diff --git a/rsTester/src/test/resources/runDescriptions/sample4.json b/batchtools/rsTester/src/test/resources/runDescriptions/sample4.json
index c4f46cd..c4f46cd 100644
--- a/rsTester/src/test/resources/runDescriptions/sample4.json
+++ b/batchtools/rsTester/src/test/resources/runDescriptions/sample4.json
diff --git a/rsTester/src/test/resources/runDescriptions/sample5.json b/batchtools/rsTester/src/test/resources/runDescriptions/sample5.json
index 11ca957..11ca957 100644
--- a/rsTester/src/test/resources/runDescriptions/sample5.json
+++ b/batchtools/rsTester/src/test/resources/runDescriptions/sample5.json
diff --git a/rsTester/test.html b/batchtools/rsTester/test.html
index e69de29..e69de29 100644
--- a/rsTester/test.html
+++ b/batchtools/rsTester/test.html
diff --git a/webdrivers/.classpath b/batchtools/webdrivers/.classpath
index 0a1dadd..75e85b7 100644
--- a/webdrivers/.classpath
+++ b/batchtools/webdrivers/.classpath
@@ -12,6 +12,16 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
+ <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
+ <attributes>
+ <attribute name="maven.pomderived" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
<attributes>
<attribute name="maven.pomderived" value="true"/>
diff --git a/webdrivers/.gitignore b/batchtools/webdrivers/.gitignore
index eb5a316..eb5a316 100644
--- a/webdrivers/.gitignore
+++ b/batchtools/webdrivers/.gitignore
diff --git a/batchtools/webdrivers/.settings/org.eclipse.jdt.core.prefs b/batchtools/webdrivers/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..abec6ca
--- /dev/null
+++ b/batchtools/webdrivers/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,5 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/webdrivers/.settings/org.eclipse.m2e.core.prefs b/batchtools/webdrivers/.settings/org.eclipse.m2e.core.prefs
index f897a7f..f897a7f 100644
--- a/webdrivers/.settings/org.eclipse.m2e.core.prefs
+++ b/batchtools/webdrivers/.settings/org.eclipse.m2e.core.prefs
diff --git a/webdrivers/pom.xml b/batchtools/webdrivers/pom.xml
index 4d8847f..4d8847f 100644
--- a/webdrivers/pom.xml
+++ b/batchtools/webdrivers/pom.xml
diff --git a/webdrivers/src/main/java/com/galois/fiveui/drivers/Drivers.java b/batchtools/webdrivers/src/main/java/com/galois/fiveui/drivers/Drivers.java
index 369c4c0..d4bf40b 100644
--- a/webdrivers/src/main/java/com/galois/fiveui/drivers/Drivers.java
+++ b/batchtools/webdrivers/src/main/java/com/galois/fiveui/drivers/Drivers.java
@@ -39,7 +39,7 @@ public class Drivers {
"seleniumChromeDrivers");
private static final String FIVEUI_ROOT_PATH = "FIVEUI_ROOT_PATH";
- private static final String defaultFiveuiRootPath = "../";
+ private static final String defaultFiveuiRootPath = "../../";
private static final String firefoxProfilePath = "profiles/firefox";
private static final String chromeProfilePath = "profiles/chrome";
private static final String firefoxExtensionPath = "binaries/fiveui.xpi";
diff --git a/headless/src/test/resources/ruleSets/headingGuidelines.json b/headless/src/test/resources/ruleSets/headingGuidelines.json
deleted file mode 100644
index be69fac..0000000
--- a/headless/src/test/resources/ruleSets/headingGuidelines.json
+++ /dev/null
@@ -1,37 +0,0 @@
-{ "name": "Heading Guidelines"
-, "description": "Guidelines pertaining to the formatting and content of headings."
-, "rules": [ { "id": 1
- , "name": "Headings are capitalized"
- , "description": "Check to see if all headings use leading capital letters."
- , "rule":
- function() {
- var badHeadings =
- fiveui.query(':header').filter(
- function(idx) {
- var ch = $(this).text()[0];
- if (ch) {
- return (ch == ch.toLowerCase() );
- } else {
- return false;
- }
- });
- $(badHeadings).map(function(idx, elt){
- report('Heading does not start with a capitol letter.', elt);
- });
-
- }
- },
- { "id": 2
- , "name": "Disallow Empty Headers"
- , "description": "Heading elements should contain text."
- , "rule": function() {
- fiveui.query(':header').each(
- function(ix, elt) {
- if($(elt).text() == '') {
- report('Heading does not contain text', elt);
- }
- });
- }
- }
- ]
-} \ No newline at end of file
diff --git a/headless/src/test/resources/runDescriptions/headlessSample1.json b/headless/src/test/resources/runDescriptions/headlessSample1.json
deleted file mode 100644
index a3ee34d..0000000
--- a/headless/src/test/resources/runDescriptions/headlessSample1.json
+++ /dev/null
@@ -1,4 +0,0 @@
-[{
- 'url': 'http://testhost',
- 'ruleSet': '../ruleSets/headingGuidelines.json'
-}]
diff --git a/rsTester/src/test/resources/ruleSets/headingGuidelines.json b/rsTester/src/test/resources/ruleSets/headingGuidelines.json
deleted file mode 100644
index 7ffd003..0000000
--- a/rsTester/src/test/resources/ruleSets/headingGuidelines.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{ "name": "Heading Guidelines"
-, "description": "Guidelines pertaining to the formatting and content of headings."
-, "rules": [ { "name": "Headings are capitalized"
- , "description": "Check to see if all headings use leading capital letters."
- , "rule":
- function() {
- var badHeadings =
- fiveui.query(':header').filter(
- function(idx) {
- var ch = $(this).text()[0];
- if (ch) {
- return (ch == ch.toLowerCase() );
- } else {
- return false;
- }
- });
- $(badHeadings).map(function(idx, elt){
- report('Heading does not start with a capitol letter.', elt);
- });
-
- }
- },
- { "name": "Disallow Empty Headers"
- , "description": "Heading elements should contain text."
- , "rule": function() {
- fiveui.query(':header').each(
- function(ix, elt) {
- if($(elt).text() == '') {
- report('Heading does not contain text', elt);
- }
- });
- }
- }
- ]
-} \ No newline at end of file
diff --git a/testrunner/.buildpath b/testrunner/.buildpath
deleted file mode 100644
index a187add..0000000
--- a/testrunner/.buildpath
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<buildpath>
-</buildpath>
diff --git a/testrunner/.gitignore b/testrunner/.gitignore
deleted file mode 100644
index a16e1f1..0000000
--- a/testrunner/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-target/
-programs.properties
diff --git a/testrunner/.settings/org.ebayopensource.vjet.eclipse.core.prefs b/testrunner/.settings/org.ebayopensource.vjet.eclipse.core.prefs
deleted file mode 100644
index 6e8a644..0000000
--- a/testrunner/.settings/org.ebayopensource.vjet.eclipse.core.prefs
+++ /dev/null
@@ -1,2 +0,0 @@
-eclipse.preferences.version=1
-initialized_project_from_v4classpath=true
diff --git a/testrunner/.settings/org.maven.ide.eclipse.prefs b/testrunner/.settings/org.maven.ide.eclipse.prefs
deleted file mode 100644
index a2e76c2..0000000
--- a/testrunner/.settings/org.maven.ide.eclipse.prefs
+++ /dev/null
@@ -1,8 +0,0 @@
-#Fri Jan 20 09:16:37 PST 2012
-activeProfiles=
-eclipse.preferences.version=1
-fullBuildGoals=process-test-resources
-resolveWorkspaceProjects=true
-resourceFilterGoals=process-resources resources\:testResources
-skipCompilerPlugin=true
-version=1
diff --git a/testrunner/README b/testrunner/README
deleted file mode 100644
index 8e38b8f..0000000
--- a/testrunner/README
+++ /dev/null
@@ -1,10 +0,0 @@
-= Notes on running the test suite =
-
-The following command installs the neccesary `webdriver` JAR files to satisfy
-the projects dependencies before testing:
-
- mvn install:install-file -Dfile=webdrivers-0.0.1-SNAPSHOT.jar \
- -DgroupId=com.galois.fiveui \
- -DartifactId=webdrivers \
- -Dversion=0.0.1-SNAPSHOT \
- -Dpackaging=jar
diff --git a/testrunner/pom.xml b/testrunner/pom.xml
deleted file mode 100644
index 87caf41..0000000
--- a/testrunner/pom.xml
+++ /dev/null
@@ -1,89 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Module : pom.xml -->
-<!-- Copyright : (c) 2011-2012, Galois, Inc. -->
-<!-- -->
-<!-- Maintainer : -->
-<!-- Stability : Provisional -->
-<!-- Portability: Portable -->
-<!-- -->
-<!-- Licensed under the Apache License, Version 2.0 (the "License"); -->
-<!-- you may not use this file except in compliance with the License. -->
-<!-- You may obtain a copy of the License at -->
-<!-- -->
-<!-- http://www.apache.org/licenses/LICENSE-2.0 -->
-<!-- -->
-<!-- Unless required by applicable law or agreed to in writing, software -->
-<!-- distributed under the License is distributed on an "AS IS" BASIS, -->
-<!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
-<!-- See the License for the specific language governing permissions and -->
-<!-- limitations under the License. -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>com.galois.fiveui</groupId>
- <artifactId>testrunner</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>jar</packaging>
-
- <name>testrunner</name>
- <url>http://maven.apache.org</url>
-
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
-
- </properties>
-
- <build>
- <pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.11</version>
- <configuration>
- <systemPropertiesFile>programs.properties</systemPropertiesFile>
- </configuration>
- </plugin>
- </plugins>
- </pluginManagement>
- </build>
-
- <dependencies>
- <!-- <dependency> -->
- <!-- <groupId>org.codehaus.mojo</groupId> -->
- <!-- <artifactId>properties-maven-plugin</artifactId> -->
- <!-- <version>1.0-alpha-1</version> -->
- <!-- </dependency> -->
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.9</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.seleniumhq.selenium</groupId>
- <artifactId>selenium-java</artifactId>
- <version>2.25.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>10.0.1</version>
- </dependency>
-
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1H.22</version>
- </dependency>
- <dependency>
- <groupId>com.galois.fiveui</groupId>
- <artifactId>webdrivers</artifactId>
- <version>0.0.1-SNAPSHOT</version>
- </dependency>
- </dependencies>
-</project>
diff --git a/testrunner/programs.properties.example b/testrunner/programs.properties.example
deleted file mode 100644
index 397f33b..0000000
--- a/testrunner/programs.properties.example
+++ /dev/null
@@ -1,2 +0,0 @@
-FIREFOX_BIN_PATH=/home/creswick/myapps/firefox/firefox-10.0.7-x86_64/firefox
-FIVE_UI_CHROME_EXT_ID=nibbejpbdndgcoohhohlmmnenhdnpekm
diff --git a/testrunner/src/main/java/com/galois/fiveui/selenium/SelPredicates.java b/testrunner/src/main/java/com/galois/fiveui/selenium/SelPredicates.java
deleted file mode 100644
index cc13f9f..0000000
--- a/testrunner/src/main/java/com/galois/fiveui/selenium/SelPredicates.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Module : SelPredicates.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.selenium;
-
-import org.openqa.selenium.StaleElementReferenceException;
-import org.openqa.selenium.WebElement;
-
-import com.google.common.base.Predicate;
-
-public class SelPredicates {
-
- /**
- * Test to see if a WebElement is visible.
- * Catches {@link StaleElementReferenceException}s,
- * returning false if the element is not connected to the DOM.
- */
- public static final Predicate<? super WebElement> isVisible =
- new Predicate<WebElement>() {
- public boolean apply(WebElement input) {
- try {
- return input.isDisplayed();
- } catch (StaleElementReferenceException e) {
- return false;
- }
- }
- };
-}
diff --git a/testrunner/src/main/java/com/galois/fiveui/selenium/SelUtils.java b/testrunner/src/main/java/com/galois/fiveui/selenium/SelUtils.java
deleted file mode 100644
index 98bd2b9..0000000
--- a/testrunner/src/main/java/com/galois/fiveui/selenium/SelUtils.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Module : SelUtils.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.selenium;
-
-import java.awt.Toolkit;
-import java.awt.datatransfer.StringSelection;
-
-import org.openqa.selenium.Keys;
-import org.openqa.selenium.WebElement;
-
-public class SelUtils {
- // This method writes a string to the system clipboard.
- public static void setClipboard(String str) {
- StringSelection ss = new StringSelection(str);
- Toolkit.getDefaultToolkit().getSystemClipboard().setContents(ss, null);
- }
-
- public static void paste(WebElement elt, String str) {
- setClipboard(str);
- elt.sendKeys(Keys.CONTROL + "v");
- }
-}
diff --git a/testrunner/src/main/java/com/galois/fiveui/testrunner/FileServer.java b/testrunner/src/main/java/com/galois/fiveui/testrunner/FileServer.java
deleted file mode 100644
index 75168a9..0000000
--- a/testrunner/src/main/java/com/galois/fiveui/testrunner/FileServer.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * Module : FileServer.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.testrunner;
-
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.handler.DefaultHandler;
-import org.mortbay.jetty.handler.HandlerList;
-import org.mortbay.jetty.handler.ResourceHandler;
-import org.mortbay.jetty.nio.SelectChannelConnector;
-
-/**
- * Very basic http file server
- */
-public class FileServer {
- private final String _root;
- private Server _server;
-
- public static void main(String[] args) throws Exception {
- final FileServer server = new FileServer(".");
-
- Thread.sleep(60 * 1000);
- server.stop();
- }
-
- public void stop() throws Exception {
- _server.stop();
- }
-
- /**
- *
- * @param root The root directory to serve files from.
- */
- public FileServer(String root) {
- _root = root;
- }
-
- /**
- * Start serving http reuqests asynchronously.
- *
- * @throws Exception
- */
- public void start() {
- Runnable runner = new Runnable() {
- public void run() {
- try {
- FileServer.this.runServer();
- } catch (Exception e) {
- System.err.println("Exception starting server:");
- e.printStackTrace();
- }
- }
- };
-
- runner.run();
- }
-
- private void runServer() throws Exception {
- _server = new Server();
- SelectChannelConnector connector = new SelectChannelConnector();
- connector.setPort(getPort());
- _server.addConnector(connector);
-
- ResourceHandler resource_handler = new ResourceHandler();
- // resource_handler.setDirectoriesListed(true);
- resource_handler.setWelcomeFiles(new String[] { "index.html" });
-
- resource_handler.setResourceBase(_root);
-
- HandlerList handlers = new HandlerList();
- handlers.setHandlers(new Handler[] { resource_handler,
- new DefaultHandler() });
- _server.setHandler(handlers);
-
- _server.start();
- }
-
- public int getPort() {
- return 8080;
- }
-}
diff --git a/testrunner/src/main/java/com/galois/fiveui/testrunner/FiveUINav.java b/testrunner/src/main/java/com/galois/fiveui/testrunner/FiveUINav.java
deleted file mode 100644
index d49a1b8..0000000
--- a/testrunner/src/main/java/com/galois/fiveui/testrunner/FiveUINav.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/**
- * Module : FileUINav.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.testrunner;
-
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
-
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.support.ui.Select;
-import org.openqa.selenium.support.ui.WebDriverWait;
-
-import com.galois.fiveui.selenium.SelPredicates;
-import com.galois.fiveui.selenium.SelUtils;
-import com.google.common.base.Predicate;
-import com.google.common.collect.Collections2;
-
-public class FiveUINav {
-
- private final WebDriver _driver;
-
- public FiveUINav(WebDriver driver) {
- super();
- this._driver = driver;
- }
-
- public void loadOptionsPage() throws InterruptedException {
- String chromeExtensionId = System.getProperty("FIVE_UI_CHROME_EXT_ID",
- "nibbejpbdndgcoohhohlmmnenhdnpekm");
- String optionsUrl = "chrome-extension://"+chromeExtensionId+"/data/fiveui/options.html";
-
- _driver.get(optionsUrl);
-
- (new WebDriverWait(_driver, 10)).until(new Predicate<WebDriver>() {
- public boolean apply(WebDriver input) {
- List<WebElement> elts =
- _driver.findElements(By.id("navbar-content-title"));
- return elts.size() != 0;
- }
- });
- }
-
- /**
- * Assumes options page is active.
- */
- public void clickAndRemove(final String cssSelector) {
- List<WebElement> removeBtns = _driver.findElements(By.cssSelector(cssSelector));
- for (WebElement button : Collections2.filter(removeBtns, SelPredicates.isVisible)) {
- button.click();
- }
-
- (new WebDriverWait(_driver, 10)).until(new Predicate<WebDriver>() {
- public boolean apply(WebDriver input) {
- List<WebElement> elts = input.findElements(By.cssSelector(cssSelector));
- return Collections2.filter(elts, SelPredicates.isVisible).size() == 0;
- }
- });
- }
-
- /**
- * Safe to run from any active tab.
- *
- * Results in the options page being active.
- *
- * @throws InterruptedException
- */
- public void clearOptions() throws InterruptedException {
- loadOptionsPage();
- removeUrlPats();
- removeRuleStes();
- }
-
- /**
- * Assumes options page is active.
- * @throws InterruptedException
- */
- public void removeRuleStes() throws InterruptedException {
- loadRuleSetPage();
- clickAndRemove("div.controls>button");
- }
-
- /**
- * Assumes options page is active.
- * @throws InterruptedException
- */
- public void removeUrlPats() throws InterruptedException {
- loadUrlPatsPage();
- clickAndRemove("div.controls>button");
- }
-
- /**
- * Assumes options page is active.
- * @throws InterruptedException
- */
- public void addRuleSet(String ruleSet) throws InterruptedException {
- loadRuleSetPage();
-
- WebElement addButton = _driver.findElement(By.id("addRsButton"));
- addButton.click();
-
- WebElement editor = _driver.findElement(By.cssSelector("#aceEditor textarea"));
- SelUtils.paste(editor, ruleSet);
-
- // hack. The last keys sent don't *always* finish before we click save, which causes
- // an eval error, popping up an alert that shouldn't happen.
- // This small delay should help keep that from happening. Normally, we'd use a
- // WebDriverWait, or FiveUINave.expectCondition, but this is a somewhat unique situation
- // because of the nuances of the Ace Editor.
- Thread.sleep(100);
-
- WebElement saveButton = _driver.findElement(By.id("saveEditButton"));
- saveButton.click();
- }
-
- /**
- * Assumes options page is active.
- * @throws InterruptedException
- */
- public void addUrlPat(String pattern, String rsName) throws InterruptedException {
- loadUrlPatsPage();
-
- WebElement addButton = _driver.findElement(By.id("addUrlPat"));
- addButton.click();
-
- WebElement editor = _driver.findElement(By.id("urlPatRegex"));
- editor.sendKeys(pattern);
-
- WebElement ruleSets = _driver.findElement(By.cssSelector("#urlPatRuleSetId"));
- Select select = new Select(ruleSets);
- select.selectByVisibleText(rsName);
-
- WebElement saveButton = _driver.findElement(By.id("confirmAddUrlPat"));
- saveButton.click();
- }
-
- /**
- * Assumes options page is active.
- *
- * @param show True to ensure the default display is enabled,
- * False to make the fiveui window hide by default.
- */
- public void setDisplayDefault(boolean show) {
- loadOptionsPane("basics");
- WebElement elt = _driver.findElement(By.id("windowDisplayDefault"));
-
- if ( elt.isSelected() != show ){
- elt.click();
- }
- }
-
- /**
- * Assumes options page is active.
- * @throws InterruptedException
- */
- public void loadUrlPatsPage() throws InterruptedException {
- loadOptionsPane("url-defaults");
- }
-
- /**
- * Assumes options page is active.
- * @throws InterruptedException
- */
- public void loadRuleSetPage() throws InterruptedException {
- loadOptionsPane("rule-sets");
- }
-
- private void loadOptionsPane(String navId) {
-
- final WebElement navLink = _driver.findElement(By.id(navId));
- navLink.click();
- (new WebDriverWait(_driver, 10)).until(new Predicate<WebDriver>() {
- public boolean apply(WebDriver input) {
- String classes = navLink.getAttribute("class");
- return classes.contains("selected");
- }
- });
- }
-
-
- /**
- * Wait for a specified condition to become true. Throws an {@link AssertionError}
- * if the timeout occurs before the condition is satisfied.
- *
- * @param msg
- * @param timeout The timeout, in seconds, to wait before throwing an AssertionError
- * @param condition
- */
- public void expectCondition(final String msg, long timeout, Predicate<WebDriver> condition) {
- (new WebDriverWait(_driver, timeout) {
-
- @Override
- protected RuntimeException timeoutException(String message,
- RuntimeException lastException) {
- throw new AssertionError(msg);
- }
-
- }).until(condition);
- }
-}
diff --git a/testrunner/src/test/java/com/galois/fiveui/chrome/ChromeOptionsTest.java b/testrunner/src/test/java/com/galois/fiveui/chrome/ChromeOptionsTest.java
deleted file mode 100644
index 659a5fa..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/chrome/ChromeOptionsTest.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
- * Module : ChromeOptionsTest.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.chrome;
-
-import java.util.List;
-
-
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.Assert;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.chrome.ChromeDriver;
-import org.openqa.selenium.support.ui.WebDriverWait;
-
-import com.galois.fiveui.drivers.Drivers;
-import com.galois.fiveui.testrunner.FiveUINav;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-@Ignore
-public class ChromeOptionsTest {
- private static ChromeDriver _driver;
- private static FiveUINav _fiveui;
-
-
- @BeforeClass
- public static void setUp() {
- //_driver = Drivers.buildChromeDriver();
- _fiveui = new FiveUINav(_driver);
- }
-
- @AfterClass
- public static void tearDown() {
- _driver.quit();
- }
-
- @Before
- public void preTest() throws InterruptedException {
- _fiveui.clearOptions();
- }
-
- /**
- * Check to see if the options page loads more or less correctly.
- *
- * @throws InterruptedException
- */
- @Test
- @Ignore
- public void testOptionsPageLoads() throws InterruptedException {
-
- WebElement optionsTitle = _driver.findElement(By.id("navbar-content-title"));
- Assert.assertEquals("Wrong options page?", "Settings", optionsTitle.getText());
-
- final ImmutableMap<String, String> navAndTitles =
- ImmutableMap.of("nav > #url-defaults", "#tab-url-defaults > .title",
- "nav > #rule-sets", "#tab-rule-sets > .title",
- "nav > #basics", "#tab-basics > .title");
-
- for (final String key : navAndTitles.keySet()){
- WebElement link = _driver.findElementByCssSelector(key);
- link.click();
- _fiveui.expectCondition("Expected title never became visible",
- 5, new Predicate<WebDriver>(){
- public boolean apply(WebDriver input) {
- WebElement elt = _driver.findElementByCssSelector(navAndTitles.get(key));
- return (! elt.getText().equals("")) && elt.isDisplayed();
- }
- });
- }
-//
-// final WebElement urlTitle = _driver.findElementByCssSelector("#tab-url-defaults>.title");
-// final WebElement rsTitle = _driver.findElementByCssSelector("#tab-rule-sets>.title");
-//
-// Assert.assertTrue("url defaults title is *not* showing", urlTitle.isDisplayed());
-// Assert.assertTrue("rule sets title is showing", rsTitle.getText().equals("")
-// || rsTitle.isDisplayed());
-//
-// WebElement nav = _driver.findElement(By.id("rule-sets"));
-// nav.click();
-// (new WebDriverWait(_driver, 10)).until(new Predicate<WebDriver>() {
-// public boolean apply(WebDriver input) {
-// return !urlTitle.isDisplayed();
-// }
-// });
-// Assert.assertTrue("rule sets title is *not* showing", rsTitle.isDisplayed());
-// Assert.assertTrue("url defaults title is showing", urlTitle.getText().equals("")
-// || urlTitle.isDisplayed());
- }
-
- /**
- * Check to see that a rule set can be added, and that it shows
- * up in the list of Rule Sets.
- *
- * @throws InterruptedException
- */
- @Test
- @Ignore
- public void simpleRuleSetTest() throws InterruptedException {
- String rsName = "Test rule set";
- String ruleSet = "{ 'name': '"+rsName+"', " +
- " 'description': 'test'," +
- " 'rules': [ { 'name': 'Test rule'," +
- " 'description': 'An empty test rule'," +
- " 'rule': function() { report('test error'); }" +
- " } ]" +
- "}";
-
- _fiveui.addRuleSet(ruleSet);
- List<WebElement> ruleSets = _driver.findElements(By.cssSelector("#ruleSetEntries .title"));
-
- Assert.assertEquals("Rule Set was not added", 1, ruleSets.size());
- Assert.assertEquals("Wrong ruleset found", rsName, ruleSets.get(0).getText());
- }
-
- /**
- * Check to see that a rule set can be added, and that it shows
- * up in the list of Rule Sets.
- *
- * @throws InterruptedException
- */
- @Test
- @Ignore
- public void simpleUlPatTest() throws InterruptedException {
- String rsName = "Test rule set";
- String ruleSet = "{ 'name': '"+rsName+"', " +
- " 'description': 'test'," +
- " 'rules': [ { 'name': 'Test rule'," +
- " 'description': 'An empty test rule'," +
- " 'rule': function() { report('test error'); }" +
- " } ]" +
- "}";
-
- _fiveui.addRuleSet(ruleSet);
-
- String pattern = "*localhost*";
- _fiveui.addUrlPat(pattern, rsName);
-
- _fiveui.loadUrlPatsPage();
-
- List<WebElement> urlPats = _driver.findElements(By.cssSelector("#urlPatEntries .title"));
- Assert.assertEquals("Rule Set was not added", 1, urlPats.size());
- Assert.assertEquals("Wrong ruleset found", pattern, urlPats.get(0).getText());
- }
-
-
-
- @Test
- @Ignore
- public void runRuleSetTest() throws InterruptedException {
- String rsName = "Test rule set";
- String ruleSet = "{ 'name': '"+rsName+"', " +
- " 'description': 'test'," +
- " 'rules': [ { 'name': 'Test rule'," +
- " 'description': 'An empty test rule'," +
- " 'rule': function() { report('test error'); }" +
- " } ]" +
- "}";
-
- _fiveui.addRuleSet(ruleSet);
-
-
- }
-
-
-}
diff --git a/testrunner/src/test/java/com/galois/fiveui/chrome/RuleEvaluationTest.java b/testrunner/src/test/java/com/galois/fiveui/chrome/RuleEvaluationTest.java
deleted file mode 100644
index 52705b5..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/chrome/RuleEvaluationTest.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/**
- * Module : RuleEvaluationTest.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.chrome;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.util.List;
-
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebDriver;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.chrome.ChromeDriver;
-
-import com.galois.fiveui.drivers.Drivers;
-import com.galois.fiveui.testrunner.FileServer;
-import com.galois.fiveui.testrunner.FiveUINav;
-import com.google.common.base.Predicate;
-import com.google.common.io.Files;
-
-@Ignore
-public class RuleEvaluationTest {
- private static ChromeDriver _driver;
- private static FiveUINav _fiveui;
- private static FileServer _server;
-
- @BeforeClass
- public static void setUp() {
- //_driver = Drivers.buildChromeDriver();
- _fiveui = new FiveUINav(_driver);
-
- try {
- // set up a file server to serve from the exampleData dir:
- _server = new FileServer("../");
- _server.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @AfterClass
- public static void tearDown() {
- try {
- _driver.quit();
- _server.stop();
- } catch (Exception e) {
- System.err.println("exception shutting down test");
- e.printStackTrace();
- }
- }
-
- @Before
- public void preTest() throws InterruptedException {
- _fiveui.clearOptions();
- }
-
- /**
- * Check to see that a very basic rule will evaluate in the context of a matching url.
- * @throws InterruptedException
- */
- @Ignore
- @Test
- public void ruleEvaluates() throws InterruptedException {
- String rsName = "Test rule set";
- String ruleSet = "{ 'name': '"+rsName+"', " +
- " 'description': 'test'," +
- " 'rules': [ { 'name': 'Test rule'," +
- " 'description': 'An empty test rule'," +
- " 'rule': function() { report('test error'); }" +
- " } ]" +
- "}";
-
- _fiveui.addRuleSet(ruleSet);
-
- String pattern = "*localhost*";
- _fiveui.addUrlPat(pattern, rsName);
- _fiveui.setDisplayDefault(true);
-
- _driver.get("http://localhost:"+_server.getPort()+"/exampleData/basic/headings.html");
-
- _fiveui.expectCondition("FiveUI Window should be showing", 5, new Predicate<WebDriver>() {
- public boolean apply(WebDriver input) {
- List<WebElement> uicWindow = _driver.findElements(By.id("uic-top"));
- return uicWindow.size() != 0 && uicWindow.get(0).isDisplayed();
- }
- });
-
- _fiveui.expectCondition("Wrong number of problems.", 5, new Predicate<WebDriver>() {
- public boolean apply(WebDriver input) {
- List<WebElement> problems = _driver.findElements(By.cssSelector("#problemList>.pr"));
- return problems.size() != 1;
- }
- });
- }
-
- /**
- * Check that selecting a rule highlights the correct element of the dom.
- * @throws InterruptedException
- * @throws IOException
- */
- @Ignore
- @Test
- public void rulesHighlight() throws InterruptedException, IOException {
- String rsName = "reportOnSampleText";
- File rsFile = new File("../exampleData/ruleSets/"+rsName+".json");
- String ruleSet = Files.toString(rsFile, Charset.defaultCharset());
-
- _fiveui.addRuleSet(ruleSet);
-
- String pattern = "*localhost*";
- _fiveui.addUrlPat(pattern, rsName);
- _fiveui.setDisplayDefault(true);
-
- _driver.get("http://localhost:"+_server.getPort()+"/exampleData/basic/headings.html");
-
-
- _fiveui.expectCondition("Wrong number of problems.", 5, new Predicate<WebDriver>() {
- public boolean apply(WebDriver input) {
- //List<WebElement> problems = _driver.findElements(By.cssSelector("#problemList .prExpand"));
- List<WebElement> problems = _driver.findElements(By.className("prExpand"));
- return problems.size() == 1;
- }
- });
-
- WebElement expand = _driver.findElement(By.cssSelector("#problemList .prExpand"));
- expand.click();
-
- _fiveui.expectCondition("Nothing was tagged as a uic-problem.", 5, new Predicate<WebDriver>() {
- public boolean apply(WebDriver input) {
- List<WebElement> problems = _driver.findElements(By.className("uic-problem"));
- return problems.size() == 1;
- }
- });
- }
-} \ No newline at end of file
diff --git a/testrunner/src/test/java/com/galois/fiveui/firefox/FirefoxExtensionRunsTest.java b/testrunner/src/test/java/com/galois/fiveui/firefox/FirefoxExtensionRunsTest.java
deleted file mode 100644
index a30e3fd..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/firefox/FirefoxExtensionRunsTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Module : FirefoxExtensionRunsTest.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.firefox;
-
-import junit.framework.Assert;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.openqa.selenium.By;
-import org.openqa.selenium.WebElement;
-import org.openqa.selenium.firefox.FirefoxDriver;
-
-import com.galois.fiveui.drivers.Drivers;
-
-public class FirefoxExtensionRunsTest {
- static FirefoxDriver _driver;
-
- @BeforeClass
- public static void setUp() {
- _driver = Drivers.buildFFDriver();
- }
-
- @Test
- @Ignore
- public void testRuns() throws InterruptedException {
- loadOptionsPage();
-
- WebElement optionsTitle = _driver.findElement(By.id("navbar-content-title"));
- Assert.assertEquals("Wrong options page?", "Settings", optionsTitle.getText());
- }
-
- private void loadOptionsPage() {
-
- }
-
- @AfterClass
- public static void tearDown() {
- _driver.quit();
- }
-}
diff --git a/testrunner/src/test/java/com/galois/fiveui/jstests/MessengerTest.java b/testrunner/src/test/java/com/galois/fiveui/jstests/MessengerTest.java
deleted file mode 100644
index 9fa168f..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/jstests/MessengerTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Module : MessengerTest.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.jstests;
-
-
-import org.junit.runner.RunWith;
-
-import com.galois.fiveui.testrunner.JSRunner;
-import com.galois.fiveui.testrunner.ResultsUrl;
-
-/**
- * @author creswick
- *
- */
-@RunWith(JSRunner.class)
-public class MessengerTest {
- private static final String testPath = "data/fiveui/messenger-test.html";
- private static final String testUrl = "http://localhost:8080/"+testPath;
-
- @ResultsUrl
- public static String url() {
- return testUrl;
- }
-} \ No newline at end of file
diff --git a/testrunner/src/test/java/com/galois/fiveui/jstests/PreludeTest.java b/testrunner/src/test/java/com/galois/fiveui/jstests/PreludeTest.java
deleted file mode 100644
index 7eea688..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/jstests/PreludeTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Module : PreludeTest.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.jstests;
-
-
-import org.junit.runner.RunWith;
-
-import com.galois.fiveui.testrunner.JSRunner;
-import com.galois.fiveui.testrunner.ResultsUrl;
-
-/**
- * @author creswick
- *
- */
-@RunWith(JSRunner.class)
-public class PreludeTest {
- private static final String testPath = "data/fiveui/injected/prelude-test.html";
- private static final String testUrl = "http://localhost:8080/"+testPath;
-
- @ResultsUrl
- public static String url() {
- return testUrl;
- }
-} \ No newline at end of file
diff --git a/testrunner/src/test/java/com/galois/fiveui/jstests/RulesTest.java b/testrunner/src/test/java/com/galois/fiveui/jstests/RulesTest.java
deleted file mode 100644
index ff1c5fd..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/jstests/RulesTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Module : RulesTest.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.jstests;
-
-
-import org.junit.runner.RunWith;
-
-import com.galois.fiveui.testrunner.JSRunner;
-import com.galois.fiveui.testrunner.ResultsUrl;
-
-/**
- * @author creswick
- *
- */
-@RunWith(JSRunner.class)
-public class RulesTest {
- private static final String testPath = "data/fiveui/rules-test.html";
- private static final String testUrl = "http://localhost:8080/"+testPath;
-
- @ResultsUrl
- public static String url() {
- return testUrl;
- }
-} \ No newline at end of file
diff --git a/testrunner/src/test/java/com/galois/fiveui/jstests/SettingsTest.java b/testrunner/src/test/java/com/galois/fiveui/jstests/SettingsTest.java
deleted file mode 100644
index 3717cf8..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/jstests/SettingsTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Module : SettingsTest.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.jstests;
-
-
-import org.junit.runner.RunWith;
-
-import com.galois.fiveui.testrunner.JSRunner;
-import com.galois.fiveui.testrunner.ResultsUrl;
-
-/**
- * @author creswick
- *
- */
-@RunWith(JSRunner.class)
-public class SettingsTest {
- private static final String testPath = "data/fiveui/settings-test.html";
- private static final String testUrl = "http://localhost:8080/"+testPath;
-
- @ResultsUrl
- public static String url() {
- return testUrl;
- }
-} \ No newline at end of file
diff --git a/testrunner/src/test/java/com/galois/fiveui/jstests/StateTest.java b/testrunner/src/test/java/com/galois/fiveui/jstests/StateTest.java
deleted file mode 100644
index d84fa34..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/jstests/StateTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Module : StateTest.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.jstests;
-
-
-import org.junit.runner.RunWith;
-
-import com.galois.fiveui.testrunner.JSRunner;
-import com.galois.fiveui.testrunner.ResultsUrl;
-
-/**
- * @author creswick
- *
- */
-@RunWith(JSRunner.class)
-public class StateTest {
- private static final String testPath = "data/fiveui/state-test.html";
- private static final String testUrl = "http://localhost:8080/"+testPath;
-
- @ResultsUrl
- public static String url() {
- return testUrl;
- }
-} \ No newline at end of file
diff --git a/testrunner/src/test/java/com/galois/fiveui/testrunner/JSRunner.java b/testrunner/src/test/java/com/galois/fiveui/testrunner/JSRunner.java
deleted file mode 100644
index 56f2f8f..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/testrunner/JSRunner.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- * Module : JSRunner.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.testrunner;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.AssertionFailedError;
-
-import org.junit.runner.Description;
-import org.junit.runner.Runner;
-import org.junit.runner.notification.Failure;
-import org.junit.runner.notification.RunNotifier;
-import org.openqa.selenium.JavascriptExecutor;
-import org.openqa.selenium.WebDriver;
-
-import com.galois.fiveui.drivers.Drivers;
-import com.google.common.collect.ImmutableMap;
-
-/**
- * @author creswick
- *
- */
-public class JSRunner extends Runner {
-
- private FileServer _server;
- private List<JSTestResult> _results = new ArrayList<JSTestResult>();
-
- @SuppressWarnings("rawtypes")
- private Class _clazz;
-
- public JSRunner(@SuppressWarnings("rawtypes") Class testClass) {
- super();
- _clazz = testClass;
-
- try {
- // set up a file server to serve from the parent directory:
- _server = new FileServer("../contexts/");
- _server.start();
-
- gatherResults(getUrl(_clazz));
-
-
- } catch (Exception e) {
- scream("Unhandled catch in JSRunner constructor");
- e.printStackTrace();
- } finally {
- try {
- _server.stop();
- } catch (Exception e) {
- System.err.println("Exception while stopping server: ");
- e.printStackTrace();
- }
- }
- }
-
- private String getUrl(@SuppressWarnings("rawtypes") Class clazz) {
- for (Method m : clazz.getMethods() ){
- ResultsUrl ann = m.getAnnotation(ResultsUrl.class);
- if (null != ann) {
- try {
- return (String) m.invoke(clazz);
- } catch (Exception e) {
- System.err.println("Exception accessing url via annotation");
- }
- }
- }
-
- return null;
- }
-
- private void gatherResults(String testUrl) {
- ImmutableMap<String, WebDriver> drivers = ImmutableMap.of(
-// "Chrome", (WebDriver)Drivers.buildChromeDriver(),
- "FireFox", (WebDriver)Drivers.buildFFDriver());
-
- for (String key : drivers.keySet()) {
- runDriver(drivers.get(key), key, testUrl);
- }
- }
-
- private void runDriver(WebDriver driver, String driverName, String testUrl) {
- driver.get(testUrl);
- JavascriptExecutor exe = (JavascriptExecutor) driver;
-
- String jsCommands = "return document.report;";
-
- Object rawRes = exe.executeScript(jsCommands);
-
- @SuppressWarnings({ "unchecked", "rawtypes" })
- List<Map<String, Object>> rawResults = (List) rawRes;
-
- for (Map<String, Object> obj : rawResults) {
-
- PassFail passFail = PassFail.valueOf((String)obj.get("result"));
- String name = driverName + ": " + (String)obj.get("name");
- String details = "";
-
- if (obj.containsKey("err")) {
- details = obj.get("err").toString();
- }
- Description desc = Description.createTestDescription(_clazz, name);
- _results.add(new JSTestResult(desc, passFail, details));
- }
-
- driver.quit();
- }
-
- @Override
- public Description getDescription() {
-
- Description topDesc = Description.createSuiteDescription("JavaScript tests");
-
- for (JSTestResult res : _results) {
- topDesc.addChild(res.getDescription());
- }
- scream("retrieved description. length="+topDesc.testCount());
-
- return topDesc;
- }
-
- @Override
- public void run(RunNotifier notifier) {
- for (JSTestResult res : _results) {
- notifier.fireTestStarted(res.getDescription());
- switch (res.getPassFail()) {
- case PASSED:
- // scream("passed result is firing");
- notifier.fireTestFinished(res.getDescription());
- break;
-
- case FAILED:
- // scream("FAILED RESULT IS FIRING");
- notifier.fireTestFailure(new Failure(res.getDescription(),
- new AssertionFailedError(res.getDetails())));
- break;
-
- default:
- System.err.println("unexpeted PassFail value: "+res.getPassFail());
- break;
- }
- }
- }
-
- private void scream(String string) {
- System.out.println("=================================");
- System.out.println("");
- System.out.println("");
- System.out.println(" "+string);
- System.out.println("");
- System.out.println("");
- System.out.println("=================================");
- }
-}
diff --git a/testrunner/src/test/java/com/galois/fiveui/testrunner/JSTestResult.java b/testrunner/src/test/java/com/galois/fiveui/testrunner/JSTestResult.java
deleted file mode 100644
index 251d135..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/testrunner/JSTestResult.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * Module : JSTestResult.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.testrunner;
-
-import org.junit.runner.Description;
-
-/**
- * @author creswick
- *
- */
-public class JSTestResult {
-
- private final Description _name;
- private final PassFail _passFail;
- private final String _details;
-
- public JSTestResult(Description name, PassFail passFail, String details) {
- _name = name;
- _passFail = passFail;
- _details = details;
- }
-
- public Description getDescription() {
- return _name;
- }
-
- public PassFail getPassFail() {
- return _passFail;
- }
-
- public String getDetails() {
- return _details;
- }
-}
diff --git a/testrunner/src/test/java/com/galois/fiveui/testrunner/PassFail.java b/testrunner/src/test/java/com/galois/fiveui/testrunner/PassFail.java
deleted file mode 100644
index effc530..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/testrunner/PassFail.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/**
- * Module : PassFail.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.testrunner;
-
-public enum PassFail {
- PASSED,
- FAILED
-}
diff --git a/testrunner/src/test/java/com/galois/fiveui/testrunner/ResultsUrl.java b/testrunner/src/test/java/com/galois/fiveui/testrunner/ResultsUrl.java
deleted file mode 100644
index 30176e3..0000000
--- a/testrunner/src/test/java/com/galois/fiveui/testrunner/ResultsUrl.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * Module : ResultsUrl.java
- * Copyright : (c) 2011-2012, Galois, Inc.
- *
- * Maintainer :
- * Stability : Provisional
- * Portability: Portable
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.galois.fiveui.testrunner;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-
-/**
- * ResultsUrl must annotate a static method that returns a string.
- * @author creswick
- *
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
-public @interface ResultsUrl {
-}