Package com.opensymphony.module.sitemesh

Examples of com.opensymphony.module.sitemesh.SitemeshBuffer


/**
*/
public class ChainingBufferTest extends TestCase {
    public void testSimpleChain() throws Exception {
        SitemeshBuffer buffer = newSitemeshBuffer("1234", 2, newBufferFragment("ab"));
        assertEquals("12ab34", getContent(buffer));
        assertCorrectLength(buffer);
    }
View Full Code Here


        assertEquals("12ab34", getContent(buffer));
        assertCorrectLength(buffer);
    }

    public void testBefore() throws Exception {
        SitemeshBuffer buffer = newSitemeshBuffer("1234", 2, newBufferFragment("ab"));
        assertEquals("1", getContent(buffer, 0, 1));
        assertEquals("12ab", getContent(buffer, 0, 2));
    }
View Full Code Here

        assertEquals("1", getContent(buffer, 0, 1));
        assertEquals("12ab", getContent(buffer, 0, 2));
    }

    public void testAfter() throws Exception {
        SitemeshBuffer buffer = newSitemeshBuffer("1234", 2, newBufferFragment("ab"));
        assertEquals("ab34", getContent(buffer, 2, 2));
        assertEquals("4", getContent(buffer, 3, 1));
    }
View Full Code Here

        assertEquals("ab34", getContent(buffer, 2, 2));
        assertEquals("4", getContent(buffer, 3, 1));
    }

    public void testFragment() throws Exception {
        SitemeshBuffer buffer = newSitemeshBuffer("1234", 2, newBufferFragment("abcd", 1, 2));
        assertEquals("12bc34", getContent(buffer));
        assertCorrectLength(buffer);
    }
View Full Code Here

        assertEquals("12bc34", getContent(buffer));
        assertCorrectLength(buffer);
    }

    public void testDeepFragments() throws Exception {
        SitemeshBuffer buffer = newSitemeshBuffer("123456789",
                3, newBufferFragment("abcdefg",
                        4, newBufferFragment("hijklm", 1, 1),
                        5, newBufferFragment("nopqr", 1, 4)),
                8, newBufferFragment("tuzwx", 0, 2));
        assertEquals("123abcdieopqrfg45678tu9", getContent(buffer));
View Full Code Here

        assertEquals("123abcdieopqrfg45678tu9", getContent(buffer));
        assertCorrectLength(buffer);
    }

    public void testWriter() throws Exception {
        SitemeshBuffer buffer = newSitemeshBuffer("123456");
        SitemeshBufferWriter writer = new SitemeshBufferWriter();
        writer.write("abc");
        writer.writeSitemeshBufferFragment(new SitemeshBufferFragment(buffer, 1, 4));
        writer.write("def");
        assertEquals("abcdef", writer.toString());
View Full Code Here

public class HTMLProcessorTest extends TestCase {

    private SitemeshBufferFragment.Builder body;

    private HTMLProcessor createProcessor(String input) {
        SitemeshBuffer buffer = new StringSitemeshBuffer(input);
        body = SitemeshBufferFragment.builder().setBuffer(buffer);
        return new HTMLProcessor(buffer, body);
    }
View Full Code Here

public class RegexReplacementTextFilterTest extends TestCase {

    private SitemeshBufferFragment.Builder body;

    private HTMLProcessor createProcessor(String input) {
        SitemeshBuffer buffer = new DefaultSitemeshBuffer(input.toCharArray());
        body = SitemeshBufferFragment.builder().setBuffer(buffer);
        return new HTMLProcessor(buffer, body);
    }
View Full Code Here

    public boolean isUsingStream() {
        return pageResponseWrapper.isUsingStream();
    }

    public Content getContent() throws IOException {
        SitemeshBuffer content = pageResponseWrapper.getContents();
        if (content != null) {
            return contentProcessor.build(content, webAppContext);
        } else {
            return null;
        }
View Full Code Here

TOP

Related Classes of com.opensymphony.module.sitemesh.SitemeshBuffer

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.