Package org.apache.commons.configuration2.io

Examples of org.apache.commons.configuration2.io.FileHandler.load()


        String compositeConfigurationFile = ConfigurationAssert.getTestFile("testSequenceDigester.xml").getAbsolutePath();

        PropertiesConfiguration simpleConfiguration = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(simpleConfiguration);
        handler.setFileName(simpleConfigurationFile);
        handler.load();

        CombinedConfigurationBuilder builder = new CombinedConfigurationBuilder();
        builder.configure(new FileBasedBuilderParametersImpl().setFileName(compositeConfigurationFile));
        Configuration compositeConfiguration = builder.getConfiguration();
View Full Code Here


        String compositeConfigurationFile = ConfigurationAssert.getTestFile("testSequenceDigester.xml").getAbsolutePath();

        PropertiesConfiguration simpleConfiguration = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(simpleConfiguration);
        handler.setFileName(simpleConfigurationFile);
        handler.load();

        CombinedConfigurationBuilder builder = new CombinedConfigurationBuilder();
        builder.configure(new FileBasedBuilderParametersImpl().setFileName(compositeConfigurationFile));
        Configuration compositeConfiguration = builder.getConfiguration();
View Full Code Here

        String compositeConfigurationFile = ConfigurationAssert.getTestFile("testSequenceDigester.xml").getAbsolutePath();

        PropertiesConfiguration simpleConfiguration = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(simpleConfiguration);
        handler.setFileName(simpleConfigurationFile);
        handler.load();

        CombinedConfigurationBuilder builder = new CombinedConfigurationBuilder();
        builder.configure(new FileBasedBuilderParametersImpl().setFileName(compositeConfigurationFile));
        Configuration compositeConfiguration = builder.getConfiguration();
View Full Code Here

    public void setUp() throws Exception
    {
        PropertiesConfiguration c = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(c);
        handler.setFileName(testProperties);
        handler.load();
        conf = c;
        nonStringTestHolder.setConfiguration(conf);
    }
}
View Full Code Here

        handler.setFile(saveFile);
        handler.save();

        config = new XMLConfiguration();
        handler = new FileHandler(config);
        handler.load(saveFile);
        assertEquals(1, config.getMaxIndex("tables.table.name"));
        assertEquals("tests", config.getString("tables.table(0).name"));
        assertEquals("test_name", config.getString("tables.table(0).fields.field(1).name"));
        assertEquals("int", config.getString("tables.table(1).fields.field(0).type"));
        assertTrue(config.getBoolean("tables.table(1).fields.field(1)[@null]"));
View Full Code Here

    @Test
    public void testSaveModified() throws Exception
    {
        FileHandler handler = new FileHandler(config);
        handler.setFile(new File(TEST_FILE3));
        handler.load();

        assertTrue(config.getString("mean").startsWith("This is\n A long story..."));
        assertTrue(config.getString("mean").indexOf("And even longer") > 0);
        config.clearProperty("test.entity[@name]");
        config.setProperty("element", "new value");
View Full Code Here

        File saveFile = folder.newFile(TEST_SAVENAME);
        handler.save(saveFile);
        config = new XMLConfiguration();
        handler = new FileHandler(config);
        handler.load(saveFile.getAbsolutePath());
        assertFalse(config.containsKey("test.entity[@name]"));
        assertEquals("1<2", config.getProperty("test.entity"));
        assertEquals("new value", config.getString("element"));
        assertEquals("A <new> value", config.getProperty("test(0)"));
        assertEquals((short) 8, config.getShort("test(1).short"));
View Full Code Here

    @Test(expected = UnsupportedOperationException.class)
    public void testSetRootElementNameWhenLoadedFromFile() throws Exception
    {
        FileHandler handler = new FileHandler(config);
        handler.setFile(new File(TEST_FILE3));
        handler.load();
        assertEquals("testconfig", config.getRootElementName());
        config.setRootElementName("anotherRootElement");
    }
}
View Full Code Here

    {
        String simpleConfigurationFile = ConfigurationAssert.getTestFile("testEqual.properties").getAbsolutePath();
        PropertiesConfiguration c = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(c);
        handler.setFileName(simpleConfigurationFile);
        handler.load();
        return c;
    }

    private Configuration setupCompositeConfiguration()
            throws ConfigurationException
View Full Code Here

    private static void checkSavedConfig(File file, int expValue)
            throws ConfigurationException
    {
        PropertiesConfiguration config = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(config);
        handler.load(file);
        assertEquals("Configuration was not saved", expValue,
                config.getInt(PROP));
    }

    /**
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.