• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DataSourceDatabaseTester类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.dbunit.DataSourceDatabaseTester的典型用法代码示例。如果您正苦于以下问题:Java DataSourceDatabaseTester类的具体用法?Java DataSourceDatabaseTester怎么用?Java DataSourceDatabaseTester使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataSourceDatabaseTester类属于org.dbunit包,在下文中一共展示了DataSourceDatabaseTester类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: loadDatasource

import org.dbunit.DataSourceDatabaseTester; //导入依赖的package包/类
private void loadDatasource(DBUnitDataSet annotation, TestContext testContext) throws Exception{
	DataSource dataSource = testContext.getApplicationContext().getBean(DataSource.class);
	IDatabaseTester databaseTester = new DataSourceDatabaseTester(dataSource, "PUBLIC");	
	
	//Ignore referential integrity so DBUnit can correctly delete rows related to the data set
	dataSource.getConnection().createStatement().execute("SET DATABASE REFERENTIAL INTEGRITY FALSE;");

	for(String sourceFile : annotation.value()){
		InputStream input = this.getClass().getResourceAsStream(sourceFile);
		FlatXmlDataSetBuilder builder = new FlatXmlDataSetBuilder();
		builder.setColumnSensing(true);
		IDataSet ds = builder.build(input);
		databaseTester.setDataSet(ds);
		databaseTester.onSetup();			
	}
	
	//Add Referential constraints back in, now that the dbunit setup is complete
	dataSource.getConnection().createStatement().execute("SET DATABASE REFERENTIAL INTEGRITY TRUE;");
}
 
开发者ID:jacobhyphenated,项目名称:TaskList,代码行数:20,代码来源:DBUnitTestExecutionListener.java


示例2: initialize

import org.dbunit.DataSourceDatabaseTester; //导入依赖的package包/类
private void initialize(DataSource dataSource) throws AmbiguousTableNameException {
    databaseTester = new DataSourceDatabaseTester(dataSource);
    databaseTester.setSetUpOperation(DatabaseOperation.CLEAN_INSERT);
    databaseTester.setTearDownOperation(DatabaseOperation.DELETE_ALL);
    DefaultDataSet dataSet = new DefaultDataSet();
    dataSet.addTable(new DefaultTable("agents"));

    dataSet.addTable(new DefaultTable("pipelines"));
    dataSet.addTable(new DefaultTable("pipelinestates"));
    dataSet.addTable(new DefaultTable("materials"));
    dataSet.addTable(new DefaultTable("modifications"));
    dataSet.addTable(new DefaultTable("pipelineMaterialRevisions"));
    dataSet.addTable(new DefaultTable("modifiedFiles"));

    dataSet.addTable(new DefaultTable("notificationfilters"));
    dataSet.addTable(new DefaultTable("users"));
    dataSet.addTable(new DefaultTable("artifactPropertiesGenerator"));
    dataSet.addTable(new DefaultTable("stages"));
    dataSet.addTable(new DefaultTable("pipelineLabelCounts"));
    dataSet.addTable(new DefaultTable("environmentVariables"));
    dataSet.addTable(new DefaultTable("properties"));
    dataSet.addTable(new DefaultTable("artifactPlans"));
    dataSet.addTable(new DefaultTable("buildStateTransitions"));
    dataSet.addTable(new DefaultTable("resources"));
    dataSet.addTable(new DefaultTable("builds"));

    dataSet.addTable(new DefaultTable("oauthclients"));
    dataSet.addTable(new DefaultTable("oauthauthorizations"));
    dataSet.addTable(new DefaultTable("oauthtokens"));

    dataSet.addTable(new DefaultTable("stageArtifactCleanupProhibited"));
    dataSet.addTable(new DefaultTable("serverBackups"));
    dataSet.addTable(new DefaultTable("jobAgentMetadata"));

    databaseTester.setDataSet(dataSet);
}
 
开发者ID:gocd,项目名称:gocd,代码行数:37,代码来源:DatabaseAccessHelper.java


示例3: setUp

import org.dbunit.DataSourceDatabaseTester; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
	dbTester = new DataSourceDatabaseTester(businessDataSource);
	FlatXmlDataSetBuilder aBuilder = new FlatXmlDataSetBuilder();
	FileInputStream aDTDStream = new FileInputStream("src/test/resources/db/dataset.dtd");
	FileInputStream aDataStream = new FileInputStream("src/test/resources/db/dataset.xml");
	aBuilder.setMetaDataSetFromDtd(aDTDStream);
	IDataSet dataSet = aBuilder.build(aDataStream);
	aDTDStream.close();
	aDataStream.close();
	dbTester.setDataSet(dataSet);
	dbTester.onSetup();
}
 
开发者ID:acxio,项目名称:AGIA,代码行数:14,代码来源:HibernateNodeDaoTest.java


示例4: databaseTester

import org.dbunit.DataSourceDatabaseTester; //导入依赖的package包/类
@Bean
IDatabaseTester databaseTester() {
    return new DataSourceDatabaseTester(dataSource);
}
 
开发者ID:wemanity,项目名称:Acceptance-Tests-with-JBehave,代码行数:5,代码来源:TodoRepositoryDbUnitMannerTest.java


示例5: databaseTester

import org.dbunit.DataSourceDatabaseTester; //导入依赖的package包/类
@Bean
public DataSourceDatabaseTester databaseTester() {
	return new DataSourceDatabaseTester(dataSource());
}
 
开发者ID:szaqal,项目名称:KitchenSink,代码行数:5,代码来源:ApplicationConfig.java


示例6: DataSourceDatabaseTesterRule

import org.dbunit.DataSourceDatabaseTester; //导入依赖的package包/类
/**
 * Creates a {@link DataSourceDatabaseTesterRule}.
 *
 * <p>This constructor assumes that the supplied {@link
 * DataSourceDatabaseTester} is completely configured and this
 * {@link DataSourceDatabaseTesterRule} will therefore perform no
 * further configuration.  Please see in particular the {@link
 * #getDataSet(Description)} method, which will consequently have no
 * effect.</p>
 *
 * @param tester the {@link DataSourceDatabaseTester} to which most
 * operations will delegate; must not be {@code null}
 *
 * @exception IllegalArgumentException if {@code tester} is {@code
 * null}
 */
public DataSourceDatabaseTesterRule(final DataSourceDatabaseTester tester) {
  super();
  if (tester == null) {
    throw new IllegalArgumentException("tester", new NullPointerException("tester"));
  }
  this.tester = tester;
}
 
开发者ID:ljnelson,项目名称:liquiunit,代码行数:24,代码来源:DataSourceDatabaseTesterRule.java



注:本文中的org.dbunit.DataSourceDatabaseTester类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ModelTranslator类代码示例发布时间:2022-05-23
下一篇:
Java FinalArrayList类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap