Package org.apache.commons.configuration2.io

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


        XMLConfiguration x3 = new XMLConfiguration(config);
        assertEquals("Wrong element value", "value2.2", x3.getString("key2"));
        assertEquals("Wrong attribute value", "USER2",
                x3.getString("key2[@override]"));
        StringWriter w = new StringWriter();
        new FileHandler(x3).save(w);
        String s = w.toString();
        x3 = new XMLConfiguration();
        new FileHandler(x3).load(new StringReader(s));
        assertEquals("Wrong element value after load", "value2.2",
                x3.getString("key2"));
        assertEquals("Wrong attribute value after load", "USER2",
                x3.getString("key2[@override]"));
    }
View Full Code Here


            InterruptedException
    {
        // populate the test combined configuration
        setUpSourceTest();
        XMLConfiguration xmlConf = new XMLConfiguration();
        new FileHandler(xmlConf).load(ConfigurationAssert
                .getTestFile("test.xml"));
        config.addConfiguration(xmlConf);
        PropertiesConfiguration propConf = new PropertiesConfiguration();
        new FileHandler(propConf).load(ConfigurationAssert
                .getTestFile("test.properties"));
        for (int i = 0; i < 8; i++)
        {
            config.addConfiguration(new BaseHierarchicalConfiguration());
        }
View Full Code Here

     * @return the URL of the include file or <b>null</b> if it cannot be
     *         resolved
     */
    private URL locateIncludeFile(String basePath, String fileName)
    {
        FileLocator includeLocator =
                FileLocatorUtils.fileLocator(locator).sourceURL(null)
                        .basePath(basePath).fileName(fileName).create();
        return FileLocatorUtils.locate(includeLocator);
    }
View Full Code Here

            XMLBeanDeclaration decl =
                    new XMLBeanDeclaration(config, KEY_ENTITY_RESOLVER, true);
            EntityResolver resolver =
                    (EntityResolver) fetchBeanHelper().createBean(decl,
                            CatalogResolver.class);
            FileSystem fileSystem = xmlParams.getFileHandler().getFileSystem();
            if (fileSystem != null)
            {
                BeanHelper.setProperty(resolver, "fileSystem", fileSystem);
            }
            String basePath = xmlParams.getFileHandler().getBasePath();
View Full Code Here

     * @return the URI of the monitored file or <b>null</b> if it cannot be
     *         resolved
     */
    protected String resolveFileURI()
    {
        FileSystem fs = getFileHandler().getFileSystem();
        String uri =
                fs.getPath(null, getFileHandler().getURL(), getFileHandler()
                        .getBasePath(), getFileHandler().getFileName());
        return uri;
    }
View Full Code Here

     * Tests whether a file system can be set.
     */
    @Test
    public void testSetFileSystem()
    {
        FileSystem fs = EasyMock.createMock(FileSystem.class);
        EasyMock.replay(fs);
        FileBasedBuilderParametersImpl params = new FileBasedBuilderParametersImpl();
        assertSame("Wrong result", params, params.setFileSystem(fs));
        assertSame("Wrong file system", fs, params.getFileHandler()
                .getFileSystem());
View Full Code Here

    {
        HierarchicalConfiguration<ImmutableNode> config = new BaseHierarchicalConfiguration();
        config.addProperty("header.entity-resolver[@config-class]",
                EntityResolverWithPropertiesTestImpl.class.getName());
        XMLBuilderParametersImpl xmlParams = new XMLBuilderParametersImpl();
        FileSystem fs = EasyMock.createMock(FileSystem.class);
        String baseDir = ConfigurationAssert.OUT_DIR_NAME;
        xmlParams.setBasePath(baseDir);
        xmlParams.setFileSystem(fs);
        builder.configureEntityResolver(config, xmlParams);
        EntityResolverWithPropertiesTestImpl resolver =
View Full Code Here

            config.addConfiguration(new BaseHierarchicalConfiguration());
        }
        config.getConfiguration(0).addProperty(KEY_CONCURRENT, TEST_NAME);

        // Set a single synchronizer for all involved configurations
        Synchronizer sync = new ReadWriteSynchronizer();
        config.setSynchronizer(sync);
        for (Configuration c : config.getConfigurations())
        {
            c.setSynchronizer(sync);
        }
View Full Code Here

     * @since 2.0
     */
    @Override
    public final Synchronizer getSynchronizer()
    {
        Synchronizer sync = synchronizer;
        return (sync != null) ? sync : NoOpSynchronizer.INSTANCE;
    }
View Full Code Here

            config.addConfiguration(new BaseHierarchicalConfiguration());
        }
        config.getConfiguration(0).addProperty(KEY_CONCURRENT, TEST_NAME);

        // Set a single synchronizer for all involved configurations
        Synchronizer sync = new ReadWriteSynchronizer();
        config.setSynchronizer(sync);
        for (Configuration c : config.getConfigurations())
        {
            c.setSynchronizer(sync);
        }
View Full Code Here

TOP

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

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.