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


Java HsqldbDataTypeFactory类代码示例

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


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

示例1: initEntityManager

import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; //导入依赖的package包/类
/**
 * Set up memory database and insert data from test-dataset.xml
 * 
 * @throws DatabaseUnitException
 * @throws HibernateException
 * @throws SQLException
 */
@BeforeClass
public static void initEntityManager() throws HibernateException, DatabaseUnitException, SQLException {
    entityManagerFactory = Persistence.createEntityManagerFactory("listing-test-db");
    entityManager = entityManagerFactory.createEntityManager();
    connection = new DatabaseConnection(((SessionImpl) (entityManager.getDelegate())).connection());
    connection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());

    InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(datasetXml);
    if (inputStream != null) {
        FlatXmlDataSetBuilder flatXmlDataSetBuilder = new FlatXmlDataSetBuilder();
        flatXmlDataSetBuilder.setColumnSensing(true);
        dataset = flatXmlDataSetBuilder.build(inputStream);
        DatabaseOperation.CLEAN_INSERT.execute(connection, dataset);
    }
}
 
开发者ID:coodoo-io,项目名称:coodoo-listing,代码行数:23,代码来源:AbstractDbUnitTest.java

示例2: getConnection

import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; //导入依赖的package包/类
protected IDatabaseConnection getConnection() throws Exception
    {
        Configuration cfg = getHibernateConfiguration();
        String username = cfg.getProperty( "hibernate.connection.username" );
        String password = cfg.getProperty( "hibernate.connection.password" );
        String driver = cfg.getProperty( "hibernate.connection.driver_class" );
        String url = cfg.getProperty( "hibernate.connection.url" );

        Class.forName( driver );

        Connection jdbcConnection = DriverManager.getConnection( url, username, password );
        
        IDatabaseConnection connection =  new DatabaseConnection(jdbcConnection);
        DatabaseConfig config = connection.getConfig();
//        config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new H2DataTypeFactory());
        config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());
      
        return connection;
    }
 
开发者ID:strator-dev,项目名称:greenpepper,代码行数:20,代码来源:AbstractDBUnitHibernateMemoryTest.java

示例3: getConnection

import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; //导入依赖的package包/类
protected IDatabaseConnection getConnection() throws Exception {
    Properties cfg = getHibernateConfiguration();
    String username = cfg.getProperty("hibernate.connection.username");
    String password = cfg.getProperty("hibernate.connection.password");
    String driver = cfg.getProperty("hibernate.connection.driver_class");
    String url = cfg.getProperty("hibernate.connection.url");

    Class.forName(driver);

    Connection jdbcConnection = DriverManager.getConnection(url, username, password);

    IDatabaseConnection connection = new DatabaseConnection(jdbcConnection);
    DatabaseConfig config = connection.getConfig();
    // config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new
    // H2DataTypeFactory());
    config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());

    return connection;
}
 
开发者ID:testIT-LivingDoc,项目名称:livingdoc-confluence,代码行数:20,代码来源:AbstractDBUnitHibernateMemoryTest.java

示例4: compareTables

import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; //导入依赖的package包/类
public void compareTables(String expectedDatasetFileName, String... tableNames) throws Exception {
	JdbcDatabaseTester jdbc = new JdbcDatabaseTester("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:./db/example-db;ifexists=true;shutdown=true;", "sa", "");
	IDatabaseConnection connection = jdbc.getConnection();
	
	DatabaseConfig config = connection.getConfig();
	config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());
	
	IDataSet databaseDataSet = connection.createDataSet();
	IDataSet expectedDataSet = new FlatXmlDataFileLoader().load(expectedDatasetFileName);
	
	for (String tableName : tableNames) {
		ITable actualTable = databaseDataSet.getTable(tableName);
		ITable expectedTable = expectedDataSet.getTable(tableName);
		Assertion.assertEquals(expectedTable, actualTable);
	}
}
 
开发者ID:EsfingeFramework,项目名称:querybuilder,代码行数:17,代码来源:DataBaseCommunicator.java

示例5: createConnection

import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; //导入依赖的package包/类
/**
 * Geeft een door DBUnit gewrapte connectie terug naar de testdatabase.
 * @return Een DBUnit {@link IDatabaseConnection} naar de testdatabase.
 * @throws SQLException on error
 * @throws DatabaseUnitException on error
 */
