Package org.apache.commons.configuration2.beanutils

Examples of org.apache.commons.configuration2.beanutils.BeanFactory


            catch (ConfigurationRuntimeException iex)
            {
                // the passed in key does not map to exactly one node
                // obtain the node for the section, create it on demand
                InMemoryNodeModel parentModel = getSubConfigurationParentModel();
                NodeSelector selector = parentModel.trackChildNodeWithCreation(null, name, this);
                return createSubConfigurationForTrackedNode(selector, this);
            }
        }
    }
View Full Code Here


     * @return the sub configuration for the global section
     */
    private SubnodeConfiguration getGlobalSection()
    {
        InMemoryNodeModel parentModel = getSubConfigurationParentModel();
        NodeSelector selector = new NodeSelector(null); // selects parent
        parentModel.trackNode(selector, this);
        GlobalSectionNodeModel model =
                new GlobalSectionNodeModel(this, selector);
        SubnodeConfiguration sub = new SubnodeConfiguration(this, model);
        initSubConfigurationForThisParent(sub);
View Full Code Here

        x1.addProperty("key2", "value2");
        x1.addProperty("key2[@override]", "USER2");
        XMLConfiguration x2 = new XMLConfiguration();
        x2.addProperty("key2", "value2.2");
        x2.addProperty("key2[@override]", "USER2");
        config.setNodeCombiner(new OverrideCombiner());
        config.addConfiguration(x2);
        config.addConfiguration(x1);
        XMLConfiguration x3 = new XMLConfiguration(config);
        assertEquals("Wrong element value", "value2.2", x3.getString("key2"));
        assertEquals("Wrong attribute value", "USER2",
View Full Code Here

     */
    private TrackedNodeModel setUpTrackedModel(NodeSelector selector)
    {
        InMemoryNodeModel parentModel = (InMemoryNodeModel) parent.getModel();
        parentModel.trackNode(selector, parent);
        return new TrackedNodeModel(parent, selector, true);
    }
View Full Code Here

    public void testClone()
    {
        setUpSubnodeConfig();
        SubnodeConfiguration copy = (SubnodeConfiguration) config.clone();
        assertNotSame("Same model", config.getModel(), copy.getModel());
        TrackedNodeModel subModel = (TrackedNodeModel) copy.getModel();
        assertEquals("Wrong selector", SELECTOR, subModel.getSelector());
        InMemoryNodeModel parentModel = (InMemoryNodeModel) parent.getModel();
        assertEquals("Wrong parent model", parentModel,
                subModel.getParentModel());

        // Check whether the track count was increased
        parentModel.untrackNode(SELECTOR);
        parentModel.untrackNode(SELECTOR);
        assertTrue("Wrong finalize flag",
                subModel.isReleaseTrackedNodeOnFinalize());
    }
View Full Code Here

     * Tests whether the configuration can be closed.
     */
    @Test
    public void testClose()
    {
        TrackedNodeModel model = EasyMock.createMock(TrackedNodeModel.class);
        EasyMock.expect(model.getSelector()).andReturn(SELECTOR).anyTimes();
        model.close();
        EasyMock.replay(model);

        SubnodeConfiguration config = new SubnodeConfiguration(parent, model);
        config.close();
        EasyMock.verify(model);
View Full Code Here

     * Tests if setting a node combiner causes an invalidation.
     */
    @Test
    public void testSetNodeCombiner()
    {
        NodeCombiner combiner = new UnionCombiner();
        config.setNodeCombiner(combiner);
        assertSame("Node combiner was not set", combiner, config
                .getNodeCombiner());
        listener.checkEvent(1, 0);
    }
View Full Code Here

     */
    @Test
    public void testSetNodeCombinerSynchronized()
    {
        SynchronizerTestImpl sync = setUpSynchronizerTest();
        config.setNodeCombiner(new UnionCombiner());
        sync.verify(Methods.BEGIN_WRITE, Methods.END_WRITE);
        checkCombinedRootNotConstructed();
    }
View Full Code Here

     * Tests changing the expression engine.
     */
    @Test
    public void testSetExpressionEngine()
    {
        parent.setExpressionEngine(new XPathExpressionEngine());
        setUpSubnodeConfig("tables/table[1]");
        assertEquals("Wrong field name", NodeStructureHelper.field(0, 1),
                config.getString("fields/field[2]/name"));
        Set<String> keys = ConfigurationAssert.keysToSet(config);
        assertEquals("Wrong number of keys", 2, keys.size());
View Full Code Here

     */
    @Test
    public void testParentChangeDetatchException()
    {
        setUpSubnodeConfig();
        parent.setExpressionEngine(new XPathExpressionEngine());
        parent.addProperty("newProp", "value");
        checkSubConfigContent();
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.configuration2.beanutils.BeanFactory

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.