use of org.ff4j.store.JdbcQueryBuilder in project ff4j by ff4j.
the class JdbcPropertyStore method createSchema.
/**
* {@inheritDoc}
*/
@Override
public void createSchema() {
DataSource ds = getDataSource();
JdbcQueryBuilder qb = getQueryBuilder();
if (!isTableExist(ds, qb.getTableNameProperties())) {
executeUpdate(ds, qb.sqlCreateTableProperties());
}
}
use of org.ff4j.store.JdbcQueryBuilder 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.store.JdbcQueryBuilder in project ff4j by ff4j.
the class JdbcFeatureStoreCoreTest method testQueryBuilder.
@Test
public void testQueryBuilder() {
JdbcQueryBuilder builder = new JdbcQueryBuilder();
builder.getFeatureDistributionAudit();
EventQueryDefinition eqd = new EventQueryDefinition();
builder.getPurgeFeatureUsageQuery(eqd);
builder.getSelectFeatureUsageQuery(eqd);
builder.getPurgeAuditTrailQuery(eqd);
builder.removeFeatureFromGroup();
builder.deleteRoles();
builder.getFeatureProperty();
builder.getEventByUuidQuery();
builder.getHostHitCount();
builder.getUserHitCount();
builder.getSourceHitCount();
EventQueryDefinition e1 = new EventQueryDefinition();
builder.buildWhereClause(e1, true, false);
builder.buildWhereClause(e1, false, false);
e1.getHostFilters().add("localhost");
e1.getNamesFilter().add("aaa");
e1.getSourceFilters().add("java");
builder.buildWhereClause(e1, true, false);
}
use of org.ff4j.store.JdbcQueryBuilder 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.JdbcQueryBuilder in project ff4j by ff4j.
the class JdbcFeatureStoreSchemaTest method testCreateTablesWithDataBaseSchema.
@Test
public void testCreateTablesWithDataBaseSchema() {
JdbcQueryBuilder queryBuilder = testedStore.getQueryBuilder();
queryBuilder.setDbSchema("FF4J");
testedStore.createSchema();
Assert.assertTrue(JdbcUtils.isTableExist(testedStore.getDataSource(), queryBuilder.getTableNameFeatures(), "FF4J"));
Assert.assertFalse(JdbcUtils.isTableExist(testedStore.getDataSource(), queryBuilder.getTableNameFeatures(), "FF4J_2"));
}
Aggregations