Package org.apache.commons.configuration2.builder

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


    @Test
    public void testNestedReloadableSources() throws ConfigurationException
    {
        File testFile =
                ConfigurationAssert.getTestFile("testCCReloadingNested.xml");
        builder.configure(new FileBasedBuilderParametersImpl()
                .setFile(testFile));
        builder.getConfiguration();
        CombinedReloadingController rc =
                (CombinedReloadingController) builder.getReloadingController();
        Collection<ReloadingController> subControllers = rc.getSubControllers();
View Full Code Here


     * Tests whether initialization parameters are correctly processed.
     */
    @Test
    public void testInitWithParameters() throws ConfigurationException
    {
        FileBasedBuilderParametersImpl params =
                new FileBasedBuilderParametersImpl();
        params.setFile(ConfigurationAssert
                .getTestFile("testDigesterConfiguration.xml"));
        builder =
                new ReloadingCombinedConfigurationBuilder(
                        params.getParameters());
        CombinedConfiguration cc = builder.getConfiguration();
        assertTrue("Property not found", cc.getBoolean("test.boolean"));
    }
View Full Code Here

    public void testOrderOfProperties() throws Exception
    {
        Collection<Object> beans = new ArrayList<Object>();
        params = new BasicBuilderParameters();
        beans.add(params);
        beans.add(new FileBasedBuilderParametersImpl());
        for (int i = 0; i < 32; i++)
        {
            beans.add(new BasicBuilderParameters());
        }
        MultiWrapDynaBean bean = new MultiWrapDynaBean(beans);
View Full Code Here

    @Test
    public void testNested() throws Exception
    {
        CombinedConfigurationBuilder builder =
                new CombinedConfigurationBuilder();
        builder.configure(new FileBasedBuilderParametersImpl()
                .setFile(ConfigurationAssert.getTestFile(TEST_FILE)));
        Configuration config = builder.getConfiguration();
        Configuration subConf = config.subset("tables.table(0)");
        assertTrue(subConf.getKeys().hasNext());
        Configuration subSubConf = subConf.subset("fields.field(1)");
View Full Code Here

                .setDefinitionBuilderParameters(
                        parameters.fileBased().setFile(TEST_FILE))
                .registerChildDefaultsHandler(
                        FileBasedBuilderProperties.class,
                        new CopyObjectDefaultHandler(
                                new FileBasedBuilderParametersImpl()
                                        .setReloadingRefreshDelay(defRefresh)
                                        .setThrowExceptionOnMissing(true)))
                .registerChildDefaultsHandler(
                        XMLBuilderProperties.class,
                        new CopyObjectDefaultHandler(
View Full Code Here

            throws ConfigurationException
    {
        FileBasedConfigurationBuilder<XMLConfiguration> builder =
                new FileBasedConfigurationBuilder<XMLConfiguration>(
                        XMLConfiguration.class);
        builder.configure(new Parameters().fileBased().setFile(testFile));
        config = builder.getConfiguration();

        CountDownLatch startLatch = new CountDownLatch(1);
        Collection<SubNodeAccessThread> threads =
                new ArrayList<SubNodeAccessThread>();
View Full Code Here

     */
    @Test
    public void testGetDateNoFormatPropertyConversionHandler() throws Exception
    {
        conf.clearProperty(DataConfiguration.DATE_FORMAT_KEY);
        DefaultConversionHandler handler = new DefaultConversionHandler();
        handler.setDateFormat(DATE_PATTERN);
        conf.setConversionHandler(handler);
        assertEquals("Wrong result", expectedDate(), conf.getDate("date.string"));
    }
View Full Code Here

        map.put("key2", "value2");
        map.put("list", "value1, value2");
        map.put("listesc", "value1\\,value2");

        MapConfiguration config = new MapConfiguration(map);
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(','));
        return config;
    }
View Full Code Here

     * from the parent.
     */
    @Test
    public void testSetListDelimiterHandler()
    {
        ListDelimiterHandler handler1 = new DefaultListDelimiterHandler('/');
        ListDelimiterHandler handler2 = new DefaultListDelimiterHandler(';');
        parent.setListDelimiterHandler(handler1);
        setUpSubnodeConfig();
        parent.setListDelimiterHandler(handler2);
        assertEquals("List delimiter handler not obtained from parent",
                handler1, config.getListDelimiterHandler());
View Full Code Here

     */
    @Test
    public void testConfigurationAtWithUpdateInitialized()
    {
        String key = "tables.table";
        config.setListDelimiterHandler(new DefaultListDelimiterHandler(';'));
        config.setThrowExceptionOnMissing(true);
        List<HierarchicalConfiguration<ImmutableNode>> subs =
                config.configurationsAt(key, true);
        BaseHierarchicalConfiguration sub =
                (BaseHierarchicalConfiguration) subs.get(0);
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.