public IDatabaseConnection createConnection() throws DatabaseUnitException, SQLException {
    final IDatabaseConnection connection = new DatabaseConnection(createSqlConnection());
    final DatabaseConfig config = connection.getConfig();
    config.setProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, Boolean.TRUE);
    config.setProperty(DatabaseConfig.FEATURE_BATCHED_STATEMENTS, Boolean.TRUE);
    config.setProperty(DatabaseConfig.PROPERTY_BATCH_SIZE, INT_5000);
    if (inMemory) {
        config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());
    } else {
        config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
    }
    return connection;
}
 
开发者ID:MinBZK,项目名称:OperatieBRP,代码行数:20,代码来源:AbstractDBUnitUtil.java

示例6: configDatabaseProperties

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

示例7: initEntityManager

import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; //导入依赖的package包/类
@BeforeClass
public static void initEntityManager() throws HibernateException, DatabaseUnitException {
	entityManagerFactory = Persistence.createEntityManagerFactory("com.infinities.keystone4j.jpa.test");
	entityManager = entityManagerFactory.createEntityManager();
	connection = new DatabaseConnection(((SessionImpl) (entityManager.getDelegate())).connection());
	connection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());

	FlatXmlDataSetBuilder flatXmlDataSetBuilder = new FlatXmlDataSetBuilder();
	flatXmlDataSetBuilder.setColumnSensing(true);
	InputStream dataSet = Thread.currentThread().getContextClassLoader().getResourceAsStream("test-data.xml");
	dataset = flatXmlDataSetBuilder.build(dataSet);
	EntityManagerListener.setEntityManagerFactory(entityManagerFactory);
}
 
开发者ID:infinitiessoft,项目名称:keystone4j,代码行数:14,代码来源:AbstractIntegratedTest.java

示例8: initializeDatabase

import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; //导入依赖的package包/类
protected void initializeDatabase(String filename) throws ClassNotFoundException, Exception {
	jdt = new JdbcDatabaseTester("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:./db/example-db", "sa", "");

	TestEntityManagerProvider provider = new TestEntityManagerProvider();
	provider.getEntityManagerFactory();
	
	DatabaseConfig config = jdt.getConnection().getConfig();
	config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());
	
	DataFileLoader loader = new FlatXmlDataFileLoader();
	IDataSet dataSet = loader.load(filename);
	jdt.setDataSet(dataSet);
	jdt.onSetup();
}
 
开发者ID:EsfingeFramework,项目名称:querybuilder,代码行数:15,代码来源:QueryBuilderDatabaseTest.java

示例9: compareTables

import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; //导入依赖的package包/类
protected void compareTables(String expectedDatasetFileName, String... tableNames) throws Exception {
	IDatabaseConnection connection = jdt.getConnection();
	
	DatabaseConfig config = connection.getConfig();
	config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());
	
	IDataSet databaseDataSet = connection.createDataSet();
	IDataSet expectedDataSet = new FlatXmlDataFileLoader().load(expectedDatasetFileName);
	for (String tableName : tableNames) {
		ITable actualTable = databaseDataSet.getTable(tableName);
		ITable expectedTable = expectedDataSet.getTable(tableName);
		Assertion.assertEquals(expectedTable, actualTable);
	}
}
 
开发者ID:EsfingeFramework,项目名称:querybuilder,代码行数:15,代码来源:QueryBuilderDatabaseTest.java

示例10: initializeDatabase

import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; //导入依赖的package包/类
public void initializeDatabase(String filename) throws ClassNotFoundException, Exception {
	jdt = new JdbcDatabaseTester("org.hsqldb.jdbcDriver", "jdbc:hsqldb:file:./db/example-db;ifexists=true;shutdown=true;", "sa", "");

	DatabaseConfig config = jdt.getConnection().getConfig();
	config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());

	DataFileLoader loader = new FlatXmlDataFileLoader();
	IDataSet dataSet = loader.load(filename);
	jdt.setDataSet(dataSet);
	jdt.onSetup();
}
 
开发者ID:EsfingeFramework,项目名称:querybuilder,代码行数:12,代码来源:DataBaseCommunicator.java

示例11: buildDbUnitTypeFactory

import org.dbunit.ext.hsqldb.HsqldbDataTypeFactory; //导入依赖的package包/类
protected DefaultDataTypeFactory buildDbUnitTypeFactory() {
	return new HsqldbDataTypeFactory();
}
 
开发者ID:daniel-a-melo,项目名称:jorm-unit,代码行数:4,代码来源:JPATest.java


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