本文整理汇总了Java中org.dbunit.dataset.datatype.IDataTypeFactory类的典型用法代码示例。如果您正苦于以下问题:Java IDataTypeFactory类的具体用法?Java IDataTypeFactory怎么用?Java IDataTypeFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IDataTypeFactory类属于org.dbunit.dataset.datatype包,在下文中一共展示了IDataTypeFactory类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: installDataTypeFactory
import org.dbunit.dataset.datatype.IDataTypeFactory; //导入依赖的package包/类
/**
* Ensures that every {@link IDatabaseConnection} produced during
* the course of execution is configured to use the supplied {@link
* IDataTypeFactory}.
*
* @param dataTypeFactory the {@link IDataTypeFactory} suitable for
* the underlying database; may be {@code null}
*
* @see IOperationListener#connectionRetrieved(IDatabaseConnection)
*
* @see DatabaseConfig#PROPERTY_DATATYPE_FACTORY
*/
private final void installDataTypeFactory(final IDataTypeFactory dataTypeFactory) {
if (dataTypeFactory != null && this.tester != null) {
this.tester.setOperationListener(new DefaultOperationListener() {
@Override
public final void connectionRetrieved(final IDatabaseConnection connection) {
super.connectionRetrieved(connection);
if (connection != null) {
final DatabaseConfig config = connection.getConfig();
if (config != null) {
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, dataTypeFactory);
}
}
}
});
}
}
开发者ID:ljnelson,项目名称:liquiunit,代码行数:29,代码来源:DataSourceDatabaseTesterRule.java
示例2: createDbUnitConnection
import org.dbunit.dataset.datatype.IDataTypeFactory; //导入依赖的package包/类
/**
* Creates a new instance of dbUnit's <code>IDatabaseConnection</code>
*
* @param schemaName The schema name, not null
* @return A new instance of dbUnit's <code>IDatabaseConnection</code>
*/
protected DbUnitDatabaseConnection createDbUnitConnection(String schemaName) {
// A DbSupport instance is fetched in order to get the schema name in correct case
DataSourceWrapper wrapper = getDatabaseModule().getWrapper(databaseName);
DataSource dataSource = wrapper.getDataSourceAndActivateTransactionIfNeeded();
SQLHandler sqlHandler = new DefaultSQLHandler(dataSource);
DbSupport dbSupport = getDbSupport(configuration, sqlHandler, schemaName, wrapper.getDatabaseConfiguration().getDialect());
// Create connection
DbUnitDatabaseConnection connection = new DbUnitDatabaseConnection(dataSource, dbSupport.getSchemaName());
DatabaseConfig config = connection.getConfig();
// Make sure that dbunit's correct IDataTypeFactory, that handles dbms specific data type issues, is used
IDataTypeFactory dataTypeFactory = getInstanceOf(IDataTypeFactory.class, configuration, dbSupport.getDatabaseDialect());
config.setProperty(PROPERTY_DATATYPE_FACTORY, dataTypeFactory);
// Make sure that table and column names are escaped using the dbms-specific identifier quote string
if (dbSupport.getIdentifierQuoteString() != null)
config.setProperty(PROPERTY_ESCAPE_PATTERN, dbSupport.getIdentifierQuoteString() + '?' + dbSupport.getIdentifierQuoteString());
// Make sure that batched statements are used to insert the data into the database
config.setProperty(FEATURE_BATCHED_STATEMENTS, "true");
// Make sure that Oracle's recycled tables (BIN$) are ignored (value is used to ensure dbunit-2.2 compliancy)
config.setProperty("http://www.dbunit.org/features/skipOracleRecycleBinTables", "true");
//set MetaHandler
config.setProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER, getDefaultDatabaseMetaHandler());
return connection;
}
开发者ID:linux-china,项目名称:unitils,代码行数:34,代码来源:DbUnitModule.java
示例3: createDefaultDataTypeFactory
import org.dbunit.dataset.datatype.IDataTypeFactory; //导入依赖的package包/类
private IDataTypeFactory createDefaultDataTypeFactory() {
return new DefaultDataTypeFactory();
}
开发者ID:otsecbsol,项目名称:linkbinder,代码行数:4,代码来源:DataTypeFactorySelector.java
示例4: createConnection
import org.dbunit.dataset.datatype.IDataTypeFactory; //导入依赖的package包/类
IDatabaseConnection createConnection()
throws Exception
{
// Instantiate JDBC driver
Class dc = Class.forName( driver );
Driver driverInstance = (Driver) dc.newInstance();
Properties info = new Properties();
info.put( "user", username );
if ( password != null )
{
info.put( "password", password );
}
Connection conn = driverInstance.connect( url, info );
if ( conn == null )
{
// Driver doesn't understand the URL
throw new SQLException( "No suitable Driver for " + url );
}
conn.setAutoCommit( true );
IDatabaseConnection connection = new DatabaseConnection( conn, schema );
DatabaseConfig config = connection.getConfig();
config.setFeature( DatabaseConfig.FEATURE_BATCHED_STATEMENTS, supportBatchStatement );
config.setFeature( DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, useQualifiedTableNames );
config.setFeature( DatabaseConfig.FEATURE_DATATYPE_WARNING, datatypeWarning );
config.setFeature( DatabaseConfig.FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES, this.skipOracleRecycleBinTables );
config.setFeature( DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, caseSensitiveTableNames );
config.setProperty( DatabaseConfig.PROPERTY_ESCAPE_PATTERN, escapePattern );
config.setProperty( DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY, new ForwardOnlyResultSetTableFactory() );
// Setup data type factory
IDataTypeFactory dataTypeFactory = (IDataTypeFactory) Class.forName( dataTypeFactoryName ).newInstance();
config.setProperty( DatabaseConfig.PROPERTY_DATATYPE_FACTORY, dataTypeFactory );
// Setup metadata handler
IMetadataHandler metadataHandler = (IMetadataHandler) Class.forName( metadataHandlerName ).newInstance();
config.setProperty( DatabaseConfig.PROPERTY_METADATA_HANDLER, metadataHandler );
return connection;
}
开发者ID:mojohaus,项目名称:dbunit-maven-plugin,代码行数:46,代码来源:AbstractDbUnitMojo.java
示例5: createConnection
import org.dbunit.dataset.datatype.IDataTypeFactory; //导入依赖的package包/类
IDatabaseConnection createConnection()
throws Exception {
// Instantiate JDBC driver
Class dc = Class.forName(driver);
Driver driverInstance = (Driver) dc.newInstance();
Properties info = new Properties();
info.put("user", username);
if (password != null) {
info.put("password", password);
}
Connection conn = driverInstance.connect(url, info);
if (conn == null) {
// Driver doesn't understand the URL
throw new SQLException("No suitable Driver for " + url);
}
conn.setAutoCommit(true);
IDatabaseConnection connection = new DatabaseConnection(conn, schema);
DatabaseConfig config = connection.getConfig();
config.setProperty(DatabaseConfig.FEATURE_BATCHED_STATEMENTS, supportBatchStatement);
config.setProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, useQualifiedTableNames);
config.setProperty(DatabaseConfig.FEATURE_DATATYPE_WARNING, datatypeWarning);
config.setProperty(DatabaseConfig.FEATURE_SKIP_ORACLE_RECYCLEBIN_TABLES, this.skipOracleRecycleBinTables);
config.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, caseSensitiveTableNames);
config.setProperty(DatabaseConfig.PROPERTY_ESCAPE_PATTERN, escapePattern);
config.setProperty(DatabaseConfig.PROPERTY_RESULTSET_TABLE_FACTORY, new ForwardOnlyResultSetTableFactory());
// Setup data type factory
IDataTypeFactory dataTypeFactory = (IDataTypeFactory) Class.forName(dataTypeFactoryName).newInstance();
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, dataTypeFactory);
// Setup metadata handler
IMetadataHandler metadataHandler = (IMetadataHandler) Class.forName(metadataHandlerName).newInstance();
config.setProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER, metadataHandler);
return connection;
}
开发者ID:lotaris,项目名称:lotaris-dbunit-maven-plugin,代码行数:43,代码来源:AbstractDbUnitMojo.java
示例6: DataSourceDatabaseTesterRule
import org.dbunit.dataset.datatype.IDataTypeFactory; //导入依赖的package包/类
/**
* Creates a {@link DataSourceDatabaseTesterRule}.
*
* @param dataSource the {@link DataSource} that will back a new
* {@link DataSourceDatabaseTester} {@linkplain
* DataSourceDatabaseTester#DataSourceDatabaseTester(DataSource)
* created} by this constructor; must not be {@code null}
*
* @param dataTypeFactory the {@link IDataTypeFactory} that
* describes data types for the database to which the supplied
* {@link DataSource} is notionally connected; may be {@code null}
*
* @exception NullPointerException if {@code dataSource} is {@code
* null}
*
* @see DataSourceDatabaseTester#DataSourceDatabaseTester(DataSource)
*/
public DataSourceDatabaseTesterRule(final DataSource dataSource, final IDataTypeFactory dataTypeFactory) {
this(dataSource);
this.installDataTypeFactory(dataTypeFactory);
}
开发者ID:ljnelson,项目名称:liquiunit,代码行数:22,代码来源:DataSourceDatabaseTesterRule.java
注:本文中的org.dbunit.dataset.datatype.IDataTypeFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论