org.dbunit.database.DatabaseConfig Java Examples

The following examples show how to use org.dbunit.database.DatabaseConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShardingJdbcDatabaseTester.java    From sharding-jdbc-1.5.1 with Apache License 2.0 6 votes vote down vote up
@Override
public IDatabaseConnection getConnection() throws Exception {
    IDatabaseConnection result = super.getConnection();
    DatabaseConfig dbConfig = result.getConfig();
    dbConfig.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, false);
    dbConfig.setProperty(DatabaseConfig.FEATURE_DATATYPE_WARNING, false);
    if ("org.h2.Driver".equals(driverClass)) {
        dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new H2DataTypeFactory());
    } else if ("com.mysql.jdbc.Driver".equals(driverClass)) {
        dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
    } else if ("org.postgresql.Driver".equals(driverClass)) {
        dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());
    } else if ("oracle.jdbc.driver.OracleDriver".equals(driverClass)) {
        dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new Oracle10DataTypeFactory());
    } else if ("com.microsoft.sqlserver.jdbc.SQLServerDriver".equals(driverClass)) {
        dbConfig.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MsSqlDataTypeFactory());
        
    }
    return result;
}
 
Example #2
Source File: AbstractDBUnitHibernateMemoryTest.java    From livingdoc-confluence with GNU General Public License v3.0 6 votes vote down vote up
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;
}
 
Example #3
Source File: MySqlConnectionFactoryTest.java    From jpa-unit with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateConnection() throws DatabaseUnitException {
    // GIVEN
    final String schema = "foo";

    // WHEN
    final IDatabaseConnection dbConnection = FACTORY.createConnection(connection, schema);

    // THEN
    assertThat(dbConnection, notNullValue());

    final Object typeFactory = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
    assertThat(typeFactory, notNullValue());
    assertThat(typeFactory.getClass(), equalTo(MySqlDataTypeFactory.class));

    final Object metadataHandler = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER);
    assertThat(metadataHandler, notNullValue());
    assertThat(metadataHandler.getClass(), equalTo(MySqlMetadataHandler.class));

    assertThat(dbConnection.getSchema(), equalTo(schema));
}
 
Example #4
Source File: HsqldbConnectionFactoryTest.java    From jpa-unit with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateConnection() throws DatabaseUnitException {
    // GIVEN
    final String schema = "foo";

    // WHEN
    final IDatabaseConnection dbConnection = FACTORY.createConnection(connection, schema);

    // THEN
    assertThat(dbConnection, notNullValue());

    final Object typeFactory = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
    assertThat(typeFactory, notNullValue());
    assertThat(typeFactory.getClass(), equalTo(HsqldbDataTypeFactory.class));

    assertThat(dbConnection.getSchema(), equalTo(schema));
}
 
Example #5
Source File: MsSqlConnectionFactoryTest.java    From jpa-unit with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateConnection() throws DatabaseUnitException {
    // GIVEN
    final String schema = "foo";

    // WHEN
    final IDatabaseConnection dbConnection = FACTORY.createConnection(connection, schema);

    // THEN
    assertThat(dbConnection, notNullValue());

    final Object typeFactory = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
    assertThat(typeFactory, notNullValue());
    assertThat(typeFactory.getClass(), equalTo(MsSqlDataTypeFactory.class));

    assertThat(dbConnection.getSchema(), equalTo(schema));
}
 
Example #6
Source File: McKoiConnectionFactoryTest.java    From jpa-unit with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateConnection() throws DatabaseUnitException {
    // GIVEN
    final String schema = "foo";

    // WHEN
    final IDatabaseConnection dbConnection = FACTORY.createConnection(connection, schema);

    // THEN
    assertThat(dbConnection, notNullValue());

    final Object typeFactory = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
    assertThat(typeFactory, notNullValue());
    assertThat(typeFactory.getClass(), equalTo(MckoiDataTypeFactory.class));

    assertThat(dbConnection.getSchema(), equalTo(schema));
}
 
