Search in sources :

Example 26 with FF4j

use of org.ff4j.FF4j in project ff4j by ff4j.

the class FF4jTest method workingWithFeature.

@Test
public void workingWithFeature() {
    // Initialize with empty store
    FF4j ff4j = new FF4j();
    // Dynamically register new features
    ff4j.createFeature("f1").enable("f1");
    // Assertions
    assertTrue(ff4j.exist("f1"));
    assertTrue(ff4j.check("f1"));
}
Also used : FF4j(org.ff4j.FF4j) Test(org.junit.Test)

Example 27 with FF4j

use of org.ff4j.FF4j in project ff4j by ff4j.

the class FF4jTest method testEnableFeature.

// enabling...
@Test
public void testEnableFeature() {
    FF4j ff4j = new FF4j();
    ff4j.autoCreate(true);
    ff4j.enable("newffff");
    Assert.assertTrue(ff4j.exist("newffff"));
    Assert.assertTrue(ff4j.check("newffff"));
}
Also used : FF4j(org.ff4j.FF4j) Test(org.junit.Test)

Example 28 with FF4j

use of org.ff4j.FF4j in project ff4j by ff4j.

the class PropertyStoreTestSupport method setUp.

/**
 * {@inheritDoc}
 */
@Before
public void setUp() throws Exception {
    ff4j = new FF4j();
    ff4j.setPropertiesStore(initPropertyStore());
    testedStore = ff4j.getConcretePropertyStore();
}
Also used : FF4j(org.ff4j.FF4j) Before(org.junit.Before)

Example 29 with FF4j

use of org.ff4j.FF4j in project ff4j by ff4j.

the class AssertTest method initFF4J.

@Before
public void initFF4J() {
    if (assertFF4j == null) {
        ff4j = new FF4j();
        ff4j.setFeatureStore(new InMemoryFeatureStore("test-ff4j-features.xml"));
        ff4j.setPropertiesStore(new InMemoryPropertyStore("test-ff4j-features.xml"));
        ff4j.setAuthorizationsManager(new DefaultAuthorisationManager(Util.set("PERM1", "PERM2"), Util.set("PERM1", "PERM2", "PERM3")));
        assertFF4j = new AssertFf4j(ff4j);
    }
}
Also used : AssertFf4j(org.ff4j.test.AssertFf4j) InMemoryPropertyStore(org.ff4j.property.store.InMemoryPropertyStore) FF4j(org.ff4j.FF4j) InMemoryFeatureStore(org.ff4j.store.InMemoryFeatureStore) Before(org.junit.Before)

Example 30 with FF4j

use of org.ff4j.FF4j in project ff4j by ff4j.

the class FF4jDroolsDRLFilesProgrammatic method testDroolsStrategyFromDRLFiles.

@Test
public void testDroolsStrategyFromDRLFiles() {
    // Given
    FF4j ff4j = new FF4j();
    // When
    Feature f1 = new Feature("f1", true);
    f1.setFlippingStrategy(new FF4jDroolsFlippingStrategy(Util.set("ff4jDroolsSample.drl")));
    ff4j.createFeature(f1);
    Assert.assertTrue(ff4j.exist("f1"));
    // Then
    Assert.assertTrue(ff4j.check("f1"));
}
Also used : FF4j(org.ff4j.FF4j) Feature(org.ff4j.core.Feature) Test(org.junit.Test)

Aggregations

FF4j (org.ff4j.FF4j)60 Test (org.junit.Test)41 Before (org.junit.Before)9 Feature (org.ff4j.core.Feature)8 ArrayList (java.util.ArrayList)4 PropertyString (org.ff4j.property.PropertyString)4 InMemoryFeatureStore (org.ff4j.store.InMemoryFeatureStore)4 AssertFf4j (org.ff4j.test.AssertFf4j)4 InMemoryPropertyStore (org.ff4j.property.store.InMemoryPropertyStore)3 Date (java.util.Date)2 HashSet (java.util.HashSet)2 PropertyStoreAuditProxy (org.ff4j.audit.proxy.PropertyStoreAuditProxy)2 InMemoryCacheManager (org.ff4j.cache.InMemoryCacheManager)2 FeatureStore (org.ff4j.core.FeatureStore)2 PropertyDate (org.ff4j.property.PropertyDate)2 PropertyStore (org.ff4j.property.store.PropertyStore)2 SpringSecurityAuthorisationManager (org.ff4j.security.SpringSecurityAuthorisationManager)2 TestConstantsFF4j (org.ff4j.test.TestConstantsFF4j)2 ApiConfig (org.ff4j.web.ApiConfig)2 ApiConfigBuilder (org.ff4j.web.ApiConfigBuilder)2