Author: markt
Date: Sat May  2 23:12:17 2009
New Revision: 770999

URL: http://svn.apache.org/viewvc?rev=770999&view=rev
Log:
Changes as a result of https://issues.apache.org/bugzilla/show_bug.cgi?id=47124
Add JUnit to build
Provide TestSuite to run all tests

Added:
    tomcat/trunk/test/org/apache/TestAll.java   (with props)
Modified:
    tomcat/trunk/build.properties.default
    tomcat/trunk/test/build.xml

Modified: tomcat/trunk/build.properties.default
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/build.properties.default?rev=770999&r1=770998&r2=770999&view=diff
==============================================================================
--- tomcat/trunk/build.properties.default (original)
+++ tomcat/trunk/build.properties.default Sat May  2 23:12:17 2009
@@ -109,3 +109,8 @@
 
dojo-js.loc=http://download.dojotoolkit.org/release-1.1.1/dojo-release-1.1.1.tar.gz
 dojo-js.jar=${dojo-js.home}/dojo/dojo.js
 
+# ----- JUnit Unit Test Suite, version 3.7 or later -----
+junit.home=${base.path}/junit3.8.2
+junit.lib=${junit.home}
+junit.jar=${junit.lib}/junit.jar
+junit.loc=${base-sf.loc}/junit/junit3.8.2.zip

Modified: tomcat/trunk/test/build.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/build.xml?rev=770999&r1=770998&r2=770999&view=diff
==============================================================================
--- tomcat/trunk/test/build.xml (original)
+++ tomcat/trunk/test/build.xml Sat May  2 23:12:17 2009
@@ -20,51 +20,79 @@
   <!-- See "build.properties.sample" in the top level directory for all     -->
   <!-- property values you must customize for successful building!!!        -->
   <property file="${user.home}/build.properties"/>
-  <property file="build.properties"/>
+  <property file="../build.properties"/>
 
-  <property file="build.properties.default"/>
+  <property file="../build.properties.default"/>
 
   <property name="test.classes" value="${basedir}/output/classes"/>
-  <property name="tomcat.build" value="${basedir}/../output/build"/>
+  <property name="tomcat.classes" value="${basedir}/../output/classes"/>
 
   <property name="compile.source" value="1.5"/>
   <property name="compile.debug" value="true"/>
 
-  <property name="junit.jar" value="${junit.home}/junit.jar"/>
   <property name="test.runner" value="junit.textui.TestRunner"/>
 
   <path id="tomcat.test.classpath">
     <pathelement location="${test.classes}"/>
+    <pathelement location="${tomcat.classes}"/>
     <pathelement location="${junit.jar}"/>
-    <fileset dir="${tomcat.build}/lib/">
-      <include name="tomcat-coyote.jar"/>
-    </fileset>
-    <fileset dir="${tomcat.build}/bin/">
-      <include name="tomcat-juli.jar"/>
-    </fileset>
   </path>
 
-  <target name="compile">
-
-  <mkdir dir="${test.classes}"/>
-
-  <!-- Compile -->
-  <javac srcdir="." destdir="${test.classes}"
-         debug="${compile.debug}"
-         deprecation="${compile.deprecation}"
-         source="${compile.source}"
-         optimize="${compile.optimize}">
-         <classpath refid="tomcat.test.classpath" />
-         <include name="org/apache/catalina/tomcat/util/**" />
-  </javac>
-
+  <target name="compile" depends="download" >
+    <mkdir dir="${test.classes}"/>
+    <!-- Compile -->
+    <javac srcdir="." destdir="${test.classes}"
+           debug="${compile.debug}"
+           deprecation="${compile.deprecation}"
+           source="${compile.source}"
+           optimize="${compile.optimize}">
+      <classpath refid="tomcat.test.classpath" />
+      <include name="org/apache/**" />
+    </javac>
   </target>
 
   <target name="all" depends="compile">
-     <java dir="${test.classes}" classname="${test.runner}" fork="yes" 
failonerror="${test.failonerror}">
-            <arg value="org.apache.catalina.tomcat.util.http.TestCookies"/>
-            <classpath refid="tomcat.test.classpath"/>
-        </java>
+    <java dir="${test.classes}" classname="${test.runner}" fork="yes"
+          failonerror="${test.failonerror}">
+      <arg value="org.apache.TestAll"/>
+      <classpath refid="tomcat.test.classpath"/>
+    </java>
+  </target>
+       
+  <target name="download" >
+       <antcall target="downloadzip">
+      <param name="sourcefile" value="${junit.loc}"/>
+      <param name="destfile" value="${junit.jar}"/>
+      <param name="destdir" value="${base.path}"/>
+       </antcall>
+  </target>
+       
+  <target name="downloadzip" unless="exist" depends="setproxy,testexist">
+    <!-- Download and extract the package -->
+    <get src="${sourcefile}" dest="${base.path}/file.zip" />
+    <mkdir dir="${destdir}" />
+    <unzip src="${base.path}/file.zip" dest="${destdir}"/>
+    <delete file="${base.path}/file.zip"/>
+  </target>
+       
+  <target name="proxyflags">
+    <!-- check proxy parameters. -->
+    <condition property="useproxy">
+      <equals arg1="${proxy.use}" arg2="on" />
+    </condition>
+  </target>
 
+  <target name="setproxy" depends="proxyflags" if="useproxy">
+    <taskdef name="setproxy"
+            classname="org.apache.tools.ant.taskdefs.optional.net.SetProxy" />
+    <setproxy proxyhost="${proxy.host}" proxyport="${proxy.port}"
+              proxyuser="${proxy.user}" proxypassword="${proxy.password}" />
+    <echo message="Using ${proxy.host}:${proxy.port} to download 
${sourcefile}"/>
   </target>
+
+  <target name="testexist">
+    <echo message="Testing  for ${destfile}"/>
+    <available file="${destfile}" property="exist"/>
+  </target>
+
 </project>

Added: tomcat/trunk/test/org/apache/TestAll.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/TestAll.java?rev=770999&view=auto
==============================================================================
--- tomcat/trunk/test/org/apache/TestAll.java (added)
+++ tomcat/trunk/test/org/apache/TestAll.java Sat May  2 23:12:17 2009
@@ -0,0 +1,35 @@
+package org.apache;
+
+import org.apache.catalina.ha.session.TestSerializablePrincipal;
+import org.apache.catalina.startup.TomcatStartupAPITest;
+import org.apache.catalina.tomcat.util.http.TestCookies;
+import org.apache.catalina.tribes.test.TribesTestSuite;
+import org.apache.el.lang.TestELSupport;
+import org.apache.el.parser.TestELParser;
+import org.apache.tomcat.util.res.TestStringManager;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class TestAll {
+
+    public static Test suite() {
+        TestSuite suite = new TestSuite("Test for org.apache");
+        // o.a.catalina.ha.session
+        suite.addTestSuite(TestSerializablePrincipal.class); // TODO rename
+        // o.a.catalina.startup
+        suite.addTestSuite(TomcatStartupAPITest.class);
+        // o.a.catalina.tomcat.util.http - TODO fix package
+        suite.addTestSuite(TestCookies.class); // TODO rename
+        // Tribes
+        // suite.addTest(TribesTestSuite.suite());
+        // o.a.el
+        suite.addTestSuite(TestELSupport.class);
+        suite.addTestSuite(TestELParser.class);
+        // o.a.tomcat.util
+        suite.addTestSuite(TestStringManager.class);
+        
+        return suite;
+    }
+
+}

Propchange: tomcat/trunk/test/org/apache/TestAll.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tomcat/trunk/test/org/apache/TestAll.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to