Example #7
Source File: Db2ConnectionFactoryTest.java    From jpa-unit with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateConnection() throws Exception {
    // GIVEN
    final String schema = "foo";

    // WHEN
    final IDatabaseConnection dbConnection = FACTORY.createConnection(connection, schema);

    // THEN
    assertThat(dbConnection, notNullValue());

    final Object typeFactory = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
    assertThat(typeFactory, notNullValue());
    assertThat(typeFactory.getClass(), equalTo(Db2DataTypeFactory.class));

    final Object metadataHandler = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER);
    assertThat(metadataHandler, notNullValue());
    assertThat(metadataHandler.getClass(), equalTo(Db2MetadataHandler.class));

    assertThat(dbConnection.getSchema(), equalTo(schema));
}
 
Example #8
Source File: H2ConnectionFactoryTest.java    From jpa-unit with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateConnection() throws DatabaseUnitException {
    // GIVEN
    final String schema = "foo";

    // WHEN
    final IDatabaseConnection dbConnection = FACTORY.createConnection(connection, schema);

    // THEN
    assertThat(dbConnection, notNullValue());

    final Object typeFactory = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
    assertThat(typeFactory, notNullValue());
    assertThat(typeFactory.getClass(), equalTo(H2DataTypeFactory.class));

    assertThat(dbConnection.getSchema(), equalTo(schema));
}
 
Example #9
Source File: NetezzaConnectionFactoryTest.java    From jpa-unit with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateConnection() throws DatabaseUnitException {
    // GIVEN
    final String schema = "foo";

    // WHEN
    final IDatabaseConnection dbConnection = FACTORY.createConnection(connection, schema);

    // THEN
    assertThat(dbConnection, notNullValue());

    final Object typeFactory = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
    assertThat(typeFactory, notNullValue());
    assertThat(typeFactory.getClass(), equalTo(NetezzaDataTypeFactory.class));

    final Object metadataHandler = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER);
    assertThat(metadataHandler, notNullValue());
    assertThat(metadataHandler.getClass(), equalTo(NetezzaMetadataHandler.class));

    assertThat(dbConnection.getSchema(), equalTo(schema));
}
 
Example #10
Source File: Oracle10ConnectionFactoryTest.java    From jpa-unit with Apache License 2.0 6 votes vote down vote up
@Test
@Ignore("oracle jdbc required in classpath")
public void testCreateConnection() throws DatabaseUnitException, SQLException {
    // GIVEN
    final String schema = "foo";

    // WHEN
    final IDatabaseConnection dbConnection = FACTORY.createConnection(connection, schema);

    // THEN
    assertThat(dbConnection, notNullValue());

    final Object typeFactory = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
    assertThat(typeFactory, notNullValue());
    assertThat(typeFactory.getClass(), equalTo(Oracle10DataTypeFactory.class));

    assertThat(dbConnection.getSchema(), equalTo(schema));
}
 
Example #11
Source File: PostgresqlConnectionFactoryTest.java    From jpa-unit with Apache License 2.0 6 votes vote down vote up
@Test
public void testCreateConnection() throws DatabaseUnitException {
    // GIVEN
    final String schema = "foo";

    // WHEN
    final IDatabaseConnection dbConnection = FACTORY.createConnection(connection, schema);

    // THEN
    assertThat(dbConnection, notNullValue());

    final Object typeFactory = dbConnection.getConfig().getProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY);
    assertThat(typeFactory, notNullValue());
    assertThat(typeFactory.getClass(), not(equalTo(DefaultDataTypeFactory.class)));

    assertThat(dbConnection.getSchema(), equalTo(schema));
}
 
Example #12
Source File: RiderDataSource.java    From database-rider with Apache License 2.0 6 votes vote down vote up
private void configDatabaseProperties() {
    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());
        }
    }

    if (!dbUnitConfig.getProperties().containsKey("datatypeFactory")) {
        IDataTypeFactory dataTypeFactory = getDataTypeFactory(dbType);
        if (dataTypeFactory != null) {
            config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, dataTypeFactory);
        }
    }
    if (!dbUnitConfig.getProperties().containsKey("metadataHandler")) {
        IMetadataHandler metadataHandler = getMetadataHandler(dbType);
        if (metadataHandler != null) {
            config.setProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER, metadataHandler);
        }
    }

}
 
