use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jDroolsKBaseXml method testDroolsStrategyFromkBaseName.
@Test
public void testDroolsStrategyFromkBaseName() {
// Given
FF4j ff4j = new FF4j("ff4j-kbase.xml");
// When
Assert.assertTrue(ff4j.exist("f1"));
// Then
Assert.assertTrue(ff4j.check("f1"));
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class InMemoryPropertyStoreTest method testProperty.
public void testProperty() {
FF4j ff4j = new FF4j("ff4j.xml");
ff4j.getPropertiesStore().createProperty(new PropertyDate("property_3", new Date()));
Property<?> ap = ff4j.getPropertiesStore().readProperty("property_3");
PropertyDate pDate = (PropertyDate) ap;
pDate.setValue(new Date());
ff4j.getPropertiesStore().updateProperty(pDate);
ff4j.getPropertiesStore().deleteProperty("property_3");
Assert.assertFalse(testedStore.existProperty("property_3"));
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method authorisationManager.
@Test
public void authorisationManager() {
FF4j ff4j = new FF4j();
ff4j.setAuthorizationsManager(new DefinedPermissionSecurityManager(null));
ff4j.getAuthorizationsManager().toString();
ff4j.createFeature("f1");
ff4j.check("f1");
ff4j.setAuthorizationsManager(new DefinedPermissionSecurityManager(new HashSet<String>()));
ff4j.getAuthorizationsManager().toString();
ff4j.setAuthorizationsManager(new DefinedPermissionSecurityManager(Util.set("S1", "S2")));
ff4j.getAuthorizationsManager().toString();
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method testAllowed.
@Test
public void testAllowed() {
FF4j ff4j = new FF4j();
ff4j.setAuthorizationsManager(new DefinedPermissionSecurityManager(Util.set("USER")));
Feature f1 = new Feature("f1", true, null, null, Util.set("USER"));
ff4j.createFeature(f1);
ff4j.check(f1.getUid());
ff4j.isAllowed(f1);
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jTest method testDisableFeatureNotExist.
@Test(expected = FeatureNotFoundException.class)
public void testDisableFeatureNotExist() {
FF4j ff4j = new FF4j();
ff4j.disable("newffff");
}
Aggregations