arminw
Sun, 27 Jan 2008 18:24:05 -0800
Author: arminw Date: Sun Jan 27 18:23:44 2008 New Revision: 615716 URL: http://svn.apache.org/viewvc?rev=615716&view=rev Log: improve the ojb-blank tasks, add tasks to build and run a complex example Modified: db/ojb/branches/OJB_1_0_RELEASE/src/ojb-blank/build.properties db/ojb/branches/OJB_1_0_RELEASE/src/ojb-blank/build.xml Modified: db/ojb/branches/OJB_1_0_RELEASE/src/ojb-blank/build.properties URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/ojb-blank/build.properties?rev=615716&r1=615715&r2=615716&view=diff ============================================================================== --- db/ojb/branches/OJB_1_0_RELEASE/src/ojb-blank/build.properties (original) +++ db/ojb/branches/OJB_1_0_RELEASE/src/ojb-blank/build.properties Sun Jan 27 18:23:44 2008 @@ -23,7 +23,7 @@ # rather than to a generic HSQLDB instance. # jcdAlias=default -databaseName=ojb_blank +databaseName=ojb databaseUser=sa databasePassword= @@ -34,11 +34,12 @@ urlProtocol=jdbc urlSubprotocol=hsqldb urlDbalias=database/${databaseName} +ddlutils.shutdownDatabase = true # For MySQL this would look like: #dbmsName=MySQL #jdbcLevel=3.0 -#jdbcRuntimeDriver=com.mysql.jdbc.Driver +#jdbcRuntimeDriver=org.gjt.mm.mysql.Driver #urlProtocol=jdbc #urlSubprotocol=mysql #urlDbalias=//localhost/${databaseName} @@ -55,6 +56,7 @@ # For Hsqldb we have to mangle the path so that we can invoke Torque in the base # directory but the database is created in the ${build.dir}/database folder torque.database.createUrl=${urlProtocol}:${urlSubprotocol}:${build.dir}/database/${databaseName} +#torque.database.createUrl=${urlProtocol}:${urlSubprotocol}:${urlDbalias} # This specifies the url that Torque uses to access the existing database # Modified: db/ojb/branches/OJB_1_0_RELEASE/src/ojb-blank/build.xml URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/ojb-blank/build.xml?rev=615716&r1=615715&r2=615716&view=diff ============================================================================== --- db/ojb/branches/OJB_1_0_RELEASE/src/ojb-blank/build.xml (original) +++ db/ojb/branches/OJB_1_0_RELEASE/src/ojb-blank/build.xml Sun Jan 27 18:23:44 2008 @@ -70,7 +70,7 @@ <tstamp/> <mkdir dir="${build.dir}"/> <mkdir dir="${build.dir}/classes"/> - <javac srcdir="${source.java.dir}" destdir="${build.dir}/classes"> + <javac debug="true" srcdir="${source.java.dir}" destdir="${build.dir}/classes"> <classpath refid="compile-classpath"/> </javac> </target> @@ -154,9 +154,9 @@ <!-- ================================================================== --> <!-- Sets the database up using the generated project schema --> <!-- ================================================================== --> - <target name="setup-db" depends="xdoclet"> + <target name="setup-db-torque" depends="xdoclet"> <property name="torque.buildFile" - value="${source.schema.dir}/build-torque.xml"/> + value="build-torque.xml"/> <property name="torque.project" value="${databaseName}"/> <property name="torque.schema.dir" @@ -197,7 +197,28 @@ target="insert-sql"> </ant> </target> - + + <!-- ================================================================== --> + <!-- Sets the database up using the generated project schema --> + <!-- ================================================================== --> + <target name="setup-db" depends="xdoclet"> + + <ant dir="." + antfile="build-ddlutils.xml" + target="create-db" inheritrefs="true"> + <reference refid="compile-build-classpath" torefid="runtime-classpath"/> + <property name="project.name" value="${databaseName}"/> + <property name="schema.src.dir" value="${source.schema.dir}"/> + <property name="target.dir" value="${build.dir}/database"/> + <property name="schema.target.dir" value="${build.dir}/database"/> + <property name="database.driver" value="${jdbcRuntimeDriver}"/> + <property name="database.url" value="${torque.database.createUrl}"/> + <property name="database.user" value="${databaseUser}"/> + <property name="database.password" value="${databasePassword}"/> + <property name="ojb.properties.file" value="${build.dir}"/> + </ant> + </target> + <!-- ================================================================== --> <!-- Cleans the project --> <!-- ================================================================== --> @@ -240,5 +261,37 @@ <arg line="-v -f -d ${build.dir}/classes ${source.java.dir}/org/apache/ojb/tutorial5/Product.jdo ${build.dir}/classes/org/apache/ojb/tutorial5/Product.class"/> </java> </target> -</project> + <!-- ======================================================================== --> + <!-- Build and Run the SampleTest class (an example for OJB's xdoclet module) --> + <!-- ======================================================================== --> + <target name="sample-build" depends=""> + <property name="source.main.class" value="org.apache.ojb.sample.SampleTest"/> + <copy todir="${source.java.dir}" overwrite="false"> + <fileset dir="${basedir}/src/sample/java"> + <include name="**/*.java"/> + </fileset> + </copy> + <echo message="* Build sample project files *"/> + <sleep seconds="1"/> + <antcall target="build" inheritrefs="true"> + <reference refid="compile-build-classpath" torefid="runtime-classpath"/> + </antcall> + <echo message="* Setup database for sample project *"/> + <sleep seconds="1"/> + <antcall target="setup-db" inheritrefs="true"> + <reference refid="compile-build-classpath" torefid="runtime-classpath"/> + </antcall> + </target> + + <target name="sample-run" depends=""> + <property name="source.main.class" value="org.apache.ojb.sample.SampleTest"/> + <echo message="* Run JUnit test for sample project: ${source.main.class} *"/> + <sleep seconds="1"/> + <java dir="${build.dir}" + classname="${source.main.class}" + fork="true" + failonerror="true" classpathref="compile-build-classpath" + /> + </target> +</project> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]