Example #13
Source File: DbUnitSupport.java    From proarc with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #14
Source File: KylinTestBase.java    From kylin with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
protected static H2Connection newH2Connection() throws DatabaseUnitException {
    H2Connection h2Conn = new H2Connection(h2Connection, null);
    h2Conn.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new TestH2DataTypeFactory());
    h2Conn.getConfig().setFeature(DatabaseConfig.FEATURE_DATATYPE_WARNING, false);
    return h2Conn;
}
 
Example #15
Source File: AbstractModelTest.java    From pnc with Apache License 2.0 5 votes vote down vote up
/**
 * Inserts data into database from the dbunit XML file
 * 
 * @param em Entity manager
 * @param datasetPath Path to DBunit dataset file
 * @throws Exception Thrown in case of any error during the operation
 */
protected void initDatabaseUsingDataset(EntityManager em, String datasetPath) throws Exception {
    IDatabaseConnection connection = new DatabaseConnection(em.unwrap(SessionImpl.class).connection());
    connection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new HsqldbDataTypeFactory());
    FlatXmlDataSetBuilder flatXmlDataSetBuilder = new FlatXmlDataSetBuilder();
    flatXmlDataSetBuilder.setColumnSensing(true);
    InputStream dataSetStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(datasetPath);
    IDataSet dataSet = flatXmlDataSetBuilder.build(dataSetStream);
    DatabaseOperation.INSERT.execute(connection, dataSet);
}
 
Example #16
Source File: KylinTestBase.java    From Kylin with Apache License 2.0 5 votes vote down vote up
protected void execQueryUsingH2(String queryFolder, boolean needSort) throws Exception {
    printInfo("---------- Running H2 queries: " + queryFolder);

    List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
    for (File sqlFile : sqlFiles) {
        String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
        String sql = getTextFromFile(sqlFile);

        // execute H2
        printInfo("Query Result from H2 - " + queryName);
        H2Connection h2Conn = new H2Connection(h2Connection, null);
        h2Conn.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new TestH2DataTypeFactory());
        executeQuery(h2Conn, queryName, sql, needSort);
    }
}
 
Example #17
Source File: KylinTestBase.java    From Kylin with Apache License 2.0 5 votes vote down vote up
protected void execAndCompQuery(String queryFolder, String[] exclusiveQuerys, boolean needSort) throws Exception {
    printInfo("---------- test folder: " + queryFolder);
    Set<String> exclusiveSet = buildExclusiveSet(exclusiveQuerys);

    List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
    for (File sqlFile : sqlFiles) {
        String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
        if (exclusiveSet.contains(queryName)) {
            continue;
        }
        String sql = getTextFromFile(sqlFile);

        // execute Kylin
        printInfo("Query Result from Kylin - " + queryName + "  (" + queryFolder + ")");
        IDatabaseConnection kylinConn = new DatabaseConnection(cubeConnection);
        ITable kylinTable = executeQuery(kylinConn, queryName, sql, needSort);

        // execute H2
        printInfo("Query Result from H2 - " + queryName);
        H2Connection h2Conn = new H2Connection(h2Connection, null);
        h2Conn.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new TestH2DataTypeFactory());
        ITable h2Table = executeQuery(h2Conn, queryName, sql, needSort);

        // compare the result
        Assertion.assertEquals(h2Table, kylinTable);

        compQueryCount++;
        if (kylinTable.getRowCount() == 0) {
            zeroResultQueries.add(sql);
        }
    }
}
 
