You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@roller.apache.org by ag...@apache.org on 2007/02/17 00:22:41 UTC

svn commit: r508652 - /incubator/roller/trunk/build.xml

Author: agilliland
Date: Fri Feb 16 15:22:40 2007
New Revision: 508652

URL: http://svn.apache.org/viewvc?view=rev&rev=508652
Log:
make unit tests init db based on the scripts in build/dbscripts


Modified:
    incubator/roller/trunk/build.xml

Modified: incubator/roller/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/roller/trunk/build.xml?view=diff&rev=508652&r1=508651&r2=508652
==============================================================================
--- incubator/roller/trunk/build.xml (original)
+++ incubator/roller/trunk/build.xml Fri Feb 16 15:22:40 2007
@@ -494,6 +494,9 @@
             outputDirectory="${build.dbscripts}" 
             outputFile="README.txt" />
             
+        <!-- just copy over the droptables script -->
+        <copy todir="${build.dbscripts}" file="${basedir}/metadata/database/droptables.sql" />
+        
     </target>
 
 
@@ -836,7 +839,7 @@
 </target>
 
 
-<target name="build-tests" depends="build-web" description="Build unit tests">
+<target name="build-tests" depends="build-web, gen-dbscripts" description="Build unit tests">
     
     <mkdir dir="${build.tests}" />
     <mkdir dir="${build.tests}/logs" />
@@ -1131,64 +1134,46 @@
     </javac>
 </target>
 	    
-<!-- ********************************************************************* -->
-<!-- HSQLDB start, init and stop targets -->
-<!-- ********************************************************************* -->
 
-<target name="init-db" description=
-    "Initializes built-in database by running drop table and create table">
-    &custom-post-dbtest;
-    <sql driver="${test.db.driver}"
-         url="${test.db.url}"
-         userid="${test.db.username}" 
-         password="${test.db.password}"
-         src="${build.webapp}/WEB-INF/dbscripts/droptables.sql" 
-         onerror="continue"
-         classpath="${test.db.cpath}" />    
-    <sql driver="${test.db.driver}"
-         url="${test.db.url}"
-         userid="${test.db.username}" 
-         password="${test.db.password}"
-         src="${build.webapp}/WEB-INF/dbscripts/${test.db.name}/createdb.sql"
-         onerror="continue"
-         classpath="${test.db.cpath}" /> 
-    &custom-pre-dbtest;
-</target>
-
-<target name="start-db" description="Starts built-in database">  
-    <taskdef name="startdb" classname="org.apache.roller.ant.StartDerbyTask" 
-        classpath="${ro.tools}/buildtime/derby.jar;${ro.tools}/buildtime/derbynet.jar;${build.compile.tests}" />
-    <startdb database="${build.tests}/derby-system/roller" port="3219" />
-    <!-- 
-    <delete dir="${build.tests}/derby-system/roller" />
-    Not sure we need that custom 'startdb' task if this plain old Ant works:
-    <java classname="org.hsqldb.Server"  
-        fork="yes" spawn="true" classpath="./tools/buildtime/hsqldb.jar">
-        <arg value="-database"/>
-        <arg value="${build.tests}/testdb"/>
-        <arg value="-port"/>
-        <arg value="3219"/>
-    </java>
-    -->    
-</target>
+    <!-- *********************************************************** -->
+    <!-- Test db start, init and stop targets -->
+    <!-- *********************************************************** -->
+
+    <target name="init-db" description=
+            "Initializes built-in database by running drop table and create table">
+        
+        &custom-post-dbtest;
+        
+        <sql driver="${test.db.driver}"
+             url="${test.db.url}"
+             userid="${test.db.username}" 
+             password="${test.db.password}"
+             src="${build.dbscripts}/droptables.sql" 
+             onerror="continue"
+             classpath="${test.db.cpath}" />  
+        
+        <sql driver="${test.db.driver}"
+             url="${test.db.url}"
+             userid="${test.db.username}" 
+             password="${test.db.password}"
+             src="${build.dbscripts}/${test.db.name}/createdb.sql"
+             onerror="continue"
+             classpath="${test.db.cpath}" /> 
         
-<target name="stop-db" description="Drop tables and stops the built-in database">   
-    <taskdef name="stopdb" classname="org.apache.roller.ant.StopDerbyTask" 
-        classpath="${ro.tools}/buildtime/derby.jar;${ro.tools}/buildtime/derbynet.jar;${build.compile.tests}" />
-    <stopdb port="3219"/>
-    <!--
-    <delete dir="${build.tests}/derby-system/roller" />
-    This below code does the same thing as 'stopdb' but the 'sql' task throws 
-    an exception when HSQLDB disconnects and that causes a build failure, so 
-    for now I'm keeping the custom 'startdb' and 'stopdb' Ant tasks.
-    <sql driver="org.hsqldb.jdbcDriver" onerror="continue" 
-         url="jdbc:hsqldb:hsql://localhost:3219"
-         userid="sa" password=""
-         classpath="${ro.tools}/buildtime/hsqldb.jar" >
-         SHUTDOWN
-    </sql>  
-    -->
-</target>
+        &custom-pre-dbtest;
+    </target>
+
+    <target name="start-db" description="Starts built-in database">  
+        <taskdef name="startdb" classname="org.apache.roller.ant.StartDerbyTask" 
+                 classpath="${ro.tools}/buildtime/derby.jar;${ro.tools}/buildtime/derbynet.jar;${build.compile.tests}" />
+        <startdb database="${build.tests}/derby-system/roller" port="3219" />
+    </target>
+    
+    <target name="stop-db" description="Stops the built-in database">   
+        <taskdef name="stopdb" classname="org.apache.roller.ant.StopDerbyTask" 
+                 classpath="${ro.tools}/buildtime/derby.jar;${ro.tools}/buildtime/derbynet.jar;${build.compile.tests}" />
+        <stopdb port="3219"/>
+    </target>
 
 <!-- ********************************************************************* -->
 <!-- Experimental Admin API SDK -->