Package org.ff4j.core

Examples of org.ff4j.core.FlippingExecutionContext


        // If specific strategy is defined
        boolean flipped = false;
        if (formParams.containsKey(POST_PARAMNAME_FLIPSTRATEGY)) {
            FlippingStrategy fs = FeatureJsonParser.parseFlipStrategyAsJson(uid, formParams.getFirst(POST_PARAMNAME_FLIPSTRATEGY));
            FlippingExecutionContext fec = new FlippingExecutionContext();
            for (String key : formParams.keySet()) {
                if (!POST_PARAMNAME_FLIPSTRATEGY.equals(key) && !POST_PARAMNAME_FEATURE_UID.equals(key)) {
                    fec.putString(key, formParams.getFirst(key));
                }
            }
            flipped = ff4j.checkOveridingStrategy(uid, fs, fec);
        } else {
            flipped = ff4j.check(uid);
View Full Code Here


        ExpressionFlipStrategy efs = new ExpressionFlipStrategy();

        Assert.assertTrue(efs.evaluate("D", ff4j.getStore(), null));
        Assert.assertTrue(efs.evaluate("TOTO", ff4j.getStore(), null));

        FlippingExecutionContext fex = new FlippingExecutionContext();
        fex.putString(ExpressionFlipStrategy.PARAM_EXPRESSION, "D");
        Assert.assertTrue(efs.evaluate("D", ff4j.getStore(), fex));

        fex.putString(ExpressionFlipStrategy.PARAM_EXPRESSION, "TOTO");
        Assert.assertFalse(efs.evaluate("D", ff4j.getStore(), fex));
    }
View Full Code Here

        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));
    }
View Full Code Here

        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));
    }
View Full Code Here

        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(ClientFilterStrategy.CLIENT_HOSTNAME, "pierre");

        // Then
        Assert.assertTrue(ff4j.check(F1, fex));
    }
View Full Code Here

        Assert.assertEquals(1, cStra.getInitParams().size());
        Assert.assertTrue(f1.isEnable());


        // When (add invalid client name)
        FlippingExecutionContext fex = new FlippingExecutionContext();
        fex.addValue(ClientFilterStrategy.CLIENT_HOSTNAME, FEATURE_NEW);

        // Then
        Assert.assertFalse(ff4j.check(F1, fex));
    }
View Full Code Here

        Assert.assertNotNull(cStra.getInitParams());
        Assert.assertEquals(1, cStra.getInitParams().size());
        Assert.assertTrue(f1.isEnable());

        // When
        FlippingExecutionContext fex = new FlippingExecutionContext();
        fex.addValue(FEATURE_NEW, FEATURE_NEW);

        // Then
        ff4j.check(F1, fex);
    }
View Full Code Here

        FF4j ff4j = new FF4j().autoCreate(true).create(
                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));
    }
View Full Code Here

TOP

Related Classes of org.ff4j.core.FlippingExecutionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.