Search in sources :

Example 1 with OfficeHourStrategy

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

Example 2 with OfficeHourStrategy

use of org.ff4j.strategy.time.OfficeHourStrategy in project ff4j by ff4j.

the class OfficeHourStrategyTest method testOfficeHour.

@Test
public void testOfficeHour() {
    OfficeHourStrategy ohs = new OfficeHourStrategy();
    Map<String, String> initParams = new HashMap<String, String>();
    initParams.put("monday", "08:00-12:00,13:30-18:00");
    initParams.put("tuesday", "08:00-12:00,13:30-18:00");
    initParams.put("wednesday", "08:00-12:00,13:30-18:00");
    initParams.put("thursday", "08:00-12:00,13:30-18:00");
    initParams.put("friday", "08:00-12:00,13:30-18:00");
    initParams.put("saturday", "08:00-12:00,13:30-18:00");
    initParams.put("sunday", "08:00-12:00,13:30-18:00");
    initParams.put("publicHolidays", "2015-01-01,2015-05-01,2015-12-25");
    initParams.put("specialOpenings", "[08:00-12:00]@2015-01-01;[08:00-12:00]@2015-01-02");
    ohs.init("f1", initParams);
}
Also used : HashMap(java.util.HashMap) OfficeHourStrategy(org.ff4j.strategy.time.OfficeHourStrategy) Test(org.junit.Test) AbstractFf4jTest(org.ff4j.test.AbstractFf4jTest)

Example 3 with OfficeHourStrategy

use of org.ff4j.strategy.time.OfficeHourStrategy in project ff4j by ff4j.

the class OfficeHourStrategyTest method testOfficeHour2.

@Test
public void testOfficeHour2() {
    OfficeHourStrategy ohs = new OfficeHourStrategy();
    Map<String, String> initParams = new HashMap<String, String>();
    initParams.put("monday", "08:00-12:00,13:30-18:00");
    initParams.put("tuesday", "08:00-12:00,13:30-18:00");
    initParams.put("wednesday", "08:00-12:00,13:30-18:00");
    initParams.put("thursday", "08:00-12:00,13:30-18:00");
    initParams.put("friday", "08:00-12:00,13:30-18:00");
    initParams.put("saturday", "08:00-12:00,13:30-18:00");
    initParams.put("sunday", "08:00-12:00,13:30-18:00");
    ohs.init("f1", initParams);
}
Also used : HashMap(java.util.HashMap) OfficeHourStrategy(org.ff4j.strategy.time.OfficeHourStrategy) Test(org.junit.Test) AbstractFf4jTest(org.ff4j.test.AbstractFf4jTest)

Example 4 with OfficeHourStrategy

use of org.ff4j.strategy.time.OfficeHourStrategy in project ff4j by ff4j.

the class OfficeHourStrategyTest method testOfficeHour3.

@Test(expected = IllegalArgumentException.class)
public void testOfficeHour3() {
    OfficeHourStrategy ohs = new OfficeHourStrategy();
    Map<String, String> initParams = new HashMap<String, String>();
    initParams.put("publicHolidays", "20152-01-xx01,2015-05-01,2015-12-25");
    ohs.init("f1", initParams);
}
Also used : HashMap(java.util.HashMap) OfficeHourStrategy(org.ff4j.strategy.time.OfficeHourStrategy) Test(org.junit.Test) AbstractFf4jTest(org.ff4j.test.AbstractFf4jTest)

Example 5 with OfficeHourStrategy

use of org.ff4j.strategy.time.OfficeHourStrategy in project ff4j by ff4j.

the class OfficeHourStrategyTest method testOfficeHour5.

@Test(expected = IllegalArgumentException.class)
public void testOfficeHour5() {
    OfficeHourStrategy ohs = new OfficeHourStrategy();
    Map<String, String> initParams = new HashMap<String, String>();
    initParams.put("specialOpenings", "[08:00-12:00]@2ss015-01-01;[08:00-12:00]@2015-01-02");
    ohs.init("f1", initParams);
}
Also used : HashMap(java.util.HashMap) OfficeHourStrategy(org.ff4j.strategy.time.OfficeHourStrategy) Test(org.junit.Test) AbstractFf4jTest(org.ff4j.test.AbstractFf4jTest)

Aggregations

OfficeHourStrategy (org.ff4j.strategy.time.OfficeHourStrategy)6 AbstractFf4jTest (org.ff4j.test.AbstractFf4jTest)6 Test (org.junit.Test)6 HashMap (java.util.HashMap)5 FlippingExecutionContext (org.ff4j.core.FlippingExecutionContext)1 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)1