use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.
the class JdbcPropertyStoreErrorTest method testCreateKO.
@Test(expected = PropertyAccessException.class)
public void testCreateKO() throws SQLException {
DataSource mockDS = Mockito.mock(DataSource.class);
doThrow(new SQLException()).when(mockDS).getConnection();
JdbcPropertyStore jrepo = new JdbcPropertyStore(mockDS);
jrepo.setDataSource(mockDS);
jrepo.createProperty(new PropertyString("p1", "v1"));
}
use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.
the class JdbcPropertyStoreErrorTest method testUpdateKO2.
@Test(expected = PropertyAccessException.class)
public void testUpdateKO2() throws SQLException {
DataSource mockDS = Mockito.mock(DataSource.class);
doThrow(new SQLException()).when(mockDS).getConnection();
JdbcPropertyStore jrepo = new JdbcPropertyStore(mockDS);
jrepo.setDataSource(mockDS);
jrepo.updateProperty("p1", "v1");
}
use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.
the class JdbcPropertyStoreErrorTest method testgetExistKO.
@Test(expected = PropertyAccessException.class)
public void testgetExistKO() throws SQLException {
DataSource mockDS = Mockito.mock(DataSource.class);
doThrow(new SQLException()).when(mockDS).getConnection();
JdbcPropertyStore jrepo = new JdbcPropertyStore(mockDS);
jrepo.setDataSource(mockDS);
jrepo.existProperty("xx");
}
use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.
the class JdbcPropertyStorePrefixTest 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();
JdbcPropertyStore jdbcStore = new JdbcPropertyStore();
jdbcStore.setQueryBuilder(new JdbcQueryBuilder("T_FF4J_", "_01"));
jdbcStore.setDataSource(db);
return jdbcStore;
}
use of org.ff4j.property.store.JdbcPropertyStore in project ff4j by ff4j.
the class JdbcPropertyStoreTest method initJdbcPropertyStore.
@Test
public void initJdbcPropertyStore() {
EmbeddedDatabaseBuilder b2 = new EmbeddedDatabaseBuilder();
EmbeddedDatabase db2 = //
b2.setType(EmbeddedDatabaseType.HSQL).build();
JdbcPropertyStore jdbcStore2 = new JdbcPropertyStore(db2, "ff4j.xml");
Assert.assertNotNull(jdbcStore2);
}
Aggregations