Example #18
Source File: KylinTestBase.java    From Kylin with Apache License 2.0 5 votes vote down vote up
protected void execAndCompDynamicQuery(String queryFolder, String[] exclusiveQuerys, boolean needSort) throws Exception {
    printInfo("---------- test folder: " + queryFolder);
    Set<String> exclusiveSet = buildExclusiveSet(exclusiveQuerys);

    List<File> sqlFiles = getFilesFromFolder(new File(queryFolder), ".sql");
    for (File sqlFile : sqlFiles) {
        String queryName = StringUtils.split(sqlFile.getName(), '.')[0];
        if (exclusiveSet.contains(queryName)) {
            continue;
        }
        String sql = getTextFromFile(sqlFile);
        List<String> parameters = getParameterFromFile(sqlFile);

        // execute Kylin
        printInfo("Query Result from Kylin - " + queryName + "  (" + queryFolder + ")");
        IDatabaseConnection kylinConn = new DatabaseConnection(cubeConnection);
        ITable kylinTable = executeDynamicQuery(kylinConn, queryName, sql, parameters, needSort);

        // execute H2
        printInfo("Query Result from H2 - " + queryName);
        IDatabaseConnection h2Conn = new DatabaseConnection(h2Connection);
        h2Conn.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new TestH2DataTypeFactory());
        ITable h2Table = executeDynamicQuery(h2Conn, queryName, sql, parameters, needSort);

        // compare the result
        Assertion.assertEquals(h2Table, kylinTable);
    }
}
 
Example #19
Source File: DbUnitUtil.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
    DataSource dataSource = new DataSourceFactoryBean().getDataSource();
    File file = new File("src/main/resources/mycollab.dtd");
    IDatabaseConnection connection = new DatabaseDataSourceConnection(dataSource);
    connection.getConfig().setProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, true);
    // write DTD file
    FlatDtdDataSet.write(connection.createDataSet(), new FileOutputStream(file));
}
 
Example #20
Source File: DbUnitInitializerRule.java    From mycollab with GNU Affero General Public License v3.0 5 votes vote down vote up
public IDatabaseConnection getConnection() throws Exception {
            IDatabaseConnection connection = super.getConnection();
            DatabaseConfig config = connection.getConfig();
            config.setProperty(DatabaseConfig.FEATURE_CASE_SENSITIVE_TABLE_NAMES, false);
//            config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new MySqlDataTypeFactory());
            return connection;
        }
 
Example #21
Source File: SingleDBBaseTestCase.java    From Zebra with Apache License 2.0 5 votes vote down vote up
protected DatabaseOperation getTearDownOperation() throws Exception {
	return new DatabaseOperation() {

		@Override
		public void execute(IDatabaseConnection connection, IDataSet dataSet)
				throws DatabaseUnitException, SQLException {

			DatabaseConfig databaseConfig = connection.getConfig();
			IStatementFactory statementFactory = (IStatementFactory) databaseConfig
					.getProperty(DatabaseConfig.PROPERTY_STATEMENT_FACTORY);
			IBatchStatement statement = statementFactory.createBatchStatement(connection);

			try {
				int count = 0;
				for (SingleCreateTableScriptEntry entry : createdTableList) {
					statement.addBatch("drop table " + entry.getTableName());
					count++;
				}

				if (count > 0) {
					statement.executeBatch();
					statement.clearBatch();
				}
			} finally {
				statement.close();
			}

		}
	};
}
 
Example #22
Source File: SingleDBBaseTestCase.java    From Zebra with Apache License 2.0 5 votes vote down vote up
protected DatabaseOperation getSetUpOperation() throws Exception {
	parseCreateTableScriptFile();

	initSpringContext();

	return new CompositeOperation(new DatabaseOperation[] { new DatabaseOperation() {

		@Override
		public void execute(IDatabaseConnection connection, IDataSet dataSet)
				throws DatabaseUnitException, SQLException {

			DatabaseConfig databaseConfig = connection.getConfig();
			IStatementFactory statementFactory = (IStatementFactory) databaseConfig
					.getProperty(DatabaseConfig.PROPERTY_STATEMENT_FACTORY);
			IBatchStatement statement = statementFactory.createBatchStatement(connection);
			try {
				int count = 0;
				for (SingleCreateTableScriptEntry entry : createdTableList) {
					statement.addBatch(entry.getCreateTableScript());
					count++;
				}

				if (count > 0) {
					statement.executeBatch();
					statement.clearBatch();
				}
			} finally {
				statement.close();
			}
		}
	}, DatabaseOperation.CLEAN_INSERT });
}
 
