Search in sources :

Example 1 with BlackListStrategy

use of org.ff4j.strategy.BlackListStrategy 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));
}
Also used : ClientFilterStrategy(org.ff4j.strategy.ClientFilterStrategy) BlackListStrategy(org.ff4j.strategy.BlackListStrategy) InMemoryFeatureStore(org.ff4j.store.InMemoryFeatureStore) FlippingStrategy(org.ff4j.core.FlippingStrategy) WhiteListStrategy(org.ff4j.strategy.WhiteListStrategy) FlippingExecutionContext(org.ff4j.core.FlippingExecutionContext) Test(org.junit.Test) AbstractFf4jTest(org.ff4j.test.AbstractFf4jTest)

Aggregations

FlippingExecutionContext (org.ff4j.core.FlippingExecutionContext)1 FlippingStrategy (org.ff4j.core.FlippingStrategy)1 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)1 BlackListStrategy (org.ff4j.strategy.BlackListStrategy)1 ClientFilterStrategy (org.ff4j.strategy.ClientFilterStrategy)1 WhiteListStrategy (org.ff4j.strategy.WhiteListStrategy)1 AbstractFf4jTest (org.ff4j.test.AbstractFf4jTest)1 Test (org.junit.Test)1