You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/05/06 17:06:22 UTC

svn commit: r168615 - in /incubator/beehive/trunk/samples/petstoreWeb: ./ test-src/ test-src/org/ test/ test/lib/ test/src/

Author: ekoneil
Date: Fri May  6 08:06:21 2005
New Revision: 168615

URL: http://svn.apache.org/viewcvs?rev=168615&view=rev
Log:
Remove the petstoreWeb-test directory and move the HTTPUnit tests into samples/petstoreWeb/test.

Add test.build, test.clean, and test.run targets to the samples/petstoreWeb/build*.xml files to support building and running the tests against a deployed petstoreWeb.  Update the README.

BB: self
DRT: none
Test: tests build; petstore builds.  both in the distribution and in SVN.


Added:
    incubator/beehive/trunk/samples/petstoreWeb/test-src/
      - copied from r168443, incubator/beehive/trunk/samples/petstoreWeb-test/src/
    incubator/beehive/trunk/samples/petstoreWeb/test-src/org/
      - copied from r168610, incubator/beehive/trunk/samples/petstoreWeb-test/src/org/
Removed:
    incubator/beehive/trunk/samples/petstoreWeb-test/README
    incubator/beehive/trunk/samples/petstoreWeb-test/build.xml
    incubator/beehive/trunk/samples/petstoreWeb-test/lib/
    incubator/beehive/trunk/samples/petstoreWeb-test/src/
Modified:
    incubator/beehive/trunk/samples/petstoreWeb/README
    incubator/beehive/trunk/samples/petstoreWeb/build-dist.properties
    incubator/beehive/trunk/samples/petstoreWeb/build-dist.xml
    incubator/beehive/trunk/samples/petstoreWeb/build.properties
    incubator/beehive/trunk/samples/petstoreWeb/build.xml