Example #23
Source File: DbUnitConfigurationLoaderTest.java    From jpa-unit with Apache License 2.0 5 votes vote down vote up
@Test
public void testLoadingConfigurationGivenAnExistingFile() throws MalformedURLException {
    // GIVEN
    final URL url = existingConfigFile.toURI().toURL();

    // WHEN
    final Properties configuration = DbUnitConfigurationLoader.loadConfiguration(url);

    // THEN
    assertThat(configuration.getProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES), equalTo("true"));
    assertThat(configuration.getProperty(DatabaseConfig.PROPERTY_BATCH_SIZE), equalTo("1000"));
    assertThat(configuration.keySet().size(), equalTo(2));
}
 
Example #24
Source File: DbUnitConfigurationLoaderTest.java    From jpa-unit with Apache License 2.0 5 votes vote down vote up
@Before
public void createDbUnitConfiguration() throws IOException {
    existingConfigFile = tmp.newFile();
    notExistingConfigFile = new File(UUID.randomUUID().toString());

    expectedConfig = new Properties();
    expectedConfig.setProperty(DatabaseConfig.FEATURE_QUALIFIED_TABLE_NAMES, "true");
    expectedConfig.setProperty(DatabaseConfig.PROPERTY_BATCH_SIZE, "1000");

    try (FileOutputStream out = new FileOutputStream(existingConfigFile)) {
        expectedConfig.store(out, "dbunit config");
    }
}
 
Example #25
Source File: PostgresqlConnectionFactory.java    From jpa-unit with Apache License 2.0 5 votes vote down vote up
@Override
public IDatabaseConnection createConnection(final Connection connection, final String schema) throws DatabaseUnitException {
    final IDatabaseConnection dbUnitConnection = new DatabaseConnection(connection, schema);

    dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new PostgresqlDataTypeFactory());

    return dbUnitConnection;
}
 
Example #26
Source File: Oracle10ConnectionFactory.java    From jpa-unit with Apache License 2.0 5 votes vote down vote up
@Override
public IDatabaseConnection createConnection(final Connection connection, final String schema) throws DatabaseUnitException {
    final DatabaseConnection dbUnitConnection = new DatabaseConnection(connection, schema);

    dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new Oracle10DataTypeFactory());

    return dbUnitConnection;
}
 
Example #27
Source File: NetezzaConnectionFactory.java    From jpa-unit with Apache License 2.0 5 votes vote down vote up
@Override
public IDatabaseConnection createConnection(final Connection connection, final String schema) throws DatabaseUnitException {
    final IDatabaseConnection dbUnitConnection = new DatabaseConnection(connection, schema);

    dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new NetezzaDataTypeFactory());
    dbUnitConnection.getConfig().setProperty(DatabaseConfig.PROPERTY_METADATA_HANDLER, new NetezzaMetadataHandler());

    return dbUnitConnection;
}
 
Example #28
Source File: KylinTestBase.java    From kylin-on-parquet-v2 with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("deprecation")
protected static H2Connection newH2Connection() throws DatabaseUnitException {
    H2Connection h2Conn = new H2Connection(h2Connection, null);
    h2Conn.getConfig().setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new TestH2DataTypeFactory());
    h2Conn.getConfig().setFeature(DatabaseConfig.FEATURE_DATATYPE_WARNING, false);
    return h2Conn;
}
 
Example #29
Source File: SingleDBBaseTestCase.java    From Zebra with Apache License 2.0 4 votes vote down vote up
@Override
protected void setUpDatabaseConfig(DatabaseConfig config) {
	config.setProperty(DatabaseConfig.PROPERTY_DATATYPE_FACTORY, new H2DataTypeFactory());
}
 
Example #30
Source File: AbstractRuleImplementationTestCase.java    From Asqatasun with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Override method to set custom properties/features {@inheritDoc}
 * @param config
 */
@Override
protected void setUpDatabaseConfig(DatabaseConfig config) {
    super.setUpDatabaseConfig(config);
    config.setProperty(DatabaseConfig.PROPERTY_BATCH_SIZE, 97);
}