use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method createDeleteProperty.
@Test
public void createDeleteProperty() {
FF4j ff4j = new FF4j();
ff4j.createProperty(new PropertyString("p1", "v1"));
ff4j.audit();
ff4j.createProperty(new PropertyString("p2", "v2"));
Assert.assertTrue(ff4j.getPropertiesStore().existProperty("p1"));
ff4j.deleteProperty("p1");
Assert.assertFalse(ff4j.getPropertiesStore().existProperty("p1"));
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method testToString.
@Test
public void testToString() {
FF4j ff4j = new FF4j("ff4j.xml");
ff4j.toString();
Assert.assertNotNull(ff4j.getFeatureStore());
ff4j.setFeatureStore(null);
ff4j.setPropertiesStore(null);
ff4j.setEventRepository(null);
ff4j.setEventPublisher(null);
ff4j.setAuthorizationsManager(new DefinedPermissionSecurityManager(Util.set("val1")));
ff4j.toString();
ff4j.removeCurrentContext();
ff4j.getCurrentContext();
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method testOverrideStrategy.
@Test
public void testOverrideStrategy() {
FF4j ff4j = new FF4j();
ff4j.audit();
ff4j.createFeature("N1", true, "description NEWS");
ff4j.createFeature("N2", false, "description NEWS");
Assert.assertTrue(ff4j.check("N1"));
Assert.assertFalse(ff4j.checkOveridingStrategy("N1", new ExpressionFlipStrategy("N1", "N1 & N2")));
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method testDisableFeature.
// disabling...
@Test
public void testDisableFeature() {
FF4j ff4j = new FF4j();
ff4j.autoCreate(true);
ff4j.disable("newffff");
Assert.assertTrue(ff4j.exist("newffff"));
Assert.assertFalse(ff4j.check("newffff"));
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method autoCreateFeatureEnableTest.
@Test
public void autoCreateFeatureEnableTest() {
// Default : store = inMemory, load features from ff4j.xml file
FF4j ff4j = new FF4j("ff4j.xml");
ff4j.autoCreate();
assertFalse(ff4j.exist("autoCreatedFeature"));
// Auto creation by testing its value
assertFalse(ff4j.check("autoCreatedFeature"));
// Assertion
assertTrue(ff4j.exist("autoCreatedFeature"));
}
Aggregations