use of org.ff4j.store.InMemoryFeatureStore in project ff4j by ff4j.
the class InMemoryFeatureStoreTest method testUnitFeatureInitialization2.
@Test
public void testUnitFeatureInitialization2() {
LinkedHashMap<String, Feature> map1 = new LinkedHashMap<String, Feature>();
map1.put("new", new Feature("new", true, "description"));
map1.put("old", new Feature("old", true, "description"));
InMemoryFeatureStore imfs = new InMemoryFeatureStore(map1);
Assert.assertEquals(2, imfs.readAll().size());
Assert.assertNotNull(imfs.read("old"));
}
use of org.ff4j.store.InMemoryFeatureStore in project ff4j by ff4j.
the class InMemoryFeatureStoreTest method testDonotImportInvalid.
@Test(expected = IllegalArgumentException.class)
public void testDonotImportInvalid() {
InMemoryFeatureStore f = new InMemoryFeatureStore();
f.importFeaturesFromXmlFile("invalid.xml");
}
use of org.ff4j.store.InMemoryFeatureStore in project ff4j by ff4j.
the class InMemoryFeatureStoreTest method testImportTwice.
@Test
public void testImportTwice() {
InMemoryFeatureStore f = new InMemoryFeatureStore();
f.importFeaturesFromXmlFile("ff4j.xml");
f.importFeaturesFromXmlFile("ff4j.xml");
Assert.assertFalse(f.readAll().isEmpty());
}
use of org.ff4j.store.InMemoryFeatureStore in project ff4j by ff4j.
the class InMemoryFeatureStoreTest method testDonotImportNull.
@Test(expected = IllegalArgumentException.class)
public void testDonotImportNull() {
InMemoryFeatureStore f = new InMemoryFeatureStore();
f.importFeaturesFromXmlFile(null);
}
use of org.ff4j.store.InMemoryFeatureStore in project ff4j by ff4j.
the class ClientFilterStrategyTest method testInitialisationProgram.
@Test
public void testInitialisationProgram() {
FlippingStrategy fs = new ClientFilterStrategy("Pierre, Paul, Jacques");
fs.init("f1", null);
fs.init("f1", new HashMap<String, String>());
new WhiteListStrategy();
new WhiteListStrategy("Pierre");
// Working
new BlackListStrategy();
FlippingStrategy bl2 = new BlackListStrategy("Pierre");
FlippingExecutionContext context = new FlippingExecutionContext();
context.putString("clientHostName", "localhost");
Assert.assertTrue(bl2.evaluate("f1", new InMemoryFeatureStore(), context));
context.putString("clientHostName", "Pierre");
Assert.assertFalse(bl2.evaluate("f1", new InMemoryFeatureStore(), context));
}
Aggregations