Thursday, January 17, 2008

Clean Insert with XML file


IDataSet dataSet = getXMLDataSet("rcst_m_customer.xml");
DatabaseOperation.CLEAN_INSERT.execute(connection, dataSet)
/**
* getting Dataset from .xml file.
*
* @param fileName xml File Name
*
* @return Dataset for DBunit.
*/
private IDataSet getXMLDataSet(String fileName){
IDataSet dataSet = null;
try {
dataSet = new XmlDataSet(
this.getClass().getResourceAsStream(TESTDATA_PATH + fileName));
} catch (Throwable ex) {
ex.printStackTrace();
fail("getDataSet thrown exception : " + ex.getMessage());
}
return dataSet;
}

No comments: