@Test public void importProperties_should_be_same_asXMLImport() { InputStream xmlFile = getClass().getClassLoader().getResourceAsStream("test-ff4j-features.xml"); InputStream ymlFile = getClass().getClassLoader().getResourceAsStream("test-ff4j-features.properties"); XmlConfig xmlConfig = new XmlParser().parseConfigurationFile(xmlFile); FF4jConfiguration propsConfig = new PropertiesParser().parseConfigurationFile(ymlFile); assertEquals(xmlConfig.getFeatures().size(), propsConfig.getFeatures().size()); assertEquals(xmlConfig.getProperties().size(), propsConfig.getProperties().size()); Feature f1Xml = xmlConfig.getFeatures().get("first"); Feature f1props = propsConfig.getFeatures().get("first"); assertEquals(f1Xml.getDescription(), f1props.getDescription()); assertEquals(f1Xml.getCustomProperties().size(), f1props.getCustomProperties().size()); Feature f3Xml = xmlConfig.getFeatures().get("third"); Feature f3Props = propsConfig.getFeatures().get("third"); assertEquals( f3Xml.getFlippingStrategy().getClass(), f3Props.getFlippingStrategy().getClass()); assertEquals( f3Xml.getFlippingStrategy().getInitParams().get("expression"), f3Props.getFlippingStrategy().getInitParams().get("expression")); assertEquals( f3Xml.getPermissions(), f3Props.getPermissions()); }
@Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStream); return parseConfiguration(props); } catch (IOException e) { throw new IllegalArgumentException("Cannot read property files"); } }
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStream); return parseConfiguration(props); } catch (IOException e) { throw new IllegalArgumentException("Cannot read property files"); } } }
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStream); return parseConfiguration(props); } catch (IOException e) { throw new IllegalArgumentException("Cannot read property files"); } } PropertiesParser(); }
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStream); return parseConfiguration(props); } catch (IOException e) { throw new IllegalArgumentException("Cannot read property files"); } } PropertiesParser(); @Override InputStream export(FF4jConfiguration ff4jConfig); FF4jConfiguration parseSystemConfiguration(); @Override FF4jConfiguration parseConfigurationFile(InputStream inputStream); FF4jConfiguration parseConfiguration(Properties props); FF4jConfiguration parseConfiguration(Map<String, String> mapProperties); }
PropertiesParser implements FF4jConfigurationParser<FF4jConfiguration> { @Override public FF4jConfiguration parseConfigurationFile(InputStream inputStream) { Util.assertNotNull(inputStream, "Cannot read file stream is empty, check readability and path."); try { Properties props = new Properties(); props.load(inputStream); return parseConfiguration(props); } catch (IOException e) { throw new IllegalArgumentException("Cannot read property files"); } } PropertiesParser(); @Override InputStream export(FF4jConfiguration ff4jConfig); FF4jConfiguration parseSystemConfiguration(); @Override FF4jConfiguration parseConfigurationFile(InputStream inputStream); FF4jConfiguration parseConfiguration(Properties props); FF4jConfiguration parseConfiguration(Map<String, String> mapProperties);  }