[英]CLOB representation in Unitils dbunit dataset
我的桌子上有一個Clob列。 如何在dbunit數據集xml中表示它,以便可以在集成測試中使用它?
您可以使用ReplacementDataSet做到這一點
這是一個例子:
表架構:
CREATE TABLE TABLE_CLOB(COLUMN_CLOB CLOB);
XML數據集(文件dataSet.xml):
<dataset>
<table name="TABLE_CLOB">
<column>COLUMN_CLOB</column>
<row>
<value>CLOB_1</value>
</row>
</table>
</dataset>
在您的測試方法中:
// Initialize one IDataSet from your dataset xml
InputStream expIn = this.getClass().getResourceAsStream("dataSet.xml");
IDataSet xmlDataSet = new XmlDataSet(expIn);
// Initialize one ReplacementDataSet with previous xmlDataSet
ReplacementDataSet dataSet = new ReplacementDataSet(xmlDataSet);
// Make the replacements
dataSet.addReplacementObject("CLOB_1", YourClobObject);
// Insert the dataSet into the databaseTest
DatabaseOperation.CLEAN_INSERT.execute(databaseTester.getConnection(), dataSet);
希望能幫助到你
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.