use of org.ff4j.store.InMemoryFeatureStore in project ff4j by ff4j.
the class RedisCacheManagerTestIT method testPutGet.
@Test
public void testPutGet() {
// Initializing Features for test
FeatureStore store = new InMemoryFeatureStore(TEST_FEATURES_FILE);
Feature fold = store.read(F4);
// Put in Cache
cache.putFeature(fold);
// Retrieve object
Feature fcached = cache.getFeature(F4);
Assert.assertEquals(fcached.getUid(), fold.getUid());
Assert.assertEquals(fcached.getPermissions(), fold.getPermissions());
}
use of org.ff4j.store.InMemoryFeatureStore in project ff4j by ff4j.
the class OfficeHourStrategyTest method testOfficeHourEmptyExpression.
@Test
public void testOfficeHourEmptyExpression() {
OfficeHourStrategy ohs = new OfficeHourStrategy();
ohs.parseIntervalsExpression(null);
ohs.parseIntervalsExpression("");
ohs.matches(Calendar.getInstance(), null);
ohs.evaluate("f1", new InMemoryFeatureStore(), null);
ohs.evaluate("f1", new InMemoryFeatureStore(), new FlippingExecutionContext());
}
use of org.ff4j.store.InMemoryFeatureStore in project ff4j by ff4j.
the class CacheProxyWithPollingTest method testCacheProxyManagerProperty.
@Test
public void testCacheProxyManagerProperty() throws InterruptedException {
// When
FeatureStore fs = new InMemoryFeatureStore("ff4j.xml");
PropertyStore ps = new InMemoryPropertyStore("ff4j.xml");
FF4JCacheManager cm = new InMemoryCacheManager();
FF4jCacheProxy proxy = new FF4jCacheProxy(fs, ps, cm);
// Start polling on 100ms basis
proxy.startPolling(100);
proxy.createSchema();
Thread.sleep(200);
// When (Remove something)
fs.delete("AwesomeFeature");
// Then (Proxy is not yet refresh)
Assert.assertTrue(proxy.exist("AwesomeFeature"));
// When (wait for cache refresh)
Thread.sleep(200);
// Then (also delete in cache si Cache is refreshed)
Assert.assertFalse(proxy.exist("AwesomeFeature"));
Store2CachePollingScheduler scheduler = proxy.getStore2CachePoller();
scheduler.setInitialDelay(scheduler.getInitialDelay());
scheduler.setPollingDelay(scheduler.getPollingDelay());
proxy.stopPolling();
proxy.setStore2CachePoller(new Store2CachePollingScheduler(fs, ps, cm));
}
use of org.ff4j.store.InMemoryFeatureStore in project ff4j by ff4j.
the class ClientFilterStrategyTest method testInitialisationProgramServer.
@Test
public void testInitialisationProgramServer() {
FlippingStrategy fs = new ServerFilterStrategy("serv1,serv2");
fs.init("f1", null);
fs.init("f1", new HashMap<String, String>());
FlippingExecutionContext context = new FlippingExecutionContext();
fs.evaluate("f1", new InMemoryFeatureStore(), context);
}
use of org.ff4j.store.InMemoryFeatureStore in project ff4j by ff4j.
the class FeatureStoreAuditProxyTest method initStore.
/**
* {@inheritDoc}
*/
@Override
public FeatureStore initStore() {
FF4j ff4j = new FF4j();
InMemoryFeatureStore imfs = new InMemoryFeatureStore();
imfs.setLocation("ff4j.xml");
ff4j.setFeatureStore(imfs);
return new FeatureStoreAuditProxy(ff4j, imfs);
}
Aggregations