Package org.jamon

Examples of org.jamon.Renderer


        try {
           
            st = db.prepare( sql );
            rs = st.executeQuery();
           
            Renderer renderer = null;
           
            // xml
            if ( format.equals(Format.XML) ) {
                final TXmlResultSet tpl = new TXmlResultSet();
                tpl.setResultSet( rs );
                renderer = tpl.makeRenderer();
            }

            // csv
            else if ( format.equals(Format.CSV) ) {
                final TCsvResultSet tpl = new TCsvResultSet();
                tpl.setResultSet( rs );
                renderer = tpl.makeRenderer();
            }
           
            // json
            else if ( format.equals(Format.JSON) ) {
                final TResultSet tpl = new TResultSet();
                tpl.setResultSet( rs );
                renderer = tpl.makeRenderer();
            }

            if ( renderer != null )
                return renderer.asString();

        }
       
        catch ( final Exception e ) {
            log.debug( e );
View Full Code Here


        final Properties p = new StringProperties();
        final List<User> users = new ArrayList<User>();

        assertTrue( !render().contains("recentUsers") );

        final Renderer r1 = getTemplate();
        assertTrue( !r1.asString().contains("recentUsers") );

        users.add( new User(1,"foo useR") );
        users.add( new User(1,"bar User") );
        final IFooter tpl1 = new IFooter();
        tpl1.setProperties( p );
View Full Code Here

    public void testGetOutputStream() {
        assertNotNull( res.getOutputStream() );
    }

    public void testShowHtml() throws IOException {
        Renderer tpl = createMock( Renderer.class );
        res.showHtml( tpl );
        assertTrue( out.getResponseSize() > 0 );
    }
View Full Code Here

        res.showHtml( tpl );
        assertTrue( out.getResponseSize() > 0 );
    }

    public void testShowJson() throws IOException {
        Renderer tpl = createMock( Renderer.class );
        res.showJson( tpl );
        assertTrue( out.getResponseSize() > 0 );
    }
View Full Code Here

        res.showJson( tpl );
        assertTrue( out.getResponseSize() > 0 );
    }

    public void testShowText() throws IOException {
        Renderer tpl = createMock( Renderer.class );
        res.showText( tpl );
        assertTrue( out.getResponseSize() > 0 );
    }
View Full Code Here

        res.showText( tpl );
        assertTrue( out.getResponseSize() > 0 );
    }

    public void testShowRss() throws IOException {
        Renderer tpl = createMock( Renderer.class );
        res.showRss( tpl );
        assertTrue( out.getResponseSize() > 0 );
    }
View Full Code Here

        res.showRss( tpl );
        assertTrue( out.getResponseSize() > 0 );
    }

    public void testShowTemplateWithContentType() throws IOException {
        Renderer tpl = createMock( Renderer.class );
        res.showTemplate( tpl, "text/plain" );
        assertTrue( out.getResponseSize() > 0 );
    }
View Full Code Here

        res.showTemplate( tpl, "text/plain" );
        assertTrue( out.getResponseSize() > 0 );
    }

    public void testShowTemplate() throws IOException {
        Renderer tpl = getRenderer();
        res.showTemplate( tpl );
        // TODO: not sure how to test this...
        //assertTrue( out.getResponseSize() > 0 );
    }
View Full Code Here

        //assertTrue( out.getResponseSize() > 0 );
    }

    private Renderer getRenderer() {
       
        return new Renderer() {
            public String asString() { return ""; }
            public void renderTo( java.io.Writer r ) throws IOException {
                r.write('c');
            }
        };
View Full Code Here

TOP

Related Classes of org.jamon.Renderer

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.