Search in sources :

Example 11 with JdbcPropertyStore

use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.

the class JdbcPropertyStoreErrorTest method testgetReadAll.

@Test(expected = PropertyAccessException.class)
public void testgetReadAll() throws SQLException {
    DataSource mockDS = Mockito.mock(DataSource.class);
    doThrow(new SQLException()).when(mockDS).getConnection();
    JdbcPropertyStore jrepo = new JdbcPropertyStore(mockDS);
    jrepo.setDataSource(mockDS);
    jrepo.readAllProperties();
}
Also used : SQLException(java.sql.SQLException) JdbcPropertyStore(org.ff4j.property.store.JdbcPropertyStore) DataSource(javax.sql.DataSource) Test(org.junit.Test)

Example 12 with JdbcPropertyStore

use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.

the class JdbcPropertyStoreSchemaTest method initStore.

/**
 * {@inheritDoc}
 */
public void initStore() {
    builder = new EmbeddedDatabaseBuilder();
    db = builder.setType(EmbeddedDatabaseType.HSQL).build();
    testedStore = new JdbcPropertyStore();
    testedStore.setDataSource(db);
}
Also used : EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder) JdbcPropertyStore(org.ff4j.property.store.JdbcPropertyStore)

Example 13 with JdbcPropertyStore

use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.

the class JdbcPropertyStoreTest method testClear.

@Test
public void testClear() {
    EmbeddedDatabaseBuilder b2 = new EmbeddedDatabaseBuilder();
    EmbeddedDatabase db2 = // 
    b2.setType(EmbeddedDatabaseType.HSQL).build();
    JdbcPropertyStore jdbcStore2 = new JdbcPropertyStore(db2, "ff4j.xml");
    Assert.assertNotNull(jdbcStore2);
}
Also used : EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder) EmbeddedDatabase(org.springframework.jdbc.datasource.embedded.EmbeddedDatabase) JdbcPropertyStore(org.ff4j.property.store.JdbcPropertyStore) Test(org.junit.Test)

Example 14 with JdbcPropertyStore

use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.

the class JdbcPropertyStoreTest 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();
    return new JdbcPropertyStore(db);
}
Also used : EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder) JdbcPropertyStore(org.ff4j.property.store.JdbcPropertyStore)

Aggregations

JdbcPropertyStore (org.ff4j.property.store.JdbcPropertyStore)14 Test (org.junit.Test)11 SQLException (java.sql.SQLException)9 DataSource (javax.sql.DataSource)9 EmbeddedDatabaseBuilder (org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)5 EmbeddedDatabase (org.springframework.jdbc.datasource.embedded.EmbeddedDatabase)2 PropertyString (org.ff4j.property.PropertyString)1 JdbcQueryBuilder (org.ff4j.store.JdbcQueryBuilder)1