本文整理汇总了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;未经允许,请勿转载。 |
请发表评论