Package org.codehaus.dna.impl

Examples of org.codehaus.dna.impl.DefaultConfiguration


    }

    public void testGetNotExistentChildWithNoAutoCreate()
        throws Exception
    {
        final DefaultConfiguration configuration =
            new DefaultConfiguration( "myElement", "file.xml:20", "" );

        final Configuration test = configuration.getChild( "mychild", false );
        assertEquals( null, test );
    }
View Full Code Here


    }

    public void testGetNotExistentChildWithAutoCreate()
        throws Exception
    {
        final DefaultConfiguration configuration =
            new DefaultConfiguration( "myElement", "file.xml:20", "" );

        final Configuration test = configuration.getChild( "mychild", true );
        assertNotNull( test );
        assertEquals( "mychild", test.getName() );
    }
View Full Code Here

    }

    public void testGuardAgainstMixedContentWhenAddingValue()
        throws Exception
    {
        final DefaultConfiguration configuration =
            new DefaultConfiguration( "myElement", "file.xml:20", "" );
        final DefaultConfiguration child =
            new DefaultConfiguration( "mychild", "file.xml:20", "/myElement" );
        configuration.addChild( child );

        try
        {
            configuration.setValue( "blah" );
View Full Code Here

    }

    public void testGuardAgainstMixedContentWhenAddingChild()
        throws Exception
    {
        final DefaultConfiguration configuration =
            new DefaultConfiguration( "myElement", "file.xml:20", "" );
        final DefaultConfiguration child =
            new DefaultConfiguration( "mychild", "file.xml:20", "/myElement" );
        configuration.setValue( "blah" );

        try
        {
            configuration.addChild( child );
View Full Code Here

    }

    public void testGetChildrenWithName()
        throws Exception
    {
        final DefaultConfiguration configuration =
            new DefaultConfiguration( "myElement", "file.xml:20", "" );
        final DefaultConfiguration child1 =
            new DefaultConfiguration( "mychild", "file.xml:20", "/myElement" );
        final DefaultConfiguration child2 =
            new DefaultConfiguration( "blah", "file.xml:20", "/myElement" );
        final DefaultConfiguration child3 =
            new DefaultConfiguration( "myOtherChild", "file.xml:20", "/myElement" );

        configuration.addChild( child1 );
        configuration.addChild( child2 );
        configuration.addChild( child3 );
View Full Code Here

    }

    public void testGetChildrenWithNameAndNoExistingChildren()
        throws Exception
    {
        final DefaultConfiguration configuration =
            new DefaultConfiguration( "myElement", "file.xml:20", "" );

        final Configuration[] children =
            configuration.getChildren( "mychild" );
        assertEquals( "children.length", 0, children.length );
    }
View Full Code Here

    }

    public void testAutogeneratePath()
        throws Exception
    {
        final DefaultConfiguration configuration =
            new DefaultConfiguration( "myElement", "file.xml:20", "" );

        final Configuration child = configuration.getChild( "test" ).getChild( "blah" );
        assertEquals( "child.path", "/myElement/test", child.getPath() );
        assertTrue( "child.location", child.getLocation().endsWith( "<autogen>" ) );
    }
View Full Code Here

    }

    public void testMakeReadOnlyWithNoChildren()
        throws Exception
    {
        final DefaultConfiguration configuration =
            new DefaultConfiguration( "myElement", "file.xml:20", "" );
        configuration.makeReadOnly();
        assertTrue( "configuration.isReadOnly()", configuration.isReadOnly() );
    }
View Full Code Here

    }

    public void testMakeReadOnlyWithChildren()
        throws Exception
    {
        final DefaultConfiguration configuration =
            new DefaultConfiguration( "myElement", "file.xml:20", "" );

        final DefaultConfiguration child =
            new DefaultConfiguration( "child", "file.xml:20", "/myElement" );
        configuration.addChild( child );

        configuration.makeReadOnly();
        assertTrue( "configuration.isReadOnly()", configuration.isReadOnly() );
        assertTrue( "child.isReadOnly()", child.isReadOnly() );
    }
View Full Code Here

    }

    public void testMakeReadOnlyWithNonFreezableChildren()
        throws Exception
    {
        final DefaultConfiguration configuration =
            new DefaultConfiguration( "myElement", "file.xml:20", "" );

        configuration.addChild( new MockConfiguration() );

        configuration.makeReadOnly();
        assertTrue( "configuration.isReadOnly()", configuration.isReadOnly() );
    }
View Full Code Here

TOP

Related Classes of org.codehaus.dna.impl.DefaultConfiguration

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.