use of org.ff4j.strategy.ServerFilterStrategy 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.strategy.ServerFilterStrategy in project ff4j by ff4j.
the class ServerFilterStrategyTest method testFilterInvalidClient.
@Test
public void testFilterInvalidClient() throws ParseException {
// Given
Feature f1 = ff4j.getFeature(F1);
Assert.assertNotNull(f1.getFlippingStrategy());
ServerFilterStrategy cStra = (ServerFilterStrategy) f1.getFlippingStrategy();
Assert.assertNotNull(cStra.getInitParams());
Assert.assertEquals(1, cStra.getInitParams().size());
Assert.assertTrue(f1.isEnable());
// When (add invalid client name)
FlippingExecutionContext fex = new FlippingExecutionContext();
fex.addValue(ServerFilterStrategy.SERVER_HOSTNAME, FEATURE_NEW);
// Then
Assert.assertFalse(ff4j.check(F1, fex));
}
use of org.ff4j.strategy.ServerFilterStrategy in project ff4j by ff4j.
the class ServerFilterStrategyTest method testFilterOK.
@Test
public void testFilterOK() throws ParseException {
// Given
Feature f1 = ff4j.getFeature(F1);
Assert.assertNotNull(f1.getFlippingStrategy());
ServerFilterStrategy cStra = (ServerFilterStrategy) f1.getFlippingStrategy();
Assert.assertNotNull(cStra.getInitParams());
Assert.assertEquals(1, cStra.getInitParams().size());
Assert.assertTrue(f1.isEnable());
// When (add correct client name)
FlippingExecutionContext fex = new FlippingExecutionContext();
fex.addValue(ServerFilterStrategy.SERVER_HOSTNAME, "dev01");
// Then
Assert.assertTrue(ff4j.check(F1, fex));
}
Aggregations