本文整理汇总了Java中org.dbunit.ext.h2.H2DataTypeFactory类的典型用法代码示例。如果您正苦于以下问题:Java H2DataTypeFactory类的具体用法?Java H2DataTypeFactory怎么用?Java H2DataTypeFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
H2DataTypeFactory类属于org.dbunit.ext.h2包,在下文中一共展示了H2DataTypeFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: configDatabaseProperties
import org.dbunit.ext.h2.H2DataTypeFactory; //导入依赖的package包/类
private void configDatabaseProperties() throws SQLException {
DatabaseConfig config = dbUnitConnection.getConfig();
for (Map.Entry<String, Object> p : dbUnitConfig.getProperties().entrySet()) {
ConfigProperty byShortName = DatabaseConfig.findByShortName(p.getKey());
if (byShortName != null) {
config.setProperty(byShortName.getProperty(), p.getValue());
}
}
switch (dbType) {
case HSQLDB:
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());
break;
case H2:
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new H2DataTypeFactory());
break;
case MYSQL:
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
break;
case POSTGRESQL:
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
break;
case ORACLE:
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new Oracle10DataTypeFactory());
break;
}
}
示例2: testConnection
import org.dbunit.ext.h2.H2DataTypeFactory; //导入依赖的package包/类
@SuppressWarnings("ProhibitedExceptionDeclared")
@Bean
public DatabaseDataSourceConnection testConnection(final DataSource dataSource) throws Exception {
final DatabaseConfigBean databaseConfigBean = new DatabaseConfigBean();
databaseConfigBean.setDatatypeFactory(new H2DataTypeFactory());
databaseConfigBean.setCaseSensitiveTableNames(false);
final DatabaseDataSourceConnectionFactoryBean databaseDataSourceConnectionFactoryBean = new DatabaseDataSourceConnectionFactoryBean();
databaseDataSourceConnectionFactoryBean.setDataSource(dataSource);
databaseDataSourceConnectionFactoryBean.setDatabaseConfig(databaseConfigBean);
databaseDataSourceConnectionFactoryBean.setSchema("FIND");
return databaseDataSourceConnectionFactoryBean.getObject();
}
示例3: TestCaseDataSourceDatabaseTesterRule
import org.dbunit.ext.h2.H2DataTypeFactory; //导入依赖的package包/类
public TestCaseDataSourceDatabaseTesterRule() {
super();
final H2Rule h2 = new H2Rule();
final LiquiunitRule liquibase = new LiquiunitRule(h2);
final DataSourceDatabaseTesterRule dbUnit = new DataSourceDatabaseTesterRule(h2, new H2DataTypeFactory());
this.rule = RuleChain.outerRule(h2).around(liquibase).around(dbUnit);
}
示例4: TestCaseJPARule
import org.dbunit.ext.h2.H2DataTypeFactory; //导入依赖的package包/类
public TestCaseJPARule() {
super();
final H2Rule h2 = new H2Rule(archive);
final LiquiunitRule liquibase = new LiquiunitRule(h2);
final DataSourceDatabaseTesterRule dbUnit = new DataSourceDatabaseTesterRule(h2, new H2DataTypeFactory());
final TestRule jpaRule = new JPARule(this, "test", h2);
this.rule = RuleChain.outerRule(h2).around(liquibase).around(dbUnit).around(jpaRule);
}
示例5: setUpDatabaseConfig
import org.dbunit.ext.h2.H2DataTypeFactory; //导入依赖的package包/类
@Override
protected void setUpDatabaseConfig(DatabaseConfig config) {
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new H2DataTypeFactory());
}
示例6: createDbUnitH2Connection
import org.dbunit.ext.h2.H2DataTypeFactory; //导入依赖的package包/类
private IDatabaseConnection createDbUnitH2Connection(Connection connection) throws DatabaseUnitException {
IDatabaseConnection dbUnitConnection = new DatabaseConnection(connection);
dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new H2DataTypeFactory());
return dbUnitConnection;
}
示例7: typical
import org.dbunit.ext.h2.H2DataTypeFactory; //导入依赖的package包/类
/**
* A convenience "fire-and-forget" method that returns a {@link
* TestRule} constructed in the following manner:
*
* <blockquote><pre>final H2Rule h2 = new H2Rule(archive);
*final LiquiunitRule liquibase = new LiquiunitRule(h2);
*final DataSourceDatabaseTesterRule dbUnit = new DataSourceDatabaseTesterRule(h2, new H2DataTypeFactory());
*final TestRule jpaRule = new JPARule(this, "test", h2);
*return RuleChain.outerRule(h2).around(liquibase).around(dbUnit).around(jpaRule);</pre></blockquote>
*
* @param testInstance the JUnit test instance being set up; should
* not be {@code null}
*
* @param archive an {@link H2Archive} to store the "blank" state of
* the underlying in-memory H2 database; may be {@code null}
*
* @return a non-{@code null} {@link TestRule} set up for
* JPA-oriented testing
*/
public static TestRule typical(final Object testInstance, final H2Archive archive) {
final H2Rule h2 = new H2Rule(archive);
final LiquiunitRule liquibase = new LiquiunitRule(h2);
final DataSourceDatabaseTesterRule dbUnit = new DataSourceDatabaseTesterRule(h2, new H2DataTypeFactory());
final TestRule jpaRule = new JPARule(testInstance, "test", h2);
// H2, then Liquibase, then dbUnit, then JPA.
return RuleChain.outerRule(h2).around(liquibase).around(dbUnit).around(jpaRule);
}