Search in sources :

Example 1 with EmbeddedDatabaseType

use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType in project solarnetwork-node by SolarNetwork.

the class TestEmbeddedDatabaseFactoryBean method getObject.

@Override
public TestEmbeddedDatabase getObject() throws Exception {
    if (db != null) {
        return db;
    }
    loadEnvironmentProperties();
    EmbeddedDatabaseType dbType = dbType();
    EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder().generateUniqueName(true).setType(dbType);
    this.db = new SimpleTestEmbeddedDatabase(builder.build(), dbType);
    if (dbType == EmbeddedDatabaseType.DERBY) {
        TestDbUtils.setupDerbyFunctions(new JdbcTemplate(db));
    }
    return this.db;
}
Also used : EmbeddedDatabaseType(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType) EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder) JdbcTemplate(org.springframework.jdbc.core.JdbcTemplate)

Aggregations

JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)1 EmbeddedDatabaseBuilder (org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)1 EmbeddedDatabaseType (org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType)1