use of org.ff4j.conf.XmlParser in project ff4j by ff4j.
the class FF4j_autocreate_multithreaded_Test method initFF4j.
@Override
public FF4j initFF4j() {
FF4j ff4j = new FF4j(new XmlParser(), "ff4j.xml");
ff4j.setFeatureStore(new DelayingFeatureStore("ff4j.xml"));
return ff4j;
}
use of org.ff4j.conf.XmlParser in project ff4j by ff4j.
the class FF4jTest method testDisableWithAudit.
@Test
public void testDisableWithAudit() {
// Given
FF4j ff4j = new FF4j(new XmlParser(), getClass().getClassLoader().getResourceAsStream("ff4j.xml"));
ff4j.audit();
Assert.assertTrue(ff4j.exist(F1));
Assert.assertTrue(ff4j.getFeature(F1).isEnable());
// When
ff4j.disable(F1);
// Then
Assert.assertFalse(ff4j.getFeature(F1).isEnable());
}
use of org.ff4j.conf.XmlParser in project ff4j by ff4j.
the class GenerationUtilTest method generationSource.
@Test
public void generationSource() throws IOException {
// Given
FF4j ff4j = new FF4j(new XmlParser(), "ff4j.xml");
Assert.assertNotNull(ff4j.getFeatureStore());
Assert.assertNotNull(ff4j.getPropertiesStore());
// When
String data = GeneratorUtils.generateInterfaceConstantsSource(ff4j);
// Then
Assert.assertTrue(data.contains("FEATURE"));
Assert.assertTrue(data.contains("interface"));
Assert.assertNotNull(GeneratorUtils.exportInterfaceConstants(ff4j));
GeneratorUtils.generateInterfaceConstantFile(ff4j, new File("./target"));
}
use of org.ff4j.conf.XmlParser in project ff4j by ff4j.
the class InMemoryPropertyStoreTest method testProperty.
public void testProperty() {
FF4j ff4j = new FF4j(new XmlParser(), "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.conf.XmlParser in project ff4j by ff4j.
the class FeatureXmlParserTest method testParsingProperties.
@Test
public void testParsingProperties() throws IOException {
// Given
XmlParser parser = new XmlParser();
InputStream in = getClass().getClassLoader().getResourceAsStream("ff4j-parser-properties.xml");
// When
XmlConfig conf = parser.parseConfigurationFile(in);
// Then
Map<String, Feature> features = conf.getFeatures();
Assert.assertNotNull(features);
// Then
Map<String, Property<?>> properties = conf.getProperties();
Assert.assertNotNull(properties);
}
Aggregations