use of org.ff4j.audit.proxy.PropertyStoreAuditProxy in project ff4j by ff4j.
the class FF4jTest method getConcreteFeatureStore.
@Test
public void getConcreteFeatureStore() {
FF4j ff4j = new FF4j();
ff4j.cache(new InMemoryCacheManager());
Assert.assertNotNull(ff4j.getCacheProxy());
Assert.assertNotNull(ff4j.getConcreteFeatureStore());
Assert.assertNotNull(ff4j.getConcretePropertyStore());
ff4j.setPropertiesStore(new PropertyStoreAuditProxy(ff4j, ff4j.getPropertiesStore()));
Assert.assertNotNull(ff4j.getConcretePropertyStore());
}
use of org.ff4j.audit.proxy.PropertyStoreAuditProxy in project ff4j by ff4j.
the class PropertyStoreAuditProxyTest method initPropertyStore.
/**
* {@inheritDoc}
*/
@Override
protected PropertyStore initPropertyStore() {
FF4j ff4j = new FF4j();
PropertyStore ps = new InMemoryPropertyStore("ff4j.xml");
ff4j.setPropertiesStore(ps);
return new PropertyStoreAuditProxy(ff4j, ps);
}
use of org.ff4j.audit.proxy.PropertyStoreAuditProxy in project ff4j by ff4j.
the class FF4j method init.
/**
* Initialization of background components.
*/
private synchronized void init() {
// Execution Context
FlippingExecutionContext context = new FlippingExecutionContext();
this.currentExecutionContext.set(context);
// Event Publisher
if (eventPublisher == null) {
eventPublisher = new EventPublisher(eventRepository);
this.shutdownEventPublisher = true;
}
// Audit is enabled, proxified stores for auditing
if (isEnableAudit()) {
if (fstore != null && !(fstore instanceof FeatureStoreAuditProxy)) {
this.fstore = new FeatureStoreAuditProxy(this, fstore);
}
if (pStore != null && !(pStore instanceof PropertyStoreAuditProxy)) {
this.pStore = new PropertyStoreAuditProxy(this, pStore);
}
} else {
// Audit is disabled but could have been enabled before... removing PROXY if relevant
if (fstore != null && fstore instanceof FeatureStoreAuditProxy) {
this.fstore = ((FeatureStoreAuditProxy) fstore).getTarget();
}
if (pStore != null && pStore instanceof PropertyStoreAuditProxy) {
this.pStore = ((PropertyStoreAuditProxy) pStore).getTarget();
}
}
// Flag as OK
this.initialized = true;
}
Aggregations