Modified: incubator/beehive/trunk/samples/petstoreWeb/README
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/README?rev=168615&r1=168614&r2=168615&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/README (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/README Fri May  6 08:06:21 2005
@@ -7,7 +7,7 @@
   - Java 5
   - Ant 1.6.2
   - Servlet or J2EE Container
-  - The Apache Derby 10.0.x JAR
+  - Apache Derby 10.0.x JAR
 
 Installing Dependencies
 =======================
@@ -43,7 +43,7 @@
 Modify petstoreWeb/src/org/apache/beehive/samples/petstore/controls/data/DBProperties.java
 in the petstoreWeb to set the location for the Derby petstore database. By default, 
 this location is: "d:/Apache/Derby/petDB". Most users will need to change this.
-	
+
 Building
 ========
 The samples/petstoreWeb is structured as:
@@ -102,4 +102,28 @@
 
 Check the Beehive Wiki or your application container's documentation for information about
 deploying to other application containers.
+
+Testing
+=======
+The petstore webapp includes a set of HTTPUnit tests that can be used to verify 
+the webapp works during development.  These tests require HTTPUnit 1.6 which can be
+downloaded from:
+
+  http://httpunit.sourceforge.net/
+
+Once HTTPUnit has been downloaded, set the "httpunit.dir" property in build.properties
+so that the JARs can be located by the build file.
+
+To build the tests, run:
+
+  $> ant test.build
+
+To run the tests, deploy the petstore webapp and run:
+
+  $> ant test.run
+
+To clean the tests, run:
+
+  $> ant test.clean
+
 

Modified: incubator/beehive/trunk/samples/petstoreWeb/build-dist.properties
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/build-dist.properties?rev=168615&r1=168614&r2=168615&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/build-dist.properties (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/build-dist.properties Fri May  6 08:06:21 2005
@@ -3,7 +3,11 @@
 #
 beehive.home=../../
 
+context.path=petstoreWeb
+
 servlet-api.jar=${os.CATALINA_HOME}/common/lib/servlet-api.jar
 jsp-api.jar=${os.CATALINA_HOME}/common/lib/jsp-api.jar
 
-context.path=petstoreWeb
\ No newline at end of file
+# Set this path in order to run HTTPUnit tests against the webapp
+httpunit.dir=/fixme/to/run/tests
+

Modified: incubator/beehive/trunk/samples/petstoreWeb/build-dist.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/build-dist.xml?rev=168615&r1=168614&r2=168615&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/build-dist.xml (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/build-dist.xml Fri May  6 08:06:21 2005
@@ -32,10 +32,9 @@
     <property name="web.dir" location="web"/>
     <property name="src.dir" location="src"/>
   
-    <!-- ========================================= -->
-    <!-- build - build the webapp                  -->
-    <!-- ========================================= -->
-
+    <property name="testclasses.dir" location="classes/test"/>
+    <property name="testsrc.dir" location="test-src"/>
+  
     <path id="webapp.classpath">
         <pathelement location="${jsp-api.jar}"/>
         <pathelement location="${servlet-api.jar}"/>
@@ -45,6 +44,16 @@
         <pathelement location="${build.dir}/WEB-INF/classes"/>
     </path>    
 
+    <path id="webapptest.classpath">
+        <path refid="webapp.classpath"/>
+        <pathelement location="${testclasses.dir}"/>
+        <fileset dir="${httpunit.dir}/lib" includes="*.jar"/>
+    </path>    
+
+    <!-- ========================================= -->
+    <!-- build - build the webapp                  -->
+    <!-- ========================================= -->
+
     <target name="deploy-beehive" description="Copy the Beehive webapp rutime into the petstoreWeb webapp">
         <mkdir dir="${build.dir}"/>
 
@@ -54,6 +63,10 @@
         <deploy-wsm webappDir="${build.dir}"/>
     </target>
 
+    <!-- ========================================= -->
+    <!-- build - build the webapp                  -->
+    <!-- ========================================= -->
+
     <target name="build" description="Build the webapp">
         <copy todir="${build.dir}/">
             <fileset dir="${web.dir}">
@@ -101,6 +114,7 @@
 
     <target name="scrub" description="Scrub the webapp">
         <delete dir="${build.dir}"/>
+        <antcall target="test.clean"/>
     </target>
 
     <target name="clean" description="Clean the webapp">
@@ -120,6 +134,41 @@
             </fileset>
         </war>
     </target>
+
+    <!-- =========================================== -->
+    <!-- build / run HTTPUnit tests                  -->
+    <!-- =========================================== -->
+
+    <target name="test.build" depends="ensure.httpunit" description="Build the HTTPUnit tests for the petstore">
+        <mkdir dir="${testclasses.dir}"/>
+        <javac srcdir="${testsrc.dir}" 
+               destdir="${testclasses.dir}" 
+               classpathref="webapptest.classpath"/>
+    </target>
+
+    <target name="test.clean" description="Clean the HTTPUnit tests for the petstore">
+        <delete dir="${testclasses.dir}"/>
+    </target>
+
+    <target name="test.run" depends="ensure.httpunit" description="Run the HTTPUnit tests against the petstore">
+        <junit fork="yes" haltonfailure="yes" printsummary="yes">
+            <formatter type="plain" usefile="false"/>
+            <classpath>
+                <path refid="webapptest.classpath"/>
+            </classpath>
+            <test name="org.apache.beehive.samples.petstore.test.AllTests"/>
+        </junit>
+    </target>
+
+    <target name="ensure.httpunit">
+        <available file="${httpunit.dir}" type="dir" property="httpunit.present"/>
+        <fail unless="httpunit.present" 
+              message="Unable to locate HTTPUnit 1.6.  Please download HTTPUnit from http://httpunit.sourceforge.net"/>
+    </target>
+
+    <!-- =========================================== -->
+    <!-- utility targets                             -->
+    <!-- =========================================== -->
 
     <target name="usage" description="Print usage information for this build file">
         <echo>

Modified: incubator/beehive/trunk/samples/petstoreWeb/build.properties
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/build.properties?rev=168615&r1=168614&r2=168615&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/build.properties (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/build.properties Fri May  6 08:06:21 2005
@@ -3,3 +3,4 @@
 #
 context.path=petstoreWeb
 derby.jar=${beehive.home}/external/derby/derby_46005.jar
+httpunit.dir=/no/such/dir

Modified: incubator/beehive/trunk/samples/petstoreWeb/build.xml
URL: http://svn.apache.org/viewcvs/incubator/beehive/trunk/samples/petstoreWeb/build.xml?rev=168615&r1=168614&r2=168615&view=diff
==============================================================================
--- incubator/beehive/trunk/samples/petstoreWeb/build.xml (original)
+++ incubator/beehive/trunk/samples/petstoreWeb/build.xml Fri May  6 08:06:21 2005
@@ -32,19 +32,26 @@
     <property name="web.dir" location="web"/>
     <property name="src.dir" location="src"/>
     <property name="lib.dir" location="lib"/>
-  
-    <!-- ========================================= -->
-    <!-- build - build the webapp                  -->
-    <!-- ========================================= -->
 
+    <property name="testclasses.dir" location="classes/test"/>
+    <property name="testsrc.dir" location="test-src"/>
+  
     <path id="webapp.classpath">
         <path refid="servlet.dependency.path"/>
-        <fileset dir="${build.dir}/WEB-INF/lib">
-            <include name="*.jar"/>
-        </fileset>
+        <fileset dir="${build.dir}/WEB-INF/lib" includes="*.jar"/>
         <pathelement location="${build.dir}/WEB-INF/classes"/>
     </path>    
 
+    <path id="webapptest.classpath">
+        <path refid="webapp.classpath"/>
+        <pathelement location="${testclasses.dir}"/>
+        <fileset dir="${httpunit.dir}/lib" includes="*.jar"/>
+    </path>    
+
+    <!-- ========================================= -->
+    <!-- deploy the Beehive runtime JARs           -->
+    <!-- ========================================= -->
+
     <target name="deploy-beehive" description="Copy the Beehive webapp rutime into the petstoreWeb webapp">
         <mkdir dir="${build.dir}"/>
 
@@ -53,13 +60,16 @@
               message="Unable to locate ${derby.jar}.  Please download Derby from http://incubator.apache.org/derby/derby_downloads.html"/>
 
         <copy todir="${build.dir}/WEB-INF/lib" file="${derby.jar}"/>
-
         <copy todir="${build.dir}/WEB-INF/lib" file="${beehive.home}/controlhaus/jdbc/trunk/build/dist/jdbc-control.jar"/>
 
         <deploy-netui webappDir="${build.dir}"/>
         <deploy-wsm webappDir="${build.dir}"/>
     </target>
 
+    <!-- ========================================= -->
+    <!-- build - build the webapp                  -->
+    <!-- ========================================= -->
+
     <target name="build" description="Build the webapp">
         <copy todir="${build.dir}/">
             <fileset dir="${web.dir}">
@@ -107,6 +117,7 @@
 
     <target name="scrub" description="Scrub the webapp">
         <delete dir="${build.dir}"/>
+        <antcall target="test.clean"/>
     </target>
 
     <target name="clean" description="Clean the webapp">
@@ -132,6 +143,10 @@
         <redeploy-webapp contextPath="${context.path}"/>
     </target>
 
+    <!-- =========================================== -->
+    <!-- create a compressed WAR file for deployment -->
+    <!-- =========================================== -->
+
     <target name="war" description="Build a compressed WAR file that can be deployed to an application container">
         <property name="archive.dir" location="${basedir}"/>
 
@@ -142,6 +157,41 @@
             </fileset>
         </war>
     </target>
+
+    <!-- =========================================== -->
+    <!-- build / run HTTPUnit tests                  -->
+    <!-- =========================================== -->
+
+    <target name="test.build" depends="ensure.httpunit" description="Build the HTTPUnit tests for the petstore">
+        <mkdir dir="${testclasses.dir}"/>
+        <javac srcdir="${testsrc.dir}" 
+               destdir="${testclasses.dir}" 
+               classpathref="webapptest.classpath"/>
+    </target>
+
+    <target name="test.clean" description="Clean the HTTPUnit tests for the petstore">
+        <delete dir="${testclasses.dir}"/>
+    </target>
+
+    <target name="test.run" depends="ensure.httpunit" description="Run the HTTPUnit tests against the petstore">
+        <junit fork="yes" haltonfailure="yes" printsummary="yes">
+            <formatter type="plain" usefile="false"/>
+            <classpath>
+                <path refid="webapptest.classpath"/>
+            </classpath>
+            <test name="org.apache.beehive.samples.petstore.test.AllTests"/>
+        </junit>
+    </target>
+
+    <target name="ensure.httpunit">
+        <available file="${httpunit.dir}" type="dir" property="httpunit.present"/>
+        <fail unless="httpunit.present" 
+              message="Unable to locate HTTPUnit 1.6.  Please download HTTPUnit from http://httpunit.sourceforge.net"/>
+    </target>
+
+    <!-- =========================================== -->
+    <!-- utility targets                             -->
+    <!-- =========================================== -->
 
     <target name="usage" description="Print usage information for this build file">
         <echo>