本文整理了Java中org.dbunit.dataset.xml.XmlDataSet
类的一些代码示例,展示了XmlDataSet
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XmlDataSet
类的具体详情如下:
包路径:org.dbunit.dataset.xml.XmlDataSet
类名称:XmlDataSet
暂无
代码示例来源:origin: openmrs/openmrs-core
xmlDataSet = new XmlDataSet(fileInInputStreamFormat);
xmlDataSetToRun = xmlDataSet;
代码示例来源:origin: org.iternine/jeppetto-test-support
public void writeXmlDataSet(OutputStream outputStream, String[] tables) {
try {
IDataSet dataSet = getIDatabaseConnection().createDataSet();
if (tables != null) {
dataSet = new FilteredDataSet(tables, dataSet);
}
XmlDataSet.write(dataSet, outputStream);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (DataSetException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: net.sourceforge.openutils/openutils-testing
XmlDataSet.write(fullDataSet, fos);
代码示例来源:origin: springtestdbunit/spring-test-dbunit
@Override
protected IDataSet createDataSet(Resource resource) throws Exception {
InputStream inputStream = resource.getInputStream();
try {
return new XmlDataSet(inputStream);
} finally {
inputStream.close();
}
}
代码示例来源:origin: org.iternine/jeppetto-test-support
public void writeXmlDataSet(OutputStream outputStream, String[] tables) {
IDatabaseConnection databaseConnection = null;
try {
databaseConnection = getIDatabaseConnection();
ITableFilter sequenceFilter = new DatabaseSequenceFilter(databaseConnection);
IDataSet dataSet = new FilteredDataSet(sequenceFilter, databaseConnection.createDataSet());
if (tables != null) {
dataSet = new FilteredDataSet(tables, dataSet);
}
XmlDataSet.write(dataSet, outputStream);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (DataSetException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
} finally {
if (databaseConnection != null) {
try { databaseConnection.close(); } catch (SQLException ignore) { }
}
}
}
代码示例来源:origin: e-biz/spring-dbunit
/**
* {@inheritDoc}
*/
@Override
protected IDataSet fromResource(Resource resource, DataSetFormatOptions options) throws DataSetException, IOException {
return new XmlDataSet(resource.getInputStream());
}
},
代码示例来源:origin: com.github.springtestdbunit/spring-test-dbunit
@Override
protected IDataSet createDataSet(Resource resource) throws Exception {
InputStream inputStream = resource.getInputStream();
try {
return new XmlDataSet(inputStream);
} finally {
inputStream.close();
}
}
代码示例来源:origin: stackoverflow.com
protected static IDataSet getDataSet() throws Exception {
URL url = MyTest.class.getClassLoader().getResource("MyDataSet.xml");
return new XmlDataSet(new FileInputStream(url.getPath()));
代码示例来源:origin: dayatang/dddlib
private IDataSet getDataSetObject(String path) throws Exception {
if (getDataSetStrategy().equals(DataSetStrategy.Xml)) {
return new XmlDataSet(Dbunit.class.getResourceAsStream(path));
} else if (getDataSetStrategy().equals(DataSetStrategy.FlatXml)) {
boolean enableColumnSensing = true;
InputStreamReader inReader = new InputStreamReader(Dbunit.class
.getResourceAsStream(path), "UTF-8");
// FlatXmlDataSet fxset = new FlatXmlDataSet(inReader, true,
// enableColumnSensing, false);
// return fxset;
return new CachedDataSet(new FlatXmlProducer(new InputSource(
inReader), true, enableColumnSensing, false));
} else {
return new XmlDataSet(Dbunit.class.getResourceAsStream(path));
}
}
代码示例来源:origin: net.sourceforge.openutils/openutils-testing
dataSet = new XmlDataSet(is);
代码示例来源:origin: org.iternine/jeppetto-test-support
public void loadXmlDataSet(InputStream inputStream) {
try {
IDataSet dataSet = new XmlDataSet(inputStream);
executeArbitrarySql("SET REFERENTIAL_INTEGRITY FALSE");
DatabaseOperation.REFRESH.execute(getIDatabaseConnection(), dataSet);
executeArbitrarySql("SET REFERENTIAL_INTEGRITY TRUE");
} catch (DatabaseUnitException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.iternine/jeppetto-test-support
public void loadXmlDataSet(InputStream inputStream) {
IDatabaseConnection databaseConnection = null;
try {
databaseConnection = getIDatabaseConnection();
IDataSet dataSet = new XmlDataSet(inputStream);
DatabaseOperation.REFRESH.execute(databaseConnection, dataSet);
} catch (DatabaseUnitException e) {
throw new RuntimeException(e);
} catch (SQLException e) {
throw new RuntimeException(e);
} finally {
if (databaseConnection != null) {
try { databaseConnection.close(); } catch (SQLException ignore) { }
}
}
}
代码示例来源:origin: it.tidalwave.bluebill/it-tidalwave-bluebill-stats-test-commons
/*******************************************************************************************************************
*
* Populates the database from the given XML file.
*
* @param transactionManager the Spring transaction manager
* @param xmlFile the file with the data to populate the database with
*
******************************************************************************************************************/
public static void populate (final @Nonnull JpaTransactionManager transactionManager,
final @Nonnull File xmlFile)
throws SQLException, DatabaseUnitException, IOException
{
log.info("******** populate(.., {})", xmlFile);
final @Cleanup IDatabaseConnection connection = createConnection(transactionManager);
final @Cleanup Reader r = new FileReader(xmlFile);
DatabaseOperation.INSERT.execute(connection, new XmlDataSet(r));
r.close();
connection.close();
}
代码示例来源:origin: org.iternine/jeppetto-test-support
public static void assertDatabaseContentsEquals(Database database, InputStream inputStream,
Map<String, String[]> ignoreMap) {
Map<ITableFilter, IColumnFilter> filterMap = createFilterMap(ignoreMap);
try {
IDataSet databaseDataSet = database.getIDatabaseConnection().createDataSet();
IDataSet actualDataSet = removeIgnoredColumns(databaseDataSet, filterMap);
IDataSet xmlDataSet = new XmlDataSet(inputStream);
IDataSet expectedDataSet = removeIgnoredColumns(xmlDataSet, filterMap);
String[] expectedTableNames = expectedDataSet.getTableNames();
for (String expectedTableName : expectedTableNames) {
Assertion.assertEquals(new SortedTable(expectedDataSet.getTable(expectedTableName)),
new SortedTable(actualDataSet.getTable(expectedTableName),
expectedDataSet.getTable(expectedTableName).getTableMetaData()));
}
} catch (SQLException e) {
throw new RuntimeException(e);
} catch (DataSetException e) {
throw new RuntimeException(e);
} catch (DatabaseUnitException e) {
throw new AssertionFailedError(e.getMessage());
}
}
内容来源于网络,如有侵权,请联系作者删除!