テーブルに clob 列があります。統合テストで使用できるように、dbunit データセット xml でどのように表現すればよいですか?
1187 次
1 に答える
0
あなたは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);
それが役に立てば幸い
于 2015-03-06T12:45:32.073 に答える