use of org.ff4j.store.JdbcFeatureStore in project ff4j by ff4j.
the class JdbcFeatureStoreCoreTest 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();
JdbcFeatureStore jdbcStore = new JdbcFeatureStore();
jdbcStore.setDataSource(db);
return jdbcStore;
}
use of org.ff4j.store.JdbcFeatureStore in project ff4j by ff4j.
the class JdbcFeatureStoreErrorTest method testexistGroupKO.
@Test(expected = FeatureAccessException.class)
public void testexistGroupKO() throws SQLException {
DataSource mockDS = Mockito.mock(DataSource.class);
doThrow(new SQLException()).when(mockDS).getConnection();
JdbcFeatureStore jrepo = new JdbcFeatureStore(mockDS);
jrepo.setDataSource(mockDS);
jrepo.existGroup("invalid");
}
use of org.ff4j.store.JdbcFeatureStore in project ff4j by ff4j.
the class JdbcFeatureStoreErrorTest method testUpdateKO.
@Test(expected = FeatureAccessException.class)
public void testUpdateKO() throws SQLException {
DataSource mockDS = Mockito.mock(DataSource.class);
doThrow(new SQLException()).when(mockDS).getConnection();
JdbcFeatureStore jrepo = new JdbcFeatureStore(mockDS);
jrepo.setDataSource(mockDS);
jrepo.update(new Feature("f1", true));
}
use of org.ff4j.store.JdbcFeatureStore in project ff4j by ff4j.
the class JdbcFeatureStoreErrorTest method testReadAllGroupKO.
@Test(expected = FeatureAccessException.class)
public void testReadAllGroupKO() throws SQLException {
DataSource mockDS = Mockito.mock(DataSource.class);
doThrow(new SQLException()).when(mockDS).getConnection();
JdbcFeatureStore jrepo = new JdbcFeatureStore(mockDS);
jrepo.setDataSource(mockDS);
jrepo.readAllGroups();
}
use of org.ff4j.store.JdbcFeatureStore in project ff4j by ff4j.
the class JdbcFeatureStoreErrorTest method testReadGroupKO.
@Test(expected = FeatureAccessException.class)
public void testReadGroupKO() throws SQLException {
DataSource mockDS = Mockito.mock(DataSource.class);
doThrow(new SQLException()).when(mockDS).getConnection();
JdbcFeatureStore jrepo = new JdbcFeatureStore(mockDS);
jrepo.setDataSource(mockDS);
jrepo.readGroup("invalid");
}
Aggregations