Package com.volantis.mcs.protocols

Examples of com.volantis.mcs.protocols.TestDOMOutputBuffer


    /**
     * Tests the retrieval of a menu as a menu item for displaying
     */
    public void testGetAsMenuItem() {
        // Setup a label
        DOMOutputBuffer buffer = new TestDOMOutputBuffer();
        buffer.appendEncoded("test");
        ConcreteMenuLabel menuLabel = MenuModelHelper.createMenuLabel(buffer);
        // Setup the menu title
        String title = "test menu";

        // Create a test menu
View Full Code Here


    }

    public void doTestDissectionElement(WBSAXDissectionElementProcessor
            processor, String attributeValue) throws Exception {
        // Create <p><da {na}><a href="[url]"/></da></p>
        TestDOMOutputBuffer buffer = new TestDOMOutputBuffer();
        Element p = buffer.openElement("p");
        Element da = domFactory.createElement();
        da.setName("da");
        NodeAnnotation na = new NodeAnnotation() {};
        da.setObject(na);
        buffer.openElement(da);
        Element a = buffer.openElement("a");
        a.setAttribute("href", "[url]");
        buffer.closeElement(a);
        buffer.closeElement(da);
        buffer.closeElement(p);
       
        StringWriter out = new StringWriter();
        context.setContentHandler(new TestDebugProducer(out));
        outputter.addSpecialElementProcessor("da", processor);
        p.accept(outputter);
View Full Code Here

     * tests.
     *
     * @return A new instance of a suitable output buffer.
     */
    protected OutputBuffer createOutputBuffer() {
        return new TestDOMOutputBuffer();
    }
View Full Code Here

     * @param buffer The buffer to be converted to a string
     * @return       A string representation of the contents of the buffer
     * @throws IOException If there is a problem creating the output string
     */
    protected String bufferToString(MenuBuffer buffer) throws IOException {
        TestDOMOutputBuffer outputBuffer =
                (TestDOMOutputBuffer) buffer.getOutputBuffer();
        return DOMUtilities.toString(outputBuffer.getRoot());
    }
View Full Code Here

     * @throws Exception If there is a problem rendering or with any test assert
     */
    private void testRenderer(SeparatorRenderer renderer,
                              String expected) throws Exception {
        // Create the test buffer
        TestDOMOutputBuffer testBuffer = new TestDOMOutputBuffer();

        // Start span element
        testBuffer.openElement("span");

        // Render using the test buffer
        renderer.render(testBuffer);

        // End span element
        testBuffer.closeElement("span");

        // Extract the output from the rendering as a string.
        String actual = DOMUtilities.toString(testBuffer.getRoot());
        assertNotNull("The actual string should exist", actual);

        // Normalise expected - this requires that all input strings contain
        // some markup otherwise the test will fail on this string conversion!
        expected = DOMUtilities.provideDOMNormalizedString("<span>" +
View Full Code Here

     * Provides an output buffer that can be used in the testing.
     *
     * @return an output buffer for the testing
     */
    protected OutputBuffer createOutputBuffer() {
        return new TestDOMOutputBuffer();
    }
View Full Code Here

     * @return a string of the markup from the given buffer's output buffer
     */
    protected String toString(MenuBuffer buffer)
        throws IOException {

        TestDOMOutputBuffer outputBuffer =
                (TestDOMOutputBuffer) buffer.getOutputBuffer();
        return DOMUtilities.toString(outputBuffer.getRoot());
    }
View Full Code Here

        builder.setNormalImageURL(new LiteralImageAssetReference("normal.gif"));
        builder.setOverImageURL(new LiteralImageAssetReference("over.gif"));
        builder.endIcon();
        builder.startText();

        OutputBuffer buffer = new TestDOMOutputBuffer();
        buffer.writeText("text");

        builder.setText(buffer);
        builder.endText();
        builder.endLabel();
        builder.setHref(new LiteralLinkAssetReference("href.xml"));
View Full Code Here

        builder.setHref(new LiteralLinkAssetReference(href));

        builder.startLabel();

        builder.startText();
        DOMOutputBuffer dom = new TestDOMOutputBuffer();
        dom.writeText(text);
        builder.setText(dom);
        builder.endText();

        builder.startIcon();
        // this is required or we crash trying to extract the element name in
View Full Code Here

                = new DefaultMenuItemRendererSelector(
                        itemRendererFactory, separatorRendererSelector);
        DeprecatedDivOutput divOutput = new TestDeprecatedDivOutput();
        bracketingRenderer
                = new DefaultMenuBracketingRenderer(divOutput);
        DOMOutputBuffer outputBuffer = new TestDOMOutputBuffer();
        OutputBufferResolver bufferResolver
                = new TestOutputBufferResolver(outputBuffer);
        bufferLocatorFactory
                = new DefaultMenuBufferLocatorFactory(bufferResolver);
    }
View Full Code Here

TOP

Related Classes of com.volantis.mcs.protocols.TestDOMOutputBuffer

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.