use of org.ff4j.store.JdbcFeatureStore in project ff4j by ff4j.
the class JdbcFeatureStorePrefixTest method initStore.
/**
* {@inheritDoc}
*/
@Override
protected FeatureStore initStore() {
builder = new EmbeddedDatabaseBuilder();
db = builder.setType(//
EmbeddedDatabaseType.HSQL).addScript(//
"classpath:ddl-prefix-schema.sql").addScript("classpath:ddl-prefix-data.sql").build();
JdbcFeatureStore jdbcStore = new JdbcFeatureStore();
jdbcStore.setQueryBuilder(new JdbcQueryBuilder("T_FF4J_", "_01"));
jdbcStore.setDataSource(db);
return jdbcStore;
}
use of org.ff4j.store.JdbcFeatureStore in project ff4j by ff4j.
the class JdbcFeatureStoreTestInvalidData method setUp.
/**
* {@inheritDoc}
*/
@Before
public void setUp() throws Exception {
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder();
db = builder.setType(//
EmbeddedDatabaseType.HSQL).addScript(//
"classpath:schema-ddl.sql").addScript("classpath:ff-invalidstore.sql").build();
jdbcStore = new JdbcFeatureStore();
jdbcStore.setDataSource(db);
}
use of org.ff4j.store.JdbcFeatureStore in project ff4j by ff4j.
the class JdbcFeatureStoreErrorTest method testCreateKO.
@Test(expected = FeatureAccessException.class)
public void testCreateKO() throws SQLException {
DataSource mockDS = Mockito.mock(DataSource.class);
doThrow(new SQLException()).when(mockDS).getConnection();
JdbcFeatureStore jrepo = new JdbcFeatureStore(mockDS);
jrepo.setDataSource(mockDS);
jrepo.create(new Feature("U1", 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 testClearKO.
@Test(expected = FeatureAccessException.class)
public void testClearKO() throws SQLException {
DataSource mockDS = Mockito.mock(DataSource.class);
doThrow(new SQLException()).when(mockDS).getConnection();
JdbcFeatureStore jrepo = new JdbcFeatureStore(mockDS);
jrepo.setDataSource(mockDS);
jrepo.clear();
}
Aggregations