本文整理汇总了Java中org.dbunit.ext.postgresql.PostgresqlDataTypeFactory类的典型用法代码示例。如果您正苦于以下问题:Java PostgresqlDataTypeFactory类的具体用法?Java PostgresqlDataTypeFactory怎么用?Java PostgresqlDataTypeFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PostgresqlDataTypeFactory类属于org.dbunit.ext.postgresql包,在下文中一共展示了PostgresqlDataTypeFactory类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createConnection
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory; //导入依赖的package包/类
@Override
public IDatabaseConnection createConnection(final Connection connection) throws DatabaseUnitException {
final IDatabaseConnection dbUnitConnection = new DatabaseConnection(connection);
dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
return dbUnitConnection;
}
示例2: init
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory; //导入依赖的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);
}
}
示例3: connectionRetrieved
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory; //导入依赖的package包/类
@Override
public void connectionRetrieved(final IDatabaseConnection connection) {
final DatabaseConfig config = connection.getConfig();
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
config.setProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, true);
config.setProperty(DatabaseConfig.PROPERTY_BATCH_SIZE, 300);
config.setProperty(DatabaseConfig.FEATURE_BATCHED_STATEMENTS, true);
}
示例4: createConnection
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory; //导入依赖的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;
}
示例5: configDatabaseProperties
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory; //导入依赖的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;
}
}
示例6: createProgresConnection
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory; //导入依赖的package包/类
private IDatabaseConnection createProgresConnection(Connection c) throws DatabaseUnitException {
DatabaseConnection dbc = new DatabaseConnection(c);
DatabaseConfig config = dbc.getConfig();
config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
// Progress cannot handle columns names like XML thus we have to escape them.
config.setProperty(DatabaseConfig.PROPERTY_ESCAPE_PATTERN, "\"?\"");
config.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, false);
return dbc;
}
示例7: create
import org.dbunit.ext.postgresql.PostgresqlDataTypeFactory; //导入依赖的package包/类
@Override
public IDatabaseConnection create() {
try {
IDatabaseConnection dbUnitConn = new DatabaseConnection(getConnection());
dbUnitConn.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
return dbUnitConn;
} catch (DatabaseUnitException e) {
throw new IllegalStateException(
"It's not possible to create a PostgreSql DbUnit connection: "
+ e.getMessage(), e);
}
}