Package org.apache.commons.configuration

Examples of org.apache.commons.configuration.HierarchicalConfiguration


    /**
     * Tests fetching the name of the bean factory.
     */
    public void testGetBeanFactoryName()
    {
        HierarchicalConfiguration config = new HierarchicalConfiguration();
        config.addProperty(KEY + "[@config-factory]", "myFactory");
        decl = new XMLBeanDeclaration(config, KEY);
        assertEquals("Wrong factory name", "myFactory", decl
                .getBeanFactoryName());
    }
View Full Code Here


    /**
     * Tests fetching the name of the bean factory if it is undefined.
     */
    public void testGetBeanFactoryNameUndefined()
    {
        decl = new XMLBeanDeclaration(new HierarchicalConfiguration());
        assertNull(decl.getBeanFactoryName());
    }
View Full Code Here

    /**
     * Tests fetching the paramter for the bean factory.
     */
    public void testGetBeanFactoryParameter()
    {
        HierarchicalConfiguration config = new HierarchicalConfiguration();
        config
                .addProperty(KEY + "[@config-factoryParam]",
                        "myFactoryParameter");
        decl = new XMLBeanDeclaration(config, KEY);
        assertEquals("Wrong factory parameter", "myFactoryParameter", decl
                .getBeanFactoryParameter());
View Full Code Here

    /**
     * Tests fetching the paramter for the bean factory if it is undefined.
     */
    public void testGetBeanFactoryParameterUndefined()
    {
        decl = new XMLBeanDeclaration(new HierarchicalConfiguration());
        assertNull(decl.getBeanFactoryParameter());
    }
View Full Code Here

     * Tests if the bean's properties are correctly extracted from the
     * configuration object.
     */
    public void testGetBeanProperties()
    {
        HierarchicalConfiguration config = new HierarchicalConfiguration();
        setupBeanDeclaration(config, KEY, TEST_PROPS, TEST_VALUES);
        decl = new XMLBeanDeclaration(config, KEY);
        checkProperties(decl, TEST_PROPS, TEST_VALUES);
    }
View Full Code Here

     * Tests obtaining the bean's properties when reserved attributes are
     * involved. These should be ignored.
     */
    public void testGetBeanPropertiesWithReservedAttributes()
    {
        HierarchicalConfiguration config = new HierarchicalConfiguration();
        setupBeanDeclaration(config, KEY, TEST_PROPS, TEST_VALUES);
        config.addProperty(KEY + "[@config-testattr]", "yes");
        config.addProperty(KEY + "[@config-anothertest]", "this, too");
        decl = new XMLBeanDeclaration(config, KEY);
        checkProperties(decl, TEST_PROPS, TEST_VALUES);
    }
View Full Code Here

    /**
     * Tests fetching properties if none are defined.
     */
    public void testGetBeanPropertiesEmpty()
    {
        decl = new XMLBeanDeclaration(new HierarchicalConfiguration());
        Map props = decl.getBeanProperties();
        assertTrue("Properties found", props == null || props.isEmpty());
    }
View Full Code Here

     * Creates a configuration with data for testing nested bean declarations.
     * @return the initialized test configuration
     */
    private HierarchicalConfiguration prepareNestedBeanDeclarations()
    {
        HierarchicalConfiguration config = new HierarchicalConfiguration();
        setupBeanDeclaration(config, KEY, TEST_PROPS, TEST_VALUES);
        for (int i = 0; i < COMPLEX_PROPS.length; i++)
        {
            setupBeanDeclaration(config, KEY + '.' + COMPLEX_PROPS[i],
                    COMPLEX_ATTRIBUTES[i], COMPLEX_VALUES[i]);
            config.addProperty(
                    KEY + '.' + COMPLEX_PROPS[i] + "[@config-class]",
                    COMPLEX_CLASSES[i]);
        }
        return config;
    }
View Full Code Here

    /**
     * Tests fetching nested bean declarations.
     */
    public void testGetNestedBeanDeclarations()
    {
        HierarchicalConfiguration config = prepareNestedBeanDeclarations();
        decl = new XMLBeanDeclaration(config, KEY);
        checkProperties(decl, TEST_PROPS, TEST_VALUES);

        Map nested = decl.getNestedBeanDeclarations();
        assertEquals("Wrong number of nested declarations",
View Full Code Here

     * Tests whether the factory method for creating nested bean declarations
     * gets called.
     */
    public void testGetNestedBeanDeclarationsFactoryMethod()
    {
        HierarchicalConfiguration config = prepareNestedBeanDeclarations();
        decl = new XMLBeanDeclaration(config, KEY)
        {
            protected BeanDeclaration createBeanDeclaration(
                    ConfigurationNode node)
            {
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration.HierarchicalConfiguration

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.