use of org.ff4j.conf.XmlParser in project ff4j by ff4j.
the class FeatureXmlParserTest method importThenExport.
@Test
public void importThenExport() throws IOException {
// Given
XmlParser parser = new XmlParser();
InputStream in = getClass().getClassLoader().getResourceAsStream("test-featureXmlParserTest-import-export.xml");
Map<String, Feature> features = parser.parseConfigurationFile(in).getFeatures();
Assert.assertNotNull(features);
// When
InputStream in2 = parser.exportFeatures(features);
// Then
// output is OK
Map<String, Feature> features2 = parser.parseConfigurationFile(in2).getFeatures();
Assert.assertNotNull(features2);
Assert.assertEquals(features.size(), features2.size());
}
use of org.ff4j.conf.XmlParser in project ff4j by ff4j.
the class FeatureXmlParserTest method importThenExportALL.
@Test
public void importThenExportALL() throws IOException {
// Given
XmlParser parser = new XmlParser();
InputStream in = getClass().getClassLoader().getResourceAsStream("ff4j-parser-all.xml");
XmlConfig conf = parser.parseConfigurationFile(in);
Assert.assertNotNull(conf.getFeatures());
Assert.assertNotNull(conf.getProperties());
// When
InputStream in3 = parser.exportAll(conf);
// Then
XmlConfig conf2 = parser.parseConfigurationFile(in3);
Assert.assertNotNull(conf2.getFeatures());
Assert.assertNotNull(conf2.getProperties());
}
use of org.ff4j.conf.XmlParser in project ff4j by ff4j.
the class FeatureXmlParserTest method testLoaderLoadInvalidStream.
@Test(expected = IllegalArgumentException.class)
public void testLoaderLoadInvalidStream() throws IOException {
InputStream in = getClass().getClassLoader().getResourceAsStream("test-featureXmlParserTest-ok.xml");
in.close();
new XmlParser().parseConfigurationFile(in);
}
use of org.ff4j.conf.XmlParser in project ff4j by ff4j.
the class FF4jDroolsKBaseXml method testDroolsStrategyFromkBaseName.
@Test
public void testDroolsStrategyFromkBaseName() {
// Given
FF4j ff4j = new FF4j(new XmlParser(), "ff4j-kbase.xml");
// When
Assert.assertTrue(ff4j.exist("f1"));
// Then
Assert.assertTrue(ff4j.check("f1"));
}
Aggregations