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

Java IDataTypeFactory类代码示例

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

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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java TypeParameter类代码示例发布时间:2022-05-23
下一篇:
Java ClientRequestMetrics类代码示例发布时间: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