From 8dd8d9ab9e672928bcd4984a19e858aaca370dc4 Mon Sep 17 00:00:00 2001 From: cbonar Date: Mon, 22 Sep 2008 22:24:42 +0000 Subject: [PATCH] + a lot of work on the ant task --- .../net/jsunit/ant/JsUnitBatchTestTask.java | 265 ------------- .../main/java/net/jsunit/ant/JsUnitTask.java | 366 ++++++++++++++++++ .../net/jsunit/ant/JsUnitTestLibResource.java | 36 ++ .../java/net/jsunit/ant/JsUnitTestTask.java | 102 ----- 4 files changed, 402 insertions(+), 367 deletions(-) delete mode 100644 ant-jsunit-hieatt/trunk/src/main/java/net/jsunit/ant/JsUnitBatchTestTask.java create mode 100644 ant-jsunit-hieatt/trunk/src/main/java/net/jsunit/ant/JsUnitTask.java create mode 100644 ant-jsunit-hieatt/trunk/src/main/java/net/jsunit/ant/JsUnitTestLibResource.java delete mode 100644 ant-jsunit-hieatt/trunk/src/main/java/net/jsunit/ant/JsUnitTestTask.java diff --git a/ant-jsunit-hieatt/trunk/src/main/java/net/jsunit/ant/JsUnitBatchTestTask.java b/ant-jsunit-hieatt/trunk/src/main/java/net/jsunit/ant/JsUnitBatchTestTask.java deleted file mode 100644 index 2071817..0000000 --- a/ant-jsunit-hieatt/trunk/src/main/java/net/jsunit/ant/JsUnitBatchTestTask.java +++ /dev/null @@ -1,265 +0,0 @@ -package net.jsunit.ant; - - -import java.io.File; -import java.util.Collection; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Map; -import java.util.Vector; - -import net.jsunit.StandaloneTest; -import net.jsunit.TestLibRunner; -import net.jsunit.TestLibRunnerConfigurationSource; - -import org.apache.tools.ant.DirectoryScanner; -import org.apache.tools.ant.taskdefs.optional.junit.JUnitTask; -import org.apache.tools.ant.types.FileSet; - - - -/** - * This task permits convenient access to the {@link TestLibRunner} unit test. - * - * @author http://nicobo.net/contact?subject=jsunit+ant - */ -public class JsUnitBatchTestTask extends JUnitTask -{ - // PUBLIC CONSTANTS - - /** Name of the property pointing to the root directory of the JsUnit installation */ - public static final String PROP_JSUNITROOT = "jsunit.dir"; - /** @see TestLibRunnerConfigurationSource#PROP_COREJS */ - public static final String PROP_COREJS = TestLibRunnerConfigurationSource.PROP_COREJS; - /** @see TestLibRunner#PROP_TESTRUNNER */ - public static final String PROP_TESTRUNNER = "jsunit.testRunner"; - - // PRIVATE FIELDS - - /** Inner {@link JsUnitTestTask} elements */ - private Collection scriptsList = new Vector(); - - // PARAMETERS FROM THE BUILD SCRIPT / ENVIRONMENT - - private boolean runTests = true; - private boolean keepTestPage = false; - private String jsUnitRoot; - private String coreJs; - private String testRunner; - - - - // - // INITIALISATION - // - - public JsUnitBatchTestTask() throws Exception - { - super(); - } - - - - protected Collection getScriptsList() - { - return scriptsList; - } - - - - protected void setScriptsList( Collection scriptsList ) - { - this.scriptsList = scriptsList; - } - - - - // - // ANT Task IMPLEMENTATION - // - - public void addConfiguredTest( JsUnitTestTask anInner ) - { - // Simply saves the gathered inner elements - getScriptsList().add( anInner ); - } - - - - public String getJsUnitRoot() - { - return jsUnitRoot; - } - - - - public void setJsUnitRoot( String jsUnitRoot ) - { - this.jsUnitRoot = jsUnitRoot; - } - - - - public boolean isKeepTestPage() - { - return keepTestPage; - } - - - - public void setKeepTestPage( boolean keepTestPage ) - { - this.keepTestPage = keepTestPage; - } - - - - public boolean isRunTests() - { - return runTests; - } - - - - public void setRunTests( boolean runTests ) - { - this.runTests = runTests; - } - - - - public String getCoreJs() - { - return coreJs; - } - - - - public void setCoreJs( String coreJs ) - { - this.coreJs = coreJs; - } - - - - public String getTestRunner() - { - return testRunner; - } - - - - public void setTestRunner( String testRunner ) - { - this.testRunner = testRunner; - } - - - - public void execute() - { - // A list of the URI of the files to include mapped to their type as key - Map scriptsFiles = new Hashtable(); - - if ( getScriptsList() == null || getScriptsList().size() == 0 ) - { - throw new IllegalArgumentException( "No