Package org.codehaus.dna

Examples of org.codehaus.dna.Configuration


    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final String qName = "myElement";
        handler.startElement( "", "", qName, new AttributesImpl() );
        handler.endElement( "", "", qName );
        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
        assertEquals( "configuration.path", "", configuration.getPath() );
    }
View Full Code Here


        final String qName = "myElement";
        final String value = "value";
        handler.startElement( "", "", qName, new AttributesImpl() );
        handler.characters( value.toCharArray(), 0, value.length() );
        handler.endElement( "", "", qName );
        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
        assertEquals( "configuration.path", "", configuration.getPath() );
        assertEquals( "configuration.value", value, configuration.getValue() );
    }
View Full Code Here

        final String qName = "myElement";
        final String value = "value";
        handler.startElement( "", "", qName, new AttributesImpl() );
        handler.characters( value.toCharArray(), 0, value.length() );
        handler.endElement( "", "", qName );
        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
        assertEquals( "configuration.path", "", configuration.getPath() );
        assertEquals( "configuration.value", MockSAXConfigurationHandler.REPLACEMENT,
                      configuration.getValue() );
    }
View Full Code Here

        final String value = "value";
        handler.startElement( "", "", qName, new AttributesImpl() );
        handler.characters( value.toCharArray(), 0, value.length() );
        handler.characters( value.toCharArray(), 0, value.length() );
        handler.endElement( "", "", qName );
        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
        assertEquals( "configuration.path", "", configuration.getPath() );
        assertEquals( "configuration.value",
                      value + value,
                      configuration.getValue() );
    }
View Full Code Here

        handler.startElement( "", "", qName, new AttributesImpl() );
        handler.startElement( "", "", childName, new AttributesImpl() );
        handler.endElement( "", "", childName );
        handler.endElement( "", "", qName );

        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
        assertEquals( "configuration.path", "", configuration.getPath() );
        final Configuration[] children = configuration.getChildren();
        assertEquals( "children.length", 1, children.length );
        assertEquals( "children[ 0 ].name", childName, children[ 0 ].getName() );
        assertEquals( "children[ 0 ].location", "", children[ 0 ].getLocation() );
        assertEquals( "children[ 0 ].path", qName, children[ 0 ].getPath() );
    }
View Full Code Here

        handler.startElement( "", "", grandChildName, new AttributesImpl() );
        handler.endElement( "", "", grandChildName );
        handler.endElement( "", "", childName );
        handler.endElement( "", "", qName );

        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
        assertEquals( "configuration.path", "", configuration.getPath() );
        final Configuration[] children = configuration.getChildren();
        assertEquals( "children.length", 1, children.length );
        assertEquals( "children[ 0 ].name", childName, children[ 0 ].getName() );
        assertEquals( "children[ 0 ].location", "", children[ 0 ].getLocation() );
        assertEquals( "children[ 0 ].path", qName, children[ 0 ].getPath() );
        final Configuration[] grandChildren = children[ 0 ].getChildren();
View Full Code Here

        handler.startElement( "", "", childName, new AttributesImpl() );
        handler.characters( value.toCharArray(), 0, value.length() );
        handler.endElement( "", "", childName );
        handler.endElement( "", "", qName );

        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
        assertEquals( "configuration.path", "", configuration.getPath() );
        final Configuration[] children = configuration.getChildren();
        assertEquals( "children.length", 1, children.length );
        assertEquals( "children[ 0 ].name", childName, children[ 0 ].getName() );
        assertEquals( "children[ 0 ].location", "", children[ 0 ].getLocation() );
        assertEquals( "children[ 0 ].path", qName, children[ 0 ].getPath() );
        assertEquals( "children[ 0 ].value", value, children[ 0 ].getValue() );
View Full Code Here

        final String qName = "myElement";
        final String value = "   \n   \t";
        handler.startElement( "", "", qName, new AttributesImpl() );
        handler.characters( value.toCharArray(), 0, value.length() );
        handler.endElement( "", "", qName );
        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
        assertEquals( "configuration.path", "", configuration.getPath() );
        assertEquals( "configuration.value", null, configuration.getValue( null ) );
    }
View Full Code Here

        for( int i = 0; i < count; i++ )
        {
            final Node node = nodes.item( i );
            if( node instanceof Element )
            {
                final Configuration child = toConfiguration( (Element)node, childPath );
                configuration.addChild( child );
            }
            else if( node instanceof Text )
            {
                final Text data = (Text)node;
View Full Code Here

        final String qName = "myElement";
        final AttributesImpl attributes = new AttributesImpl();
        attributes.addAttribute( "", "", "key", "CDATA", "value" );
        handler.startElement( "", "", qName, attributes );
        handler.endElement( "", "", qName );
        final Configuration configuration = handler.getConfiguration();
        assertEquals( "configuration.name", qName, configuration.getName() );
        assertEquals( "configuration.location", "", configuration.getLocation() );
        assertEquals( "configuration.path", "", configuration.getPath() );
        final String[] names = configuration.getAttributeNames();
        assertEquals( "names.length", 1, names.length );
        assertEquals( "names[0]", "key", names[ 0 ] );
        assertEquals( "configuration.getAttribute( names[ 0 ] )",
                      "value", configuration.getAttribute( names[ 0 ] ) );
    }
View Full Code Here

TOP

Related Classes of org.codehaus.dna.Configuration

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.