当前位置: 首页>>代码示例>>Java>>正文


Java MySqlMetadataHandler类代码示例

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


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

示例1: testGetCorrectDatabaseMetaHandler

import org.dbunit.ext.mysql.MySqlMetadataHandler; //导入依赖的package包/类
@Test
public void testGetCorrectDatabaseMetaHandler() {
    Properties prop = new Properties();
    prop.setProperty("org.dbunit.database.IMetadataHandler.implClassName", "org.dbunit.database.DefaultMetadataHandler");
    sut.init(prop);
    
    IMetadataHandler metaHandler1 = sut.getDefaultDatabaseMetaHandler();
    Assert.assertNotNull(metaHandler1);
    Assert.assertThat(metaHandler1, CoreMatchers.instanceOf(DefaultMetadataHandler.class));
    
    prop = new Properties();
    prop.setProperty("org.dbunit.database.IMetadataHandler.implClassName", "org.dbunit.ext.mysql.MySqlMetadataHandler");
    sut.init(prop);
    
    metaHandler1 = sut.getDefaultDatabaseMetaHandler();
    
    Assert.assertNotNull(metaHandler1);
    Assert.assertThat(metaHandler1, CoreMatchers.instanceOf(MySqlMetadataHandler.class));
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:20,代码来源:DbUnitModuleTestDefaultDatabaseMetaHandler.java

示例2: testCreateDbUnitConnection

import org.dbunit.ext.mysql.MySqlMetadataHandler; //导入依赖的package包/类
/**
 * Test method for {@link org.unitils.dbunit.DbUnitModule#createDbUnitConnection(java.lang.String)}.
 */
@Test
public void testCreateDbUnitConnection() {
    Properties tempConfig = (Properties) configuration.clone();
    tempConfig.setProperty("org.dbunit.database.IMetadataHandler.implClassName", "org.dbunit.ext.mysql.MySqlMetadataHandler");
    sut.init(tempConfig);
    
    DbUnitDatabaseConnection connection = sut.createDbUnitConnection(schema);
    DatabaseConfig databaseConfig = connection.getConfig();
    Object metaHandler = databaseConfig.getProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER);
    
    Assert.assertNotNull(metaHandler);
    Assert.assertThat(metaHandler, CoreMatchers.instanceOf(MySqlMetadataHandler.class));
}
 
开发者ID:linux-china,项目名称:unitils,代码行数:17,代码来源:DbUnitModuleTestDefaultDatabaseMetaHandler.java

示例3: init

import org.dbunit.ext.mysql.MySqlMetadataHandler; //导入依赖的package包/类
/**
 * Method to insert data before test. throws Exception from DB.
 * 
 * @throws Exception
 *             the exception
 */
public void init() throws Exception {
    DatabaseLoader.logger.debug("DatabaseLoader.init()");

    try {
        DatabaseLoader.logger.debug("starting init() in DatabaseLoader...");

        this.dbConn = new DatabaseConnection(DataSourceUtils.getConnection(dataSource), this.schema);

        DatabaseConfig config = dbConn.getConfig();
        config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
        config.setProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER, new MySqlMetadataHandler());
        config.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, Boolean.TRUE);
        DatabaseLoader.logger.debug("DATASOURCE." + dataSource.toString());
        this.loader = new FlatXmlDataSetBuilder();

        dbConn.getConnection().createStatement().execute("DELETE FROM dbe_transaction");
        deleteAll("dbunit/CREATE_DATATEST_III.xml", false);
        deleteAll("dbunit/CREATE_DATATEST_II.xml", false);
        deleteAll("dbunit/CREATE_DATATEST_I.xml", false);

        cleanInsert("dbunit/CREATE_DATATEST_I.xml", false);
        cleanInsert("dbunit/CREATE_DATATEST_II.xml", false);
        cleanInsert("dbunit/CREATE_DATATEST_III.xml", true);

        DatabaseLoader.logger.debug("ending init() in DatabaseLoader...");

    } catch (Exception e) {
        DatabaseLoader.logger.error("Error loading data init in DatabaseLoader");
        dbConn.getConnection().rollback();
        e.printStackTrace();
        throw e;
    }
}
 
开发者ID:conwetlab,项目名称:fiware-rss,代码行数:40,代码来源:DatabaseLoader.java

示例4: dbUnitDatabaseConfig

import org.dbunit.ext.mysql.MySqlMetadataHandler; //导入依赖的package包/类
/**
 * custom configuration since we have case-sensitive table names and requiring
 * MySQL specifics
 */
@Bean
public DatabaseConfigBean dbUnitDatabaseConfig() {
    DatabaseConfigBean config = new DatabaseConfigBean();
    config.setDatatypeFactory(new MySqlDataTypeFactory());
    config.setMetadataHandler(new MySqlMetadataHandler());
    config.setCaseSensitiveTableNames(true);
    config.setAllowEmptyFields(true);
    return config;
}
 
开发者ID:amvnetworks,项目名称:amv-access-api-poc,代码行数:14,代码来源:DaoDbUnitTestConfig.java


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