Search in sources :

Example 6 with FlippingExecutionContext

use of org.ff4j.core.FlippingExecutionContext in project ff4j by ff4j.

the class FF4jTest method testFlipped.

@Test
public void testFlipped() {
    FF4j ff4j = new FF4j().autoCreate(true).createFeature(new Feature("coco", true, "grp2", "", Arrays.asList(new String[] { "ROLEA" })));
    Assert.assertTrue(ff4j.check("coco"));
    ff4j.setAuthorizationsManager(mockAuthManager);
    Assert.assertTrue(ff4j.check("coco"));
    FlippingExecutionContext ex = new FlippingExecutionContext();
    ex.putString("OK", "OK");
    Assert.assertTrue(ff4j.check("coco", ex));
    Assert.assertTrue(ff4j.checkOveridingStrategy("coco", mockFlipStrategy));
    Assert.assertTrue(ff4j.checkOveridingStrategy("coco", null, null));
    Assert.assertFalse(ff4j.checkOveridingStrategy("cocorico", mockFlipStrategy));
    // Update Coverage
    ff4j.setAuthManager("something");
}
Also used : FF4j(org.ff4j.FF4j) FlippingExecutionContext(org.ff4j.core.FlippingExecutionContext) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Example 7 with FlippingExecutionContext

use of org.ff4j.core.FlippingExecutionContext in project ff4j by ff4j.

the class FeatureTest method testFlipExecContext5.

@Test(expected = IllegalArgumentException.class)
public void testFlipExecContext5() {
    Map<String, Object> parameters = new HashMap<String, Object>();
    FlippingExecutionContext fec = new FlippingExecutionContext();
    parameters.put("b", new Integer(1));
    fec.getBoolean("b");
    fec.getValue("DONOT", true);
}
Also used : HashMap(java.util.HashMap) PropertyString(org.ff4j.property.PropertyString) FlippingExecutionContext(org.ff4j.core.FlippingExecutionContext) Test(org.junit.Test)

Example 8 with FlippingExecutionContext

use of org.ff4j.core.FlippingExecutionContext in project ff4j by ff4j.

the class FeatureTest method testFlipExecContext8.

@Test
public void testFlipExecContext8() {
    FlippingExecutionContext fec = new FlippingExecutionContext();
    fec.putBoolean("a", new Boolean(true));
    fec.putDate("b", new Date());
    fec.putDate("c", new Date());
    fec.putInt("d", new Integer(1));
    fec.putDouble("e", new Double(1D));
}
Also used : FlippingExecutionContext(org.ff4j.core.FlippingExecutionContext) Date(java.util.Date) Test(org.junit.Test)

Example 9 with FlippingExecutionContext

use of org.ff4j.core.FlippingExecutionContext in project ff4j by ff4j.

the class FeatureTest method testFlipExecContext4.

@Test(expected = IllegalArgumentException.class)
public void testFlipExecContext4() {
    Map<String, Object> parameters = new HashMap<String, Object>();
    FlippingExecutionContext fec = new FlippingExecutionContext();
    parameters.put("b", new Integer(1));
    fec.getDate("b");
}
Also used : HashMap(java.util.HashMap) PropertyString(org.ff4j.property.PropertyString) FlippingExecutionContext(org.ff4j.core.FlippingExecutionContext) Test(org.junit.Test)

Example 10 with FlippingExecutionContext

use of org.ff4j.core.FlippingExecutionContext in project ff4j by ff4j.

the class FeatureTest method testFlipExecContext2.

@Test(expected = IllegalArgumentException.class)
public void testFlipExecContext2() {
    Map<String, Object> parameters = new HashMap<String, Object>();
    FlippingExecutionContext fec = new FlippingExecutionContext();
    parameters.put("b", new Double(1));
    fec.getInt("b");
}
Also used : HashMap(java.util.HashMap) PropertyString(org.ff4j.property.PropertyString) FlippingExecutionContext(org.ff4j.core.FlippingExecutionContext) Test(org.junit.Test)

Aggregations

FlippingExecutionContext (org.ff4j.core.FlippingExecutionContext)28 Test (org.junit.Test)21 AbstractFf4jTest (org.ff4j.test.AbstractFf4jTest)8 HashMap (java.util.HashMap)6 Feature (org.ff4j.core.Feature)6 PropertyString (org.ff4j.property.PropertyString)6 Map (java.util.Map)4 FlippingStrategy (org.ff4j.core.FlippingStrategy)4 ClientFilterStrategy (org.ff4j.strategy.ClientFilterStrategy)4 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)3 ServerFilterStrategy (org.ff4j.strategy.ServerFilterStrategy)3 Date (java.util.Date)2 ApiOperation (io.swagger.annotations.ApiOperation)1 ApiResponses (io.swagger.annotations.ApiResponses)1 Calendar (java.util.Calendar)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 FF4j (org.ff4j.FF4j)1