Package org.apache.commons.configuration2.io

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


                HierarchicalConfiguration.class, multiBuilder), "Multi");
        XMLConfiguration xml = new XMLConfiguration();
        xml.setExpressionEngine(engine);
        FileHandler handler = new FileHandler(xml);
        handler.setFile(new File(DEFAULT_FILE));
        handler.load();
        config.addConfiguration(xml, "Default");

        verify("1001", config, 15);
        verify("1002", config, 25);
        verify("1003", config, 35);
View Full Code Here


    {
        PropertiesConfiguration c = new PropertiesConfiguration();
        c.setListDelimiterHandler(new LegacyListDelimiterHandler(','));
        FileHandler handler = new FileHandler(c);
        handler.setFileName("threesome.properties");
        handler.load();
        conf = c;
    }

    @Test
    public void testList1() throws Exception
View Full Code Here

    private static FileHandler load(PropertiesConfiguration pc, String fileName)
            throws ConfigurationException
    {
        FileHandler handler = new FileHandler(pc);
        handler.setFileName(fileName);
        handler.load();
        return handler;
    }

    @Test
    public void testLoad() throws Exception
View Full Code Here

    @Test
    public void testAppend() throws Exception
    {
        File file2 = ConfigurationAssert.getTestFile("threesome.properties");
        FileHandler handler = new FileHandler(conf);
        handler.load(file2);
        assertEquals("aaa", conf.getString("test.threesome.one"));
        assertEquals("true", conf.getString("configuration.loaded"));
    }

    /**
 
View Full Code Here

        StringReader in =
                new StringReader(PropertiesConfiguration.getInclude() + " = "
                        + ConfigurationAssert.getTestURL("include.properties"));
        conf = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(conf);
        handler.load(in);
        assertEquals("Include file not loaded", "true",
                conf.getString("include.loaded"));
    }

    /**
 
View Full Code Here

        handlerSave.save(url);

        // reload the configuration
        PropertiesConfiguration config2 = new PropertiesConfiguration();
        FileHandler handlerLoad = new FileHandler(config2);
        handlerLoad.load(url);
        assertEquals("true", config2.getString("configuration.loaded"));
    }

    @Test
    public void testInMemoryCreatedSave() throws Exception
View Full Code Here

    {
        PropertiesConfiguration pc = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(pc);
        handler.setBasePath(testBasePath);
        handler.setFileName("test.properties");
        handler.load();

        assertTrue("Make sure we have multiple keys", pc.getBoolean("test.boolean"));
    }

    @Test
View Full Code Here

    {
        PropertiesConfiguration pc = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(pc);
        handler.setBasePath(testBasePath2);
        handler.setFileName("test.properties");
        handler.load();

        assertTrue("Make sure we have multiple keys", pc.getBoolean("test.boolean"));
    }

    @Test
View Full Code Here

    {
        File file = ConfigurationAssert.getTestFile("test.properties");
        conf.clear();
        FileHandler handler = new FileHandler(conf);
        handler.setFile(file);
        handler.load();

        assertEquals("true", conf.getString("configuration.loaded"));
    }

    @Test(expected = ConfigurationException.class)
View Full Code Here

    @Test
    public void testEscapedKey() throws Exception
    {
        conf.clear();
        FileHandler handler = new FileHandler(conf);
        handler.load(new StringReader("\\u0066\\u006f\\u006f=bar"));

        assertEquals("value of the 'foo' property", "bar", conf.getString("foo"));
    }

    @Test
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.