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


Java MySqlDataTypeFactory类代码示例

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


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

示例1: insertDbUnitTestdata

import org.dbunit.ext.mysql.MySqlDataTypeFactory; //导入依赖的package包/类
/**
 * Inserts test data in DbUnit XML format.
 *
 * @param entityManager
 *           the EntityManager
 * @param dbUnitTestdata
 *           test file stream
 */
public static void insertDbUnitTestdata(EntityManager entityManager, final InputStream dbUnitTestdata) {

   entityManager.unwrap(Session.class).doWork(new Work() {

      @Override
      public void execute(Connection connection) throws SQLException {
         // Insert Testdata
         try {
            LOGGER.debug("INSERTing testdata");
            DatabaseConnection databaseConnection = new DatabaseConnection(connection);
            databaseConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY,
               new MySqlDataTypeFactory());

            FlatXmlDataSet dataSet = new FlatXmlDataSet(
               new FlatXmlProducer(new InputSource(dbUnitTestdata), false, true));
            DatabaseOperation.CLEAN_INSERT.execute(databaseConnection, dataSet);
            LOGGER.debug("INSERTing testdata ... done");
         } catch (DatabaseUnitException e) {
            throw new SQLException(e);
         }
      }

   });
}
 
开发者ID:kaiwinter,项目名称:testcontainers-examples,代码行数:33,代码来源:DockerDatabaseTestUtil.java

示例2: init

import org.dbunit.ext.mysql.MySqlDataTypeFactory; //导入依赖的package包/类
@PostConstruct
void init() throws SQLException, DatabaseUnitException {
    new File(root).mkdirs();
    conn = new DatabaseConnection(dataSource.getConnection());
    DatabaseConfig config = conn.getConfig();
    switch (driver) {
        case "com.mysql.jdbc.Driver":
            config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
            break;
        case "org.postgresql.Driver":
            config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
            break;
        default:
            log.info("Not support database: " + driver);
    }
}
 
开发者ID:chonglou,项目名称:itpkg,代码行数:17,代码来源:BackupJob.java

示例3: configDatabaseProperties

import org.dbunit.ext.mysql.MySqlDataTypeFactory; //导入依赖的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;
    }
}
 
开发者ID:database-rider,项目名称:database-rider,代码行数:28,代码来源:RiderDataSource.java

示例4: getConnection

import org.dbunit.ext.mysql.MySqlDataTypeFactory; //导入依赖的package包/类
public IDatabaseConnection getConnection() throws Exception {
    IDatabaseConnection connection = super.getConnection();
    DatabaseConfig config = connection.getConfig();
    config.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, true);
    config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
    return connection;
}
 
开发者ID:MyCollab,项目名称:mycollab,代码行数:8,代码来源:DbUnitInitializerRule.java

示例5: init

import org.dbunit.ext.mysql.MySqlDataTypeFactory; //导入依赖的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

示例6: setupConnections

import org.dbunit.ext.mysql.MySqlDataTypeFactory; //导入依赖的package包/类
@Before
public void setupConnections() throws SQLException, DatabaseUnitException, ClassNotFoundException {
  MysqlDataSource dataSource = new MysqlDataSource();
  dataSource.setURL(System.getProperty("db.url"));
  dataSource.setUser(System.getProperty("db.userid"));
  dataSource.setPassword(System.getProperty("db.password"));
  this.dataSource = dataSource;

  DatabaseConnection databaseConnection = new DatabaseConnection(getDataSource().getConnection());
  databaseConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
  this.databaseConnection = databaseConnection;

  defaultSupport = new DbTestSelectSupport(getDataSource());
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:15,代码来源:DbTestConfiguration.java

示例7: setupConnections

import org.dbunit.ext.mysql.MySqlDataTypeFactory; //导入依赖的package包/类
@Before
public void setupConnections() throws SQLException, DatabaseUnitException, ClassNotFoundException {
  MysqlDataSource dataSource = new MysqlDataSource();
  dataSource.setURL(JDBC_URL);
  dataSource.setUser(DB_USER);
  dataSource.setPassword(DB_PASSWORD);
  this.dataSource = dataSource;

  DatabaseConnection databaseConnection = new DatabaseConnection(getDataSource().getConnection());
  databaseConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
  this.databaseConnection = databaseConnection;

  defaultSelectSupport = new DbTestSelectSupport(getDataSource());
}
 
开发者ID:openmrs,项目名称:openmrs-module-radiology,代码行数:15,代码来源:DbSetupConfiguration.java

示例8: dbUnitDatabaseConfig

import org.dbunit.ext.mysql.MySqlDataTypeFactory; //导入依赖的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

示例9: setUpDatabaseConfig

import org.dbunit.ext.mysql.MySqlDataTypeFactory; //导入依赖的package包/类
@Override
protected void setUpDatabaseConfig(DatabaseConfig config) {
    super.setUpDatabaseConfig(config);
    config.setProperty("http://www.dbunit.org/properties/datatypeFactory", new MySqlDataTypeFactory());
}
 
开发者ID:Fosstrak,项目名称:fosstrak-epcis,代码行数:6,代码来源:FosstrakInteropTestCase.java


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