use of org.ff4j.core.FlippingExecutionContext in project ff4j by ff4j.
the class FeatureTest method testFlipExecContext6.
@Test(expected = IllegalArgumentException.class)
public void testFlipExecContext6() {
FlippingExecutionContext fec = new FlippingExecutionContext();
fec.getValue("DONOT", true);
}
use of org.ff4j.core.FlippingExecutionContext 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.core.FlippingExecutionContext 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.core.FlippingExecutionContext in project ff4j by ff4j.
the class OfficeHourStrategyTest method overrideDate.
private FlippingExecutionContext overrideDate(int year, int month, int day, int hour) {
FlippingExecutionContext fec = new FlippingExecutionContext();
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, year);
c.set(Calendar.MONTH, month);
c.set(Calendar.DAY_OF_MONTH, day);
c.set(Calendar.HOUR_OF_DAY, hour);
c.set(Calendar.MINUTE, 0);
fec = new FlippingExecutionContext();
fec.addValue(OfficeHourStrategy.OVERRIDE_DATE, c);
return fec;
}
use of org.ff4j.core.FlippingExecutionContext 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));
}
Aggregations