Package org.apache.maven.doxia.sink

Examples of org.apache.maven.doxia.sink.SinkEventElement


        Iterator<SinkEventElement> it = sink.getEventList().iterator();

        assertEquals( it, "head", "title", "text", "title_", "comment", "author", "text", "author_" );

        SinkEventElement unknown = it.next();
        assertEquals( "unknown", unknown.getName() );
        assertEquals( "meta", unknown.getArgs()[0] );

        unknown = it.next();
        assertEquals( "unknown", unknown.getName() );
        assertEquals( "base", unknown.getArgs()[0] );

        assertEquals( it, "head_", "body", "body_" );
        assertFalse( it.hasNext() );

        // DOXIA-359
        text = "<document>"
                + "<properties><title>properties title</title></properties>"
                + "<head><title>head title</title></head>"
                + "<body></body></document>";

        sink.reset();
        parser.parse( text, sink );

        it = sink.getEventList().iterator();

        assertEquals( it, "head", "title" );

        SinkEventElement title = it.next();
        assertEquals( "text", title.getName() );
        assertEquals( "properties title", title.getArgs()[0] );

        assertEquals( it, "title_", "head_", "body""body_" );
        assertFalse( it.hasNext() );
    }
View Full Code Here


        Iterator<SinkEventElement> it = sink.getEventList().iterator();

        assertEquals( it, "anchor", "anchor_" );

        SinkEventElement next = it.next();
        assertEquals( "section1", next.getName() );
        SinkEventAttributeSet set = (SinkEventAttributeSet) next.getArgs()[0];
        assertEquals( 3, set.getAttributeCount() );
        assertTrue( set.containsAttribute( "name", "section name" ) );
        assertTrue( set.containsAttribute( "class", "foo" ) );
        assertTrue( set.containsAttribute( "id", "bar" ) );

        next = it.next();
        assertEquals( "sectionTitle1", next.getName() );
        assertNull( (SinkEventAttributeSet) next.getArgs()[0] );

        assertEquals( it, "text", "sectionTitle1_", "section1_" );
        assertFalse( it.hasNext() );
    }
View Full Code Here

        parser.setValidate( false );
        parser.parse( text, sink );
       
        Iterator<SinkEventElement> it = sink.getEventList().iterator();
        SinkEventElement styleElm = it.next();
        assertEquals( "unknown", styleElm.getName() );
        assertEquals( "style", styleElm.getArgs()[0] );
        SinkEventElement cdataElm = it.next();
        assertEquals( "unknown", cdataElm.getName() );
        assertEquals( "CDATA", cdataElm.getArgs()[0] );
        SinkEventElement styleElm_ = it.next();
        assertEquals( "unknown", styleElm_.getName() );
        assertEquals( "style", styleElm_.getArgs()[0] );
        assertFalse( it.hasNext() );
    }
View Full Code Here

        assertEquals( "paragraph", ( it.next() ).getName() );
        assertEquals( "bold", ( it.next() ).getName() );
        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "bold_", ( it.next() ).getName() );

        SinkEventElement el = it.next();
        assertEquals( "text", el.getName() );
        assertEquals( " "(String) el.getArgs()[0] );

        assertEquals( "italic", ( it.next() ).getName() );
        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "italic_", ( it.next() ).getName() );
        assertEquals( "paragraph_", ( it.next() ).getName() );
        assertFalse( it.hasNext() );


        // same test with EOL
        text = "<para><command>word</command>" + EOL + "<emphasis>word</emphasis></para>";

        sink.reset();
        parser.parse( text, sink );
        it = sink.getEventList().iterator();

        assertEquals( "paragraph", ( it.next() ).getName() );
        assertEquals( "bold", ( it.next() ).getName() );
        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "bold_", ( it.next() ).getName() );

        el = it.next();
        assertEquals( "text", el.getName() );
        assertEquals( EOL,  (String) el.getArgs()[0] );

        assertEquals( "italic", ( it.next() ).getName() );
        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "italic_", ( it.next() ).getName() );
        assertEquals( "paragraph_", ( it.next() ).getName() );
