Search in sources :

Example 1 with JdbcQueryBuilder

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());
    }
}
Also used : JdbcQueryBuilder(org.ff4j.store.JdbcQueryBuilder) DataSource(javax.sql.DataSource)

Example 2 with JdbcQueryBuilder

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;
}
Also used : JdbcQueryBuilder(org.ff4j.store.JdbcQueryBuilder) EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder) JdbcPropertyStore(org.ff4j.property.store.JdbcPropertyStore)

Example 3 with JdbcQueryBuilder

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);
}
Also used : JdbcQueryBuilder(org.ff4j.store.JdbcQueryBuilder) EventQueryDefinition(org.ff4j.audit.EventQueryDefinition) Test(org.junit.Test)

Example 4 with JdbcQueryBuilder

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;
}
Also used : JdbcFeatureStore(org.ff4j.store.JdbcFeatureStore) JdbcQueryBuilder(org.ff4j.store.JdbcQueryBuilder) EmbeddedDatabaseBuilder(org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)

Example 5 with JdbcQueryBuilder

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"));
}
Also used : JdbcQueryBuilder(org.ff4j.store.JdbcQueryBuilder) Test(org.junit.Test)

Aggregations

JdbcQueryBuilder (org.ff4j.store.JdbcQueryBuilder)14 Test (org.junit.Test)7 DataSource (javax.sql.DataSource)6 EmbeddedDatabaseBuilder (org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder)4 EventQueryDefinition (org.ff4j.audit.EventQueryDefinition)1 JdbcPropertyStore (org.ff4j.property.store.JdbcPropertyStore)1 FeatureStoreSpringJdbc (org.ff4j.springjdbc.store.FeatureStoreSpringJdbc)1 PropertyStoreSpringJdbc (org.ff4j.springjdbc.store.PropertyStoreSpringJdbc)1 JdbcFeatureStore (org.ff4j.store.JdbcFeatureStore)1 Transactional (org.springframework.transaction.annotation.Transactional)1