use of org.ff4j.core.FeatureStore in project ff4j by ff4j.
the class FeatureStoreHttpSpringTest method initStore.
/**
* {@inheritDoc}
*/
protected FeatureStore initStore() {
ClassPathXmlApplicationContext appCtx = new ClassPathXmlApplicationContext("spring-context.xml");
FeatureStore store = appCtx.getBean(FF4j.class).getFeatureStore();
appCtx.close();
return store;
}
use of org.ff4j.core.FeatureStore in project ff4j by ff4j.
the class FeatureStoreMongoCollectionCore1Test method emptyListAttributes.
/**
* LazyBSONObjectList vs BasicBSONObjectList
*/
@Test
@Ignore
public void emptyListAttributes() throws UnknownHostException {
MongoCollection<Document> features = getMongoClient().getDatabase("FF4J").getCollection("feature");
// When
FeatureStore mongoStore = new FeatureStoreMongo(features, "ff4j.xml");
// Then (no error)
Assert.assertTrue(mongoStore.readAll().keySet().size() > 0);
}
use of org.ff4j.core.FeatureStore in project ff4j by ff4j.
the class CoreFeatureStoreTestSupport method setUp.
/**
* {@inheritDoc}
*/
@Before
public void setUp() throws Exception {
ff4j = new FF4j();
FeatureStore fs = initStore();
ff4j.setFeatureStore(fs);
testedStore = fs;
assertFf4j = new AssertFf4j(ff4j);
}
use of org.ff4j.core.FeatureStore 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.core.FeatureStore in project ff4j by ff4j.
the class FeatureJsonMarshallTest method testJsonUtils.
@Test
public void testJsonUtils() {
FlippingStrategy ps = new FlippingStrategy() {
public void init(String featureName, Map<String, String> initParam) {
}
public Map<String, String> getInitParams() {
return null;
}
public boolean evaluate(String fn, FeatureStore s, FlippingExecutionContext ex) {
return false;
}
};
JsonUtils.flippingStrategyAsJson(ps);
}
Aggregations