use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jDroolsDRLFilesXml method testDroolsStrategyDRLFiles.
@Test
public void testDroolsStrategyDRLFiles() {
// Given
FF4j ff4j = new FF4j("ff4j-drl.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 FF4jDroolsKBaseProgrammatic method testDroolsStrategyFromkBaseName.
@Test
public void testDroolsStrategyFromkBaseName() {
// Given
FF4j ff4j = new FF4j();
// When
Feature f1 = new Feature("f1", true);
f1.setFlippingStrategy(new FF4jDroolsFlippingStrategy("ff4jDroolsStrategy"));
ff4j.createFeature(f1);
Assert.assertTrue(ff4j.exist("f1"));
// Then
Assert.assertTrue(ff4j.check("f1"));
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class EventRepositoryTestSupport method setUp.
/**
* {@inheritDoc}
*/
@Before
public void setUp() throws Exception {
ff4j = new FF4j();
ff4j.setFeatureStore(new InMemoryFeatureStore("test-ff4j-features.xml"));
ff4j.setPropertiesStore(new InMemoryPropertyStore("test-ff4j-features.xml"));
ff4j.setEventRepository(initRepository());
repo = ff4j.getEventRepository();
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FF4jCliDisplay method displayEnvironments.
/**
* Display a table of available environments.
*
* @param envs
* environnements in config file
*/
public static void displayEnvironments(Map<String, FF4j> envs) {
yellow("+--------------------+----------+------------+-------+----------+\n");
System.out.print("|");
cyan(" Environments ");
yellow("|");
cyan(" Features ");
yellow("|");
cyan(" Properties ");
yellow("|");
cyan(" Audit ");
yellow("|");
cyan(" Security ");
yellow("|\n");
System.out.println("+--------------------+----------+------------+-------+----------+");
for (Map.Entry<String, FF4j> entries : envs.entrySet()) {
FeatureStore fs = entries.getValue().getFeatureStore();
PropertyStore ps = entries.getValue().getPropertiesStore();
yellow("| ");
green(StringUtils.rightPad(entries.getKey(), 18));
yellow("| ");
String featureStore = "---";
if (fs != null) {
featureStore = String.valueOf(fs.readAll().size());
}
white(StringUtils.rightPad(featureStore, 8));
yellow("| ");
String propertyStore = "---";
if (fs != null) {
propertyStore = String.valueOf(ps.listPropertyNames().size());
}
white(StringUtils.rightPad(propertyStore, 10));
yellow("|");
AnsiTerminal.textAttribute(AnsiTextAttribute.BOLD);
if (entries.getValue().isEnableAudit()) {
green(" ON ");
} else {
red(" OFF ");
}
AnsiTerminal.textAttribute(AnsiTextAttribute.CLEAR);
yellow("|");
AnsiTerminal.textAttribute(AnsiTextAttribute.BOLD);
if (entries.getValue().getAuthorizationsManager() != null) {
green(" ON ");
} else {
red(" OFF ");
}
AnsiTerminal.textAttribute(AnsiTextAttribute.CLEAR);
yellow("|\n");
}
System.out.println("+--------------------+----------+------------+-------+----------+");
System.out.println("");
}
use of org.ff4j.FF4j in project ff4j by ff4j.
the class FeatureStoreTestSupport method setUp.
/**
* {@inheritDoc}
*/
@Before
public void setUp() throws Exception {
ff4j = new FF4j();
ff4j.setFeatureStore(initStore());
testedStore = ff4j.getFeatureStore();
assertFf4j = new AssertFf4j(ff4j);
assertFf4j.setPause(enablePause());
}
Aggregations