Search in sources :

Example 56 with EmbeddedDatabaseBuilder

use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project ff4j by ff4j.

the class SpringJdbcPropertyStorePrefixTest method initPropertyStore.

/**
 * {@inheritDoc}
 */
@Override
protected PropertyStore initPropertyStore() {
    builder = new EmbeddedDatabaseBuilder();
    db = builder.setType(// 
    EmbeddedDatabaseType.HSQL).addScript(// 
    "classpath:ddl-prefix-schema.sql").addScript("classpath:ddl-prefix-data.sql").build();
    PropertyStoreSpringJdbc jdbcStore = new PropertyStoreSpringJdbc();
    jdbcStore.setQueryBuilder(new JdbcQueryBuilder("T_FF4J_", "_01"));
    jdbcStore.setDataSource(db);
    return jdbcStore;
}
Also used : PropertyStoreSpringJdbc(org.ff4j.springjdbc.store.PropertyStoreSpringJdbc) JdbcQueryBuilder(org.ff4j.store.JdbcQueryBuilder) EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)

Example 57 with EmbeddedDatabaseBuilder

use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project ff4j by ff4j.

the class SpringJdbcPropertyStoreTest method initPropertyStore.

/**
 * {@inheritDoc}
 */
@Override
protected PropertyStore initPropertyStore() {
    builder = new EmbeddedDatabaseBuilder();
    db = // 
    builder.setType(EmbeddedDatabaseType.HSQL).addScript(// 
    "classpath:schema-ddl.sql").addScript(// 
    "classpath:ff-store.sql").build();
    PropertyStoreSpringJdbc jdbcStore = new PropertyStoreSpringJdbc();
    jdbcStore.setDataSource(db);
    jdbcStore.getJdbcTemplate();
    return jdbcStore;
}
Also used : PropertyStoreSpringJdbc(org.ff4j.springjdbc.store.PropertyStoreSpringJdbc) EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)

Example 58 with EmbeddedDatabaseBuilder

use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project ff4j by ff4j.

the class SpringJdbcStoresCreateSchema method initStore.

/**
 * {@inheritDoc}
 * @throws SQLException
 */
public void initStore() throws SQLException {
    builder = new EmbeddedDatabaseBuilder();
    db = builder.setType(EmbeddedDatabaseType.HSQL).build();
    PreparedStatement prepareStatement = db.getConnection().prepareStatement("CREATE SCHEMA FF4J");
    prepareStatement.executeUpdate();
    prepareStatement = db.getConnection().prepareStatement("CREATE SCHEMA FF4J_2");
    prepareStatement.executeUpdate();
    testedStore = new FeatureStoreSpringJdbc();
    testedStore.setDataSource(db);
    testedStore.getJdbcTemplate();
    propertyStore = new PropertyStoreSpringJdbc();
    propertyStore.setDataSource(db);
    propertyStore.getJdbcTemplate();
}
Also used : PropertyStoreSpringJdbc(org.ff4j.springjdbc.store.PropertyStoreSpringJdbc) EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder) PreparedStatement(java.sql.PreparedStatement) FeatureStoreSpringJdbc(org.ff4j.springjdbc.store.FeatureStoreSpringJdbc)

Example 59 with EmbeddedDatabaseBuilder

use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project ff4j by ff4j.

the class SpringJdbcEventRepositoryTest method initRepository.

/**
 * {@inheritDoc}
 */
@Override
protected EventRepository initRepository() {
    builder = new EmbeddedDatabaseBuilder();
    db = // 
    builder.setType(EmbeddedDatabaseType.HSQL).addScript(// 
    "classpath:schema-ddl.sql").addScript(// 
    "classpath:ff-store.sql").build();
    return new EventRepositorySpringJdbc(db);
}
Also used : EventRepositorySpringJdbc(org.ff4j.springjdbc.store.EventRepositorySpringJdbc) EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)

Example 60 with EmbeddedDatabaseBuilder

use of org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder in project ff4j by ff4j.

the class SpringJdbcFeatureStoreTest method initStore.

/**
 * {@inheritDoc}
 */
@Override
protected FeatureStore initStore() {
    builder = new EmbeddedDatabaseBuilder();
    db = // 
    builder.setType(EmbeddedDatabaseType.HSQL).addScript(// 
    "classpath:schema-ddl.sql").addScript(// 
    "classpath:ff-store.sql").build();
    FeatureStoreSpringJdbc jdbcStore = new FeatureStoreSpringJdbc();
    jdbcStore.setDataSource(db);
    jdbcStore.getJdbcTemplate();
    return jdbcStore;
}
Also used : EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder) FeatureStoreSpringJdbc(org.ff4j.springjdbc.store.FeatureStoreSpringJdbc)

Aggregations

EmbeddedDatabaseBuilder (org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)67 Before (org.junit.Before)17 JdbcTemplate (org.springframework.jdbc.core.JdbcTemplate)15 EmbeddedDatabase (org.springframework.jdbc.datasource.embedded.EmbeddedDatabase)15 JndiRegistry (org.apache.camel.impl.JndiRegistry)11 Bean (org.springframework.context.annotation.Bean)9 JdbcPropertyStore (org.ff4j.property.store.JdbcPropertyStore)5 FeatureStoreSpringJdbc (org.ff4j.springjdbc.store.FeatureStoreSpringJdbc)5 JdbcFeatureStore (org.ff4j.store.JdbcFeatureStore)5 JdbcQueryBuilder (org.ff4j.store.JdbcQueryBuilder)4 Test (org.junit.Test)4 PropertyStoreSpringJdbc (org.ff4j.springjdbc.store.PropertyStoreSpringJdbc)3 BeforeClass (org.junit.BeforeClass)3 Test (org.junit.jupiter.api.Test)3 PreparedStatement (java.sql.PreparedStatement)2 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)2 JdbcEventRepository (org.ff4j.audit.repository.JdbcEventRepository)2 Connection (java.sql.Connection)1 Map (java.util.Map)1 Properties (java.util.Properties)1