View Full Code Here

        final SinkEventTestingSink sink = new SinkEventTestingSink();
        parser.parse( text, sink );
        Iterator<SinkEventElement> it = sink.getEventList().iterator();

        SinkEventElement event = it.next();
        assertEquals( "head", event.getName() );
        assertEquals( " id=article", event.getArgs()[0].toString() );
        assertEquals( "head_", ( it.next() ).getName() );
        assertEquals( "body", ( it.next() ).getName() );

        event = it.next();
        assertEquals( "section1", event.getName() );
        assertEquals( " id=section", event.getArgs()[0].toString() );

        event = it.next();
        assertEquals( "sectionTitle1", event.getName() );
        assertEquals( " id=title", event.getArgs()[0].toString() );
        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "sectionTitle1_", ( it.next() ).getName() );

        event = it.next();
        assertEquals( "paragraph", event.getName() );
        assertEquals( " id=para", event.getArgs()[0].toString() );
        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "paragraph_", ( it.next() ).getName() );
        assertEquals( "section1_", ( it.next() ).getName() );
        assertEquals( "body_", ( it.next() ).getName() );
View Full Code Here

        assertEquals( "anchor", ( it.next() ).getName() );
        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "anchor_", ( it.next() ).getName() );
        assertEquals( "text", ( it.next() ).getName() );

        SinkEventElement event = it.next();
        assertEquals( "link", event.getName() );
        assertEquals( "#Anchor", event.getArgs()[0].toString() );

        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "link_", ( it.next() ).getName() );
        assertEquals( "text", ( it.next() ).getName() );

        event = it.next();
        assertEquals( "link", event.getName() );
        assertEquals( "url.com", event.getArgs()[0].toString() );
        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "link_", ( it.next() ).getName() );
        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "paragraph_", ( it.next() ).getName() );
        assertFalse( it.hasNext() );
View Full Code Here

        text = "<orderedlist numeration=\"upperalpha\"><listitem><para>item</para></listitem></orderedlist>";
        sink.reset();
        parser.parse( text, sink );
        it = sink.getEventList().iterator();

        SinkEventElement event = it.next();
        assertEquals( "numberedList", event.getName() );
        assertEquals( Sink.NUMBERING_UPPER_ALPHA, ( (Integer) event.getArgs()[0] ).intValue() );
        assertEquals( "numberedListItem", ( it.next() ).getName() );
        assertEquals( "text", ( it.next() ).getName() );
        assertEquals( "numberedListItem_", ( it.next() ).getName() );
        assertEquals( "numberedList_", ( it.next() ).getName() );
        assertFalse( it.hasNext() );
View Full Code Here

        MacroRequest request = new MacroRequest( macroParameters, new File( "." ) );

        new EchoMacro().execute( sink, request );

        Iterator<SinkEventElement> it = sink.getEventList().iterator();
        SinkEventElement event = it.next();
        assertEquals( "verbatim", event.getName() );
        event = it.next();
        assertEquals( "text", event.getName() );
        assertEquals( "echo" + Macro.EOL,  (String) event.getArgs()[0] );
        event = it.next();
        assertEquals( "text", event.getName() );
        assertEquals( "paramName ---> paramValue" + Macro.EOL,  (String) event.getArgs()[0] );
        event = it.next();
        assertEquals( "verbatim_", event.getName() );
        assertFalse( it.hasNext() );
    }
View Full Code Here

        }

        macro.execute( sink, request );

        Iterator<SinkEventElement> it = sink.getEventList().iterator();
        SinkEventElement event = it.next();

        assertEquals( "rawText", event.getName() );
        assertFalse( it.hasNext() );

        request = new MacroRequest( new HashMap<String, Object>(), new File( "." ) );
        sink.reset();

        macro.execute( sink, request );

        it = sink.getEventList().iterator();
        event = it.next();

        assertEquals( "rawText", event.getName() );
        assertFalse( it.hasNext() );
    }
View Full Code Here

        macro.required( "src", "value" );

        macro.execute( sink, request );

        Iterator<SinkEventElement> it = sink.getEventList().iterator();
        SinkEventElement event = it.next();

        assertEquals( "rawText", event.getName() );
        assertFalse( it.hasNext() );

        request = new MacroRequest( new HashMap<String, Object>(), new File( "." ) );
        sink.reset();

        macro.execute( sink, request );

        it = sink.getEventList().iterator();
        event = it.next();

        assertEquals( "rawText", event.getName() );
        assertFalse( it.hasNext() );
    }
View Full Code Here

TOP

Related Classes of org.apache.maven.doxia.sink.SinkEventElement

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.