Package org.ff4j.core

Examples of org.ff4j.core.FlippingStrategy


     */
    @Test
    public void testUpdateFeatureCoreData() {
        // Parameters
        String newDescription = "new-description";
        FlippingStrategy newStrategy = new PonderationStrategy(0.12);
        // Given
        assertFf4j.assertThatFeatureExist(F1);
        Assert.assertFalse(newDescription.equals(testedStore.read(F1).getDescription()));
        // When
        Feature fpBis = testedStore.read(F1);
        fpBis.setDescription(newDescription);
        fpBis.setFlippingStrategy(newStrategy);
        testedStore.update(fpBis);
        // Then
        Feature updatedFeature = testedStore.read(F1);
        Assert.assertTrue(newDescription.equals(updatedFeature.getDescription()));
        Assert.assertNotNull(updatedFeature.getFlippingStrategy());
        Assert.assertEquals(newStrategy.toString(), updatedFeature.getFlippingStrategy().toString());
    }
View Full Code Here


        f = new Feature(featUid, enabled, rs.getString(COL_FEAT_DESCRIPTION), rs.getString(COL_FEAT_GROUPNAME));
        // Strategy
        String strategy = rs.getString(COL_FEAT_STRATEGY);
        if (strategy != null && !"".equals(strategy)) {
            try {
                FlippingStrategy flipStrategy = (FlippingStrategy) Class.forName(strategy).newInstance();
                flipStrategy.init(featUid, ParameterUtils.toMap(rs.getString(COL_FEAT_EXPRESSION)));
                f.setFlippingStrategy(flipStrategy);
            } catch (InstantiationException ie) {
                throw new FeatureAccessException("Cannot instantiate Strategy, no default constructor available", ie);
            } catch (IllegalAccessException iae) {
                throw new FeatureAccessException("Cannot instantiate Strategy, no visible constructor", iae);
View Full Code Here

TOP

Related Classes of org.ff4j.core.FlippingStrategy

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.