????????????
????????????????DataSourceUtils.getConnection(datasource) ?? ?????????????????????????Dbunit????????Dbunit??????????????????????????????????????????????????С?Spring??TransactionManager?????????????????????浽ThreadLocal?У?DataSourceUtils.getConnection???????????ThreadLocal?л???????
????user001.xml
????Xml????

 

<?xml version="1.0" encoding="UTF-8"?>
<dataset>
<user nick="user001" password="password001" />
</dataset>

 

???????dbunit?????????xml????????????????????????????????壬????Excel?????????
????Dbunit?????????
????IDatabaseConnection
?????????????????????DatabaseConnection ??DatabaseDataSourceConnection ?????????????????????????
????IDataSet
?????????????????????Xml???Excel????????????????????????????????????????????????????????????????????????????????????????????IDatatable???????
??????????updateUser?????У??????QueryDataSet??????????й??????Dataset???????FlatXmlDataSet??Xml????й??????Dataset????????????Dataset?????

 

QueryDataSet actual = new QueryDataSet(conn);
actual.addTable("user"?? "select * from user where user.nick = 'user001'");
IDataSet expected = new FlatXmlDataSet(new ClassPathResource(
"com/taobao/dbunit/dao/user001_updated.xml").getFile());
Assertion.assertEquals(expected?? actual);
DatabaseOperation

????????????????ο??????????????????????????????????DatabaseOperation .INSERT?????? InsertOperation????????execute???????????????????????磺
????IDataSet origen = new FlatXmlDataSet(new ClassPathResource(
????"com/taobao/dbunit/dao/user001.xml").getFile());
????DatabaseOperation.INSERT.execute(conn?? origen);
??????Xml????й???DataSet?????Insert???????????????????????
????Assertion
???????????assertEqual???????????????????????????
???????????Dbunit???????????http://www.dbunit.org/components.html
????PS:???Oracle??????????DatabaseConnection???????scheme??new DatabaseConnection(conn??SCHEMA_NAME ) ??SCHMEA_NAME?????д??
?????????????д???????