Chapter 5 video - Automate Database Integration
I’ve added a new video that demonstrates an example of the Automate Database Integration practice described in chapter 5 of the Continuous Integration book.
The examples use Ant with HSQLDB. The first example shows a script that creates tables using an in-memory HSQLDB database as show below. By executing the create-tables.sql script, you can drop database/tables and recreate the database (DDL) through the build process.
<target name=”db:create-tables”>
<sql driver=”${db.driver}”
url=”${db.url}”
userid=”${db.username}”
password=”${db.password}”
classpathref=”db.lib.path” mce_href=”db.lib.path”
delimiter=”;”>
<fileset file=”${database.dir}/create-tables.sql”/>
</sql>
</target>
The next example shows the insertion of test data (DML) that is necessary to run automated component-level and functional tests.
<target name=”db:insert-data” depends=”filter-sql-files”>
<sql
driver=”${db.driver}”
url=”${db.url}”
userid=”${db.username}”
password=”${db.password}”
classpathref=”db.lib.path” mce_href=”db.lib.path”
xsrc=”${filtered.sql.dir}/insert-data.sql” mce_src=”${filtered.sql.dir}/insert-data.sql” />
</target>
