Examples of SAXConfigurationHandler


Examples of org.codehaus.dna.impl.SAXConfigurationHandler

    }

    public void testCreateSimpleConfiguration()
        throws Exception
    {
        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

Examples of org.codehaus.dna.impl.SAXConfigurationHandler

    }

    public void testCreateConfigurationWithValue()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        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

Examples of org.codehaus.dna.impl.SAXConfigurationHandler

    }

    public void testCreateConfigurationWithValueThatIsIntercepted()
        throws Exception
    {
        final SAXConfigurationHandler handler = new MockSAXConfigurationHandler();
        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

Examples of org.codehaus.dna.impl.SAXConfigurationHandler

    }

    public void testCreateConfigurationWithValueInMultipleFragments()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final String qName = "myElement";
        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,
View Full Code Here

Examples of org.codehaus.dna.impl.SAXConfigurationHandler

    }

    public void testCreateConfigurationWithChildElement()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final String qName = "myElement";
        final String childName = "myChild";
        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 );
View Full Code Here

Examples of org.codehaus.dna.impl.SAXConfigurationHandler

    }

    public void testCreateConfigurationWithDeepChildElements()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final String qName = "myElement";
        final String childName = "myChild";
        final String grandChildName = "myGrandChild";
        handler.startElement( "", "", qName, new AttributesImpl() );
        handler.startElement( "", "", childName, new AttributesImpl() );
        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 );
View Full Code Here

Examples of org.codehaus.dna.impl.SAXConfigurationHandler


    public void testCreateConfigurationWithChildElementContaingContent()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final String qName = "myElement";
        final String childName = "myChild";
        final String value = "value";
        handler.startElement( "", "", qName, new AttributesImpl() );
        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 );
View Full Code Here

Examples of org.codehaus.dna.impl.SAXConfigurationHandler

    }

    public void testCreateConfigurationWithMixedContent()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final String qName = "myElement";
        final String childName = "myChild";
        final String value = "value";
        handler.startElement( "", "", qName, new AttributesImpl() );
        handler.characters( value.toCharArray(), 0, value.length() );
        handler.startElement( "", "", childName, new AttributesImpl() );
        handler.endElement( "", "", childName );
        try
        {
            handler.endElement( "", "", qName );
        }
        catch( SAXException e )
        {
            return;
        }
View Full Code Here

Examples of org.codehaus.dna.impl.SAXConfigurationHandler

    }

    public void testClearHandler()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        //TODO: This is a really bad unit test - should test internal state
        handler.clear();
    }
View Full Code Here

Examples of org.codehaus.dna.impl.SAXConfigurationHandler

    }

    public void testCreateConfigurationContainingEmptySeparator()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        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
TOP
Copyright © 2018 www.massapi.com. 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.