Package org.apache.commons.configuration2.io

Examples of org.apache.commons.configuration2.io.FileHandler


     * Tests whether a reloading detector is created correctly.
     */
    @Test
    public void testCreateReloadingDetector() throws ConfigurationException
    {
        FileHandler handler = new FileHandler();
        FileBasedBuilderParametersImpl params =
                new FileBasedBuilderParametersImpl();
        final Long refreshDelay = 10000L;
        params.setReloadingRefreshDelay(refreshDelay);
        FileHandlerReloadingDetector detector =
View Full Code Here


     */
    @Test
    public void testCreateReloadingDetectorDefaultRefreshDelay()
            throws ConfigurationException
    {
        FileHandler handler = new FileHandler();
        FileBasedBuilderParametersImpl params =
                new FileBasedBuilderParametersImpl();
        FileHandlerReloadingDetector detector =
                (FileHandlerReloadingDetector) factory.createReloadingDetector(
                        handler, params);
View Full Code Here

     * @param refreshDelay the refresh delay; a value of 0 means that a check is
     *        performed in all cases
     */
    public FileHandlerReloadingDetector(FileHandler handler, long refreshDelay)
    {
        fileHandler = (handler != null) ? handler : new FileHandler();
        this.refreshDelay = refreshDelay;
    }
View Full Code Here

    public void testCreateReloadingDetectorDefaultFactory() throws ConfigurationException
    {
        ReloadingFileBasedConfigurationBuilder<PropertiesConfiguration> builder =
                new ReloadingFileBasedConfigurationBuilder<PropertiesConfiguration>(
                        PropertiesConfiguration.class);
        FileHandler handler = new FileHandler();
        FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
        long refreshDelay = 60000L;
        params.setReloadingRefreshDelay(refreshDelay);
        FileHandlerReloadingDetector detector =
                (FileHandlerReloadingDetector) builder.createReloadingDetector(
View Full Code Here

    {
        ReloadingDetector detector =
                EasyMock.createMock(ReloadingDetector.class);
        ReloadingDetectorFactory factory =
                EasyMock.createMock(ReloadingDetectorFactory.class);
        FileHandler handler = new FileHandler();
        FileBasedBuilderParametersImpl params =
                new FileBasedBuilderParametersImpl();
        EasyMock.expect(factory.createReloadingDetector(handler, params))
                .andReturn(detector);
        EasyMock.replay(detector, factory);
View Full Code Here

    }

    @Test
    public void testGetProperty() throws Exception
    {
        FileHandler handler = new FileHandler(config);
        handler.setFileName(TEST_FILE);
        handler.load();

        configTest(config);
    }
View Full Code Here

    }

    @Test
    public void testLoadURL() throws Exception
    {
        FileHandler handler = new FileHandler(config);
        handler.load(new File(TEST_FILE).getAbsoluteFile().toURI().toURL());
        configTest(config);
    }
View Full Code Here

    }

    @Test
    public void testLoadBasePath1() throws Exception
    {
        FileHandler handler = new FileHandler(config);
        handler.setBasePath(TEST_DIR);
        handler.setFileName(TEST_FILENAME);
        handler.load();
        configTest(config);
    }
View Full Code Here

    }

    @Test
    public void testLoadBasePath2() throws Exception
    {
        FileHandler handler = new FileHandler(config);
        handler.setBasePath(new File(TEST_FILE).getAbsoluteFile().toURI().toURL().toString());
        handler.setFileName(TEST_FILENAME);
        handler.load();
        configTest(config);
    }
View Full Code Here

    {
        // Number of keys expected from test configuration file
        final int KEY_COUNT = 5;

        // Load the configuration file
        FileHandler handler = new FileHandler(config);
        handler.load(new File(TEST_FILE2).getAbsoluteFile().toURI().toURL());

        // Validate comment in element ignored
        assertEquals("Comment in element must not change element value.", "Case1Text", config
                .getString("case1"));
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.io.FileHandler

Copyright © 2018 www.massapicom. 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.