Package org.apache.commons.configuration2.builder

Examples of org.apache.commons.configuration2.builder.FileBasedBuilderParametersImpl


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

        CombinedConfigurationBuilder builder = new CombinedConfigurationBuilder();
        builder.configure(new FileBasedBuilderParametersImpl().setFileName(compositeConfigurationFile));
        Configuration compositeConfiguration = builder.getConfiguration();

        Configuration mapping = new BaseConfiguration();
        Configuration mapping2 = new BaseConfiguration();
View Full Code Here


    private Configuration setupCompositeConfiguration()
            throws ConfigurationException
    {
        CombinedConfigurationBuilder builder =
                new CombinedConfigurationBuilder();
        builder.configure(new FileBasedBuilderParametersImpl()
                .setFile(ConfigurationAssert
                        .getTestFile("testEqualDigester.xml")));
        return builder.getConfiguration();
    }
View Full Code Here

    private static PropertiesConfiguration createTestConfig()
            throws ConfigurationException
    {
        return new FileBasedConfigurationBuilder<PropertiesConfiguration>(
                PropertiesConfiguration.class).configure(
                new FileBasedBuilderParametersImpl().setFile(ConfigurationAssert
                        .getTestFile(TEST_FILE))).getConfiguration();
    }
View Full Code Here

                new ReloadingCombinedConfigurationBuilder();
        builder.configure(parameters
                .combined()
                .setSynchronizer(new ReadWriteSynchronizer())
                .setDefinitionBuilderParameters(
                        new FileBasedBuilderParametersImpl()
                                .setFile(MULTI_DYNAMIC_FILE))
                .registerChildDefaultsHandler(
                        FileBasedBuilderProperties.class,
                        new CopyObjectDefaultHandler(
                                new FileBasedBuilderParametersImpl()
                                        .setReloadingRefreshDelay(1L))));
        CombinedConfiguration config = builder.getConfiguration();
        assertEquals("Wrong property value (1)", "ID0001",
                config.getString("Product/FIIndex/FI[@id='123456781']"));
View Full Code Here

     */
    @Test
    public void testIncludeInSubDir() throws ConfigurationException
    {
        CombinedConfigurationBuilder builder = new CombinedConfigurationBuilder();
        builder.configure(new FileBasedBuilderParametersImpl().setFileName("testFactoryPropertiesInclude.xml"));
        Configuration config = builder.getConfiguration();
        assertTrue(config.getBoolean("deeptest"));
        assertTrue(config.getBoolean("deepinclude"));
        assertFalse(config.containsKey("deeptestinvalid"));
    }
View Full Code Here

        // If the file does not exist, an empty config is created
        assertFalse("File exists", testSaveConf.exists());
        FileBasedConfigurationBuilder<XMLConfiguration> builder =
                new FileBasedConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class, null, true);
        builder.configure(new FileBasedBuilderParametersImpl()
                .setFile(testSaveConf));
        conf = builder.getConfiguration();
        assertTrue(conf.isEmpty());
        conf.addProperty("test", "yes");
        builder.save();
View Full Code Here

    public void testAutoSaveWithSubnodeConfig() throws ConfigurationException
    {
        FileBasedConfigurationBuilder<XMLConfiguration> builder =
                new FileBasedConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class);
        builder.configure(new FileBasedBuilderParametersImpl()
                .setFileName(testProperties));
        conf = builder.getConfiguration();
        builder.getFileHandler().setFile(testSaveConf);
        builder.setAutoSave(true);
        final String newValue = "I am autosaved";
View Full Code Here

    public void testAutoSaveWithSubSubnodeConfig() throws ConfigurationException
    {
        FileBasedConfigurationBuilder<XMLConfiguration> builder =
                new FileBasedConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class);
        builder.configure(new FileBasedBuilderParametersImpl()
                .setFileName(testProperties));
        conf = builder.getConfiguration();
        builder.getFileHandler().setFile(testSaveConf);
        builder.setAutoSave(true);
        final String newValue = "I am autosaved";
View Full Code Here

    public void testAutoSaveAddNodes() throws ConfigurationException
    {
        FileBasedConfigurationBuilder<XMLConfiguration> builder =
                new FileBasedConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class);
        builder.configure(new FileBasedBuilderParametersImpl()
                .setFileName(testProperties));
        conf = builder.getConfiguration();
        builder.getFileHandler().setFile(testSaveConf);
        builder.setAutoSave(true);
        ImmutableNode node = NodeStructureHelper.createNode(
View Full Code Here

            InterruptedException
    {
        FileBasedConfigurationBuilder<XMLConfiguration> builder =
                new FileBasedConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class);
        builder.configure(new FileBasedBuilderParametersImpl()
                .setFileName(testProperties));
        XMLConfiguration config = builder.getConfiguration();
        assertTrue("Property not found",
                config.getProperty("test.short") != null);
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.builder.FileBasedBuilderParametersImpl

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.