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"));
}
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"));
}
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();
}
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);
}
}
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"));
}
Aggregations