Package org.apache.torque.generator.source.stream

Examples of org.apache.torque.generator.source.stream.SourceToXml


                new XmlSourceFormat(),
                xmlFile,
                controllerState);
        SourceElement rootElement = fileSource.getRootElement();

        String result = new SourceToXml().toXml(rootElement, true);
        String expected = FileUtils.readFileToString(new File(
                "src/test/resources/org/apache/torque/generator/source/xml/sourceToXmlResult.xml"));
        // remove license from expected file
        expected = StringUtils.substringAfterLast(expected, "-->\n\n");
        assertEquals(expected, result);
View Full Code Here


                controllerState);
        SourceElement rootElement = fileSource.getRootElement();
        rootElement.getChildren().get(2).getChildren().add(
                rootElement.getChildren().get(0).getChildren().get(0));

        String result = new SourceToXml().toXml(rootElement, true);
        String expected = FileUtils.readFileToString(new File(
                "src/test/resources/org/apache/torque/generator/source/xml/sourceToXmlWithReferenceResult.xml"));
        // remove license from expected file
        expected = StringUtils.substringAfterLast(expected, "-->\n\n");
        assertEquals(expected, result);
View Full Code Here

    @Test
    public void testSourceToXmlTextEscaping() throws Exception
    {
        SourceElement rootElement = new SourceElement("root");
        rootElement.setAttribute((String) null, "X&<>Y'\"Z");
        String result = new SourceToXml().toXml(rootElement, true);
        assertEquals(
                "<root id=\"1\">X&amp;&lt;&gt;Y&apo;&quot;Z</root>\n",
                result);
    }
View Full Code Here

    @Test
    public void testSourceToXmlAttributeEscaping() throws Exception
    {
        SourceElement rootElement = new SourceElement("root");
        rootElement.setAttribute("attribute", "&<>'\"");
        String result = new SourceToXml().toXml(rootElement, true);
        assertEquals(
                "<root attribute=\"&amp;&lt;&gt;&apo;&quot;\" id=\"1\"/>\n",
                result);
    }
View Full Code Here

    @Test
    public void testSourceToXmlNoAutomaticIds() throws Exception
    {
        SourceElement rootElement = new SourceElement("root");
        rootElement.getChildren().add(new SourceElement("child"));
        String result = new SourceToXml().toXml(rootElement, false);
        assertEquals(
                "<root>\n  <child/>\n</root>\n",
                result);
    }
View Full Code Here

TOP

Related Classes of org.apache.torque.generator.source.stream.SourceToXml

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.