Package org.apache.commons.configuration2.io

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


    {
        CompositeConfiguration cc = new CompositeConfiguration();
        PropertiesConfiguration pc = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(pc);
        handler.setFileName(testProperties);
        handler.load();
        cc.addConfiguration(pc);
        conf = cc;
        nonStringTestHolder.setConfiguration(conf);
    }
}
View Full Code Here


            throw new ConfigurationException("Cannot resolve include file "
                    + fileName);
        }

        FileHandler fh = new FileHandler(this);
        fh.load(url);
    }

    /**
     * Tries to obtain the URL of an include file using the specified (optional)
     * base path and file name.
View Full Code Here

    public void testEquals() throws Exception
    {
        PropertiesConfiguration conf = new PropertiesConfiguration();
        FileHandler handler = new FileHandler(conf);
        handler.setFileName(testProperties);
        handler.load();

        String equals = conf.getString("test.equals");
        assertEquals("value=one", equals);
    }
}
View Full Code Here

        ListDelimiterHandler listHandler = new LegacyListDelimiterHandler(',');
        conf1 = new PropertiesConfiguration();
        conf1.setListDelimiterHandler(listHandler);
        FileHandler handler1 = new FileHandler(conf1);
        handler1.setFileName(testProperties);
        handler1.load();
        conf2 = new PropertiesConfiguration();
        conf2.setListDelimiterHandler(listHandler);
        FileHandler handler2 = new FileHandler(conf2);
        handler2.setFileName(testProperties2);
        handler2.load();
View Full Code Here

        handler1.load();
        conf2 = new PropertiesConfiguration();
        conf2.setListDelimiterHandler(listHandler);
        FileHandler handler2 = new FileHandler(conf2);
        handler2.setFileName(testProperties2);
        handler2.load();
        xmlConf = new XMLConfiguration();
        FileHandler handler3 = new FileHandler(xmlConf);
        handler3.load(new File(testPropertiesXML));

        cc.setThrowExceptionOnMissing(true);
View Full Code Here

        FileHandler handler2 = new FileHandler(conf2);
        handler2.setFileName(testProperties2);
        handler2.load();
        xmlConf = new XMLConfiguration();
        FileHandler handler3 = new FileHandler(xmlConf);
        handler3.load(new File(testPropertiesXML));

        cc.setThrowExceptionOnMissing(true);
    }

    @Test
View Full Code Here

    @Before
    public void setUp() throws Exception
    {
        XMLConfiguration config = new XMLConfiguration();
        FileHandler handler = new FileHandler(config);
        handler.load(TEST_FILE);
        parser = new HierarchicalConfigurationXMLReader<ImmutableNode>(config);
    }

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

     * @throws ConfigurationException if an error occurs
     */
    private void load(String fileName) throws ConfigurationException
    {
        FileHandler handler = new FileHandler(config);
        handler.load(fileName);
    }

    @Test
    public void testPublic() throws ConfigurationException
    {
View Full Code Here

        vars.add(new ExprLookup.Variable("String", org.apache.commons.lang3.StringUtils.class));
        vars.add(new ExprLookup.Variable("Util", new Utility("Hello")));
        vars.add(new ExprLookup.Variable("System", "Class:java.lang.System"));
        XMLConfiguration config = new XMLConfiguration();
        FileHandler handler = new FileHandler(config);
        handler.load(TEST_FILE);
        config.setLogger(log);
        ExprLookup lookup = new ExprLookup(vars);
        lookup.setInterpolator(config.getInterpolator());
        lookup.setLogger(log);
        String str = lookup.lookup(PATTERN1);
View Full Code Here

                        : new PropertiesConfiguration();

        FileHandler handler = new FileHandler(config);
        handler.setBasePath(basePath);
        handler.setFileName(fileName);
        handler.load();
        setSystemProperties(config);
    }

    /**
     * Set System properties from a configuration object.
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.