本文整理汇总了Java中org.dbunit.dataset.xml.FlatXmlProducer类的典型用法代码示例。如果您正苦于以下问题:Java FlatXmlProducer类的具体用法?Java FlatXmlProducer怎么用?Java FlatXmlProducer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
FlatXmlProducer类属于org.dbunit.dataset.xml包,在下文中一共展示了FlatXmlProducer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: insertDbUnitTestdata
import org.dbunit.dataset.xml.FlatXmlProducer; //导入依赖的package包/类
/**
* Inserts test data in DbUnit XML format.
*
* @param entityManager
* the EntityManager
* @param dbUnitTestdata
* test file stream
*/
public static void insertDbUnitTestdata(EntityManager entityManager, final InputStream dbUnitTestdata) {
entityManager.unwrap(Session.class).doWork(new Work() {
@Override
public void execute(Connection connection) throws SQLException {
// Insert Testdata
try {
LOGGER.debug("INSERTing testdata");
DatabaseConnection databaseConnection = new DatabaseConnection(connection);
databaseConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY,
new MySqlDataTypeFactory());
FlatXmlDataSet dataSet = new FlatXmlDataSet(
new FlatXmlProducer(new InputSource(dbUnitTestdata), false, true));
DatabaseOperation.CLEAN_INSERT.execute(databaseConnection, dataSet);
LOGGER.debug("INSERTing testdata ... done");
} catch (DatabaseUnitException e) {
throw new SQLException(e);
}
}
});
}
开发者ID:kaiwinter,项目名称:testcontainers-examples,代码行数:33,代码来源:DockerDatabaseTestUtil.java
示例2: truncate
import org.dbunit.dataset.xml.FlatXmlProducer; //导入依赖的package包/类
/**
* Truncate tables specified in the datafile
* @param connection database connection
* @param clazz class from which the datafile resource is retrieved
* @param datafile datafile specifying tables to be truncated
* @throws DatabaseUnitException on error
*/
public void truncate(final IDatabaseConnection connection, final Class<?> clazz, final String datafile) throws DatabaseUnitException {
try {
DatabaseOperation.TRUNCATE_TABLE.execute(connection, new CachedDataSet(new FlatXmlProducer(new InputSource(getResource(clazz, datafile)))));
} catch (final SQLException e) {
throw new DatabaseUnitException(e);
}
}
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:15,代码来源:AbstractDBUnitUtil.java
示例3: createDateSet
import org.dbunit.dataset.xml.FlatXmlProducer; //导入依赖的package包/类
/**
* 根据配置文件的名称创建DateSet
* @param tname配置文件的名称
* @return
* @throws DataSetException
*/
protected IDataSet createDateSet(String tname) throws DataSetException {
//配置文件在classes的根目录下
InputStream is = AbstractDbUnitTestCase
.class
.getClassLoader().getResourceAsStream(tname+".xml");
Assert.assertNotNull("dbunit的基本数据文件不存在",is);
//创建DataSet
return new FlatXmlDataSet(new FlatXmlProducer(new InputSource(is)));
}
开发者ID:SoftwareKing,项目名称:SpringCloud,代码行数:16,代码来源:AbstractDbUnitTestCase.java
示例4: resumeTable
import org.dbunit.dataset.xml.FlatXmlProducer; //导入依赖的package包/类
protected void resumeTable() throws FileNotFoundException, DatabaseUnitException, SQLException {
IDataSet ds = new FlatXmlDataSet(new FlatXmlProducer(new InputSource(new FileInputStream(tempFile))));
DatabaseOperation.CLEAN_INSERT.execute(dbunitCon, ds);
}
开发者ID:SoftwareKing,项目名称:SpringCloud,代码行数:5,代码来源:AbstractDbUnitTestCase.java
示例5: getDataSet
import org.dbunit.dataset.xml.FlatXmlProducer; //导入依赖的package包/类
public FlatXmlDataSet getDataSet(String fileName) throws DataSetException {
return new FlatXmlDataSet(new FlatXmlProducer(new InputSource(getClass().getResourceAsStream(fileName))));
}
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:4,代码来源:DbTestConfiguration.java
注:本文中的org.dbunit.dataset.xml.FlatXmlProducer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论