xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
org.codehaus.mojo
dbunit-maven-plugin-example
dbunit-maven-plugin-example
1.0-beta-1-SNAPSHOT
This runnable example execises operation, export, and compare goals.
It uses sql-maven-plugin to create database, then have dbunit-maven-plugin
to initialize database with some data, export initial data to an external file,
import the exported dataset file back to database, finally compare database
with orignal dataset file.
git clone https://github.com/mojohaus/dbunit-maven-plugin.git ; cd dbunit-maven-plugin/src/example and run "mvn"
test
org.codehaus.mojo
sql-maven-plugin
1.3
hsqldb
hsqldb
1.8.0.7
${driver}
${url}
${username}
${password}
${maven.test.skip}
src/main/test/data/create-table.sql
create-table
test-compile
execute
org.codehaus.mojo
dbunit-maven-plugin
1.0-SNAPSHOT
hsqldb
hsqldb
1.8.0.7
${driver}
${url}
${username}
${password}
${maven.test.skip}
insert
test
operation
INSERT
${originalDataSetFile}
export
test
export
${exportedDataSetFile}
clean-insert-the-exported-dataset
test
operation
CLEAN_INSERT
${exportedDataSetFile}
compare-database-with-original-dataset
test
compare
${originalDataSetFile}
compare-table-with-original-dataset
test
compare
${originalDataSetFile}
person
compare-queries-with-original-dataset
test
compare
${originalDataSetFile}
person
select * from person
src/main/resources
src/main/test/data
**.sql
src/main/test/data
**.xml
org.hsqldb.jdbcDriver
jdbc:hsqldb:file:target/testdb
sa
src/main/test/data/sample-data.xml
${project.build.directory}/dbunit/exported-dataset.xml
UTF-8
UTF-8
UTF-8
一键复制
编辑
Web IDE
原始数据
按行查看
历史