Package org.codehaus.dna.impl

Examples of org.codehaus.dna.impl.SAXConfigurationHandler


    }

    public void testCreateConfigurationWithAttributes()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        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 );
View Full Code Here


    }

    public void testCreateConfigurationWithAttributesWithInterception()
        throws Exception
    {
        final SAXConfigurationHandler handler = new MockSAXConfigurationHandler();
        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 );
View Full Code Here

    extends TestCase
{
    public void testGetLocationWithNullLocator()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final String location = handler.getLocationDescription();
        assertEquals( "location", "", location );
    }
View Full Code Here

    }

    public void testGetLocationWithNullSystemId()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        handler.setDocumentLocator( new MockLocator( null ) );
        final String location = handler.getLocationDescription();
        assertEquals( "location", "", location );
    }
View Full Code Here

    }

    public void testGetLocationWithNonNullSystemId()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        handler.setDocumentLocator( new MockLocator( "file.xml" ) );
        final String location = handler.getLocationDescription();
        assertEquals( "location", "file.xml", location );
    }
View Full Code Here

    }

    public void testGetLocationWithLineSet()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final MockLocator locator = new MockLocator( "file.xml" );
        locator.setLineNumber( 23 );
        handler.setDocumentLocator( locator );
        final String location = handler.getLocationDescription();
        assertEquals( "location", "file.xml:23", location );
    }
View Full Code Here

    }

    public void testGetLocationWithColSet()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final MockLocator locator = new MockLocator( "file.xml" );
        locator.setLineNumber( 23 );
        locator.setColumnNumber( 15 );
        handler.setDocumentLocator( locator );
        final String location = handler.getLocationDescription();
        assertEquals( "location", "file.xml:23:15", location );
    }
View Full Code Here

    }

    public void testGetLocationWithColSetButLineNotSet()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final MockLocator locator = new MockLocator( "file.xml" );
        locator.setColumnNumber( 15 );
        handler.setDocumentLocator( locator );
        final String location = handler.getLocationDescription();
        assertEquals( "location", "file.xml", location );
    }
View Full Code Here

    }

    public void testWarningRethrowsException()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final SAXParseException spe = new SAXParseException( "", null );
        try
        {
            handler.warning( spe );
        }
        catch( final SAXException se )
        {
            assertEquals( spe, se );
            return;
View Full Code Here

    }

    public void testErrorRethrowsException()
        throws Exception
    {
        final SAXConfigurationHandler handler = new SAXConfigurationHandler();
        final SAXParseException spe = new SAXParseException( "", null );
        try
        {
            handler.error( spe );
        }
        catch( final SAXException se )
        {
            assertEquals( spe, se );
            return;
View Full Code Here

TOP

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

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.