Package com.volantis.mcs.dom

Examples of com.volantis.mcs.dom.StyledDOMTester


            String inputXml,
            String expectedStyledElements,
            List indexedProperties,
            final String deviceCSS) {

        StyledDOMTester styledDOMTester = new StyledDOMTester();
        Document actualXml = styledDOMTester.parseFull(inputXml);

        checkNormalization(actualXml, expectedStyledElements, indexedProperties, deviceCSS);

    }
View Full Code Here


        final StylingFactory factory = StylingFactory.getDefaultInstance();
        attrs.setStyles(factory.createStyles(factory.createPropertyValues(
                StylePropertyDetails.getDefinitions())));
        protocol.doHorizontalRule(buffer, attrs);
        document.addNode(buffer.getRoot());
        StyledDOMTester tester = new StyledDOMTester();
        String output = tester.render(document);
        String expected =
                "<BLOCK>" +
                    "--------" +
                "</BLOCK>";
        assertEquals("Wrong output in doHorizontalRule method",
                tester.normalize(expected), output);
    }
View Full Code Here

        Element root = buffer.getRoot();
        if (root.getName() == null) {
            root.setName("testRoot");
        }
        document.addNode(root);
        StyledDOMTester tester = new StyledDOMTester(true);
        final String result = tester.render(document);

        assertEquals(tester.normalize(getExpectedXFSelectString()), result);
    }
View Full Code Here

        final StylingFactory factory = StylingFactory.getDefaultInstance();
        attrs.setStyles(factory.createStyles(factory.createPropertyValues(
                StylePropertyDetails.getDefinitions())));
        renderer.doFragmentLink(buffer, attrs);

        StyledDOMTester tester = new StyledDOMTester();

        String expected =
                "<BLOCK style='white-space: nowrap'>" +
                  "<select title=\"x\">" +
                    "<option onpick=\"" + href + "\" title=\"x\">" +
                      text +
                    "</option>" +
                  "</select>" +
                "</BLOCK>";
        String actual = tester.render(buffer.getRoot());
        assertEquals("Openwave Fragment Link not rendering correctly",
                tester.normalize(expected), actual);
    }
View Full Code Here

        new Volantis();

        MutableStylePropertySet interestingProperties =
                new MutableStylePropertySetImpl();
        interestingProperties.add(StylePropertyDetails.WHITE_SPACE);
        styledDOMTester = new StyledDOMTester(interestingProperties);
    }
View Full Code Here

        new Volantis();

        MutableStylePropertySet interestingProperties =
                new MutableStylePropertySetImpl();
        interestingProperties.add(StylePropertyDetails.WHITE_SPACE);
        styledDOMTester = new StyledDOMTester(
                null, interestingProperties, true, false);
    }
View Full Code Here

     * Converst the outputBuffer member to a string
     * @return the string representation of the outputBuffer member
     * @throws Exception if an error occurs
     */
    protected String getOutputBufferAsString() throws Exception {
        StyledDOMTester tester = new StyledDOMTester();
        return tester.render(outputBuffer.getRoot());
    }
View Full Code Here

     */
    protected void compareStringToBuffer(String expected,
                                         OutputBuffer actual)
            throws Exception {

        StyledDOMTester tester = new StyledDOMTester();

        DOMOutputBuffer buffer = (DOMOutputBuffer) actual;
//        Element rootElement = domFactory.createElement();
//        rootElement.setName("root");
//        rootElement.addChildrenToHead(buffer.getRoot());
        Element rootElement = buffer.getRoot();
        rootElement.setName("root");

        String normalizedExpected = null;
        if ("".equals(expected)) {
            normalizedExpected = "<root></root>";
        } else {
            normalizedExpected = tester.normalize(
                    "<root>" + expected + "</root>");
        }

        final String output = tester.render(rootElement);

        assertEquals("Output should match expected value (" + output + ", " +
                normalizedExpected + ")", normalizedExpected, output);
    }
View Full Code Here

        JarFileEntityResolver entityResolver = new JarFileEntityResolver();
        entityResolver.addSystemIdMapping(
                "http://www.wapforum.org/DTD/wml_1.1.xml",
                "com/volantis/mcs/protocols/dtd/wml_1.1.xml");
        // create the Documents from the markup
        StyledDOMTester tester = new StyledDOMTester(entityResolver);
        Document inputDoc =
                tester.parse(getClass().getResourceAsStream(inputFile));
        Document expectedDoc =
                tester.parse(getClass().getResourceAsStream(expectedFile));
        DOMProtocol protocol = createProtocol(protocolConfig, psf);
        protocol.setMarinerPageContext(pageContext);

        // run the test
        XFormEmulationTransformer transformer = new XFormEmulationTransformer();
        Document outputDoc = transformer.transform(protocol, inputDoc);

        // convert Document to markup
        String canonicalExpectedXML = tester.render(expectedDoc);
        String actualXML = tester.render(outputDoc);

        // compare the actual markup with that expected
        assertXMLEquals("Actual XML does not match expected XML." +
                "\nExpectedXML:\n" + canonicalExpectedXML +
                "\nActualXML:\n" + actualXML,
View Full Code Here

    public void testInsertXFormEmulationElementWithNoCommonParent(){
        XFormEmulator emulator = new XFormEmulator();

        // Create test objects.
        StyledDOMTester tester = new StyledDOMTester();
        Document dom = tester.parse(getClass().getResourceAsStream(
                "testInsertXFormEmulationElement.xml"));

        DOMFactory domFactory = DOMFactory.getDefaultInstance();
        Element firstControl = selectNamedElement(dom, "html");
        Element lastControl = selectNamedElement(dom, "body");
View Full Code Here

TOP

Related Classes of com.volantis.mcs.dom.StyledDOMTester

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.