Package org.codehaus.dna.impl

Examples of org.codehaus.dna.impl.DefaultConfiguration


    public void testToElementWithBasicConfiguration()
        throws Exception
    {
        final String name = "meep";
        final DefaultConfiguration configuration = new DefaultConfiguration( name, "", "" );
        final Element element = ConfigurationUtil.toElement( configuration );
        assertEquals( "element.getNodeName()", name, element.getNodeName() );

        final NodeList nodeList = element.getChildNodes();
        assertEquals( "nodeList.getLength()", 0, nodeList.getLength() );
View Full Code Here


    public void testToElementWithConfigurationWithValue()
        throws Exception
    {
        final String name = "meep";
        final String value = "blah";
        final DefaultConfiguration configuration = new DefaultConfiguration( name, "", "" );
        configuration.setValue( value );
        final Element element = ConfigurationUtil.toElement( configuration );
        assertEquals( "element.getNodeName()", name, element.getNodeName() );

        final NodeList nodeList = element.getChildNodes();
        assertEquals( "nodeList.getLength()", 1, nodeList.getLength() );
View Full Code Here

    {
        final String name = "meep";
        final String key = "key";
        final String value = "value";

        final DefaultConfiguration configuration = new DefaultConfiguration( name, "", "" );
        configuration.setAttribute( key, value );

        final Element element = ConfigurationUtil.toElement( configuration );
        assertEquals( "element.getNodeName()", name, element.getNodeName() );

        final NodeList nodeList = element.getChildNodes();
View Full Code Here

        throws Exception
    {
        final String name = "meep";
        final String childName = "moop";

        final DefaultConfiguration configuration = new DefaultConfiguration( name, "", "" );
        final DefaultConfiguration child = new DefaultConfiguration( childName, "", "" );
        configuration.addChild( child );

        final Element element = ConfigurationUtil.toElement( configuration );
        assertEquals( "element.getNodeName()", name, element.getNodeName() );
View Full Code Here

    public void testToElementWithSevereError()
        throws Exception
    {
        final String name = "meep";
        final DefaultConfiguration configuration = new DefaultConfiguration( name, "", "" );

        final String property = System.getProperty( DOC_FACTORY );
        try
        {
            System.setProperty( "javax.xml.parsers.DocumentBuilderFactory",
View Full Code Here

    public void testSerializeToResult()
        throws Exception
    {
        final String name = "meep";
        final DefaultConfiguration configuration = new DefaultConfiguration( name, "", "" );

        final MockInvocationRecorder recorder = new MockInvocationRecorder();
        recorder.addInvocation( SAXMethods.START_DOCUMENT,
                                new Object[ 0 ],
                                null );
View Full Code Here

    public void testEqualsOnEmptyConfigurations()
        throws Exception
    {
        final String name = "x";
        final DefaultConfiguration configuration1 = new DefaultConfiguration( name, "", "" );
        final DefaultConfiguration configuration2 = new DefaultConfiguration( name, "", "" );

        final boolean equal =
            ConfigurationUtil.equals( configuration1, configuration2 );
        assertEquals( "config1 == config2", true, equal );
    }
View Full Code Here

    }

    public void testEqualsWithDifferentNames()
        throws Exception
    {
        final DefaultConfiguration configuration1 = new DefaultConfiguration( "x", "", "" );
        final DefaultConfiguration configuration2 = new DefaultConfiguration( "y", "", "" );

        final boolean equal =
            ConfigurationUtil.equals( configuration1, configuration2 );
        assertEquals( "config1 == config2", false, equal );
    }
View Full Code Here

    }

    public void testEqualsWithAttributes()
        throws Exception
    {
        final DefaultConfiguration configuration1 = new DefaultConfiguration( "x", "", "" );
        configuration1.setAttribute( "key", "value" );
        final DefaultConfiguration configuration2 = new DefaultConfiguration( "x", "", "" );
        configuration2.setAttribute( "key", "value" );

        final boolean equal =
            ConfigurationUtil.equals( configuration1, configuration2 );
        assertEquals( "config1 == config2", true, equal );
    }
View Full Code Here

    }

    public void testEqualsWithDifferentNumberOfAttributes()
        throws Exception
    {
        final DefaultConfiguration configuration1 = new DefaultConfiguration( "x", "", "" );
        configuration1.setAttribute( "key", "value" );
        configuration1.setAttribute( "key2", "value" );
        final DefaultConfiguration configuration2 = new DefaultConfiguration( "x", "", "" );
        configuration2.setAttribute( "key", "value" );

        final boolean equal =
            ConfigurationUtil.equals( configuration1, configuration2 );
        assertEquals( "config1 == config2", false, equal );
    }
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.