/
dbunit-test_data_set.xml
47 lines (40 loc) · 2.02 KB
/
dbunit-test_data_set.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<?xml version='1.0' encoding='UTF-8'?>
<!--DOCTYPE dataset SYSTEM 'testData/dbunit-test_data_set.dtd'-->
<!--
See DbUnit's XmlDataSet.
Database definition for AbstractEmbeddedDbTestCase
- uses DbUnit to load the data into an embedded derby DB -
To connect to the DB: user sa, psw emty, url
jdbc:derby:<absolute path to this project>\testData\testDB
Note: Only 1 connection to the Derby DB at a time is allowed!!!!
IMPORTANT
=========
1) You must have <table> entry for any table you want DbUnit to clear for you.
Even if you don't want DbUnit to insert any data you must still declare at least
<table name="yourSchema.yourTable" /> for the table yourSchema.yourTable to be emptied during test setUp().
2) When using a column that contains XML value, you may use <![CDATA[ to supply the value.
But there should be no space within '<value><![CDATA[<?xml ...' otherwise you may get Xerces'
exception 'The processing instruction target matching "[xX][mM][lL]" is not allowed.'
ABOUT FILE FORMAT
=================
This format is better than flat data set because it describes explicitly the
columns though it's also more verbose.
Also, thanks to setting the DbUnit feature QUALIFIED_TABLE_NAMES to true in the test,
we can use fully qualified table names and thus have tables in different schemas.
HOW TO CREATE
=============
To create a DbUnit data set like this you've several options:
1. Write it manually.
2. Use DbUnit itself to connect to a DB, load a data set and store it into a XmlDataSet.
3. Use the Eclipse plugin QuantumDB and its ability to export table into DbUnit data set format.
4. Use Jailer (http://jailer.sourceforge.net/home.htm) - it can export also only a sample of
a DB while preserving referential integrity.
-->
<dataset>
<!--
######### TABLES TO CLEAR WITHOUT INSERTING ANY DATA DURING TestCase#setUp() #########
Provide names of the tables whose content shall be dropped prior to running a test method.
You don't need to list its columns.
-->
<table name="my_test_schema.my_test_table" />
</dataset>