#set ( $dbName = ${database.getName()} )
<?xml version="1.0"?>
<project name="dbunit" default="export_all">

	<property name="src.test.dir" value="./src/test"/>
	<property name="${dbName}.dbunit.properties" value="./${dbName}.dbunit.properties"/>

	<property file="${${dbName}.dbunit.properties}"/>
	
	<path id="dbunit-classpath">
		<fileset dir="${dbunit.lib.dir}">
			<include name="**/*.jar"/>
		</fileset>
	</path>

	<taskdef name="dbunit"
			classpathref="dbunit-classpath"
			classname="org.dbunit.ant.DbUnitTask"/>

	<target name="export_all_flat">
		<dbunit driver="${jdbc.driverClassName}"          
				url="${jdbc.url}"          
		        userid="${jdbc.username}"          
		        password="${jdbc.password}">    
		    <export format="flat" dest="${src.test.dir}/${dbName}.export.xml"/> 
		</dbunit>
	</target>

	<target name="export_all">
	    <antcall target="export_all_flat"/>
	    <antcall target="export_all_dtd"/>
	</target>

	<target name="export_all_xml">
		<dbunit driver="${jdbc.driverClassName}"          
				url="${jdbc.url}"          
		        userid="${jdbc.username}"          
		        password="${jdbc.password}">    
		    <export format="xml" dest="${src.test.dir}/${dbName}.export.xml"/> 
		</dbunit>
	</target>

	<target name="export_all_dtd">
		<dbunit driver="${jdbc.driverClassName}"          
				url="${jdbc.url}"          
		        userid="${jdbc.username}"          
		        password="${jdbc.password}">    
		    <export format="dtd" dest="${src.test.dir}/${dbName}.export.dtd"/> 
		</dbunit>
	</target>

</project>
