Package org.codehaus.cargo.module.webapp

Examples of org.codehaus.cargo.module.webapp.WebXml


        // cactified descriptor, perform the merge
        if (this.mergeWebXml != null)
        {
            try
            {
                WebXml parsedMergeWebXml = WebXmlIo.parseWebXmlFromFile(
                    this.mergeWebXml, this.xmlCatalog);
                WebXmlMerger merger = new WebXmlMerger(theWebXml);
                merger.setLogger(new AntLogger(this));
                merger.merge(parsedMergeWebXml);
            }
View Full Code Here


        // Open the archive as JAR file and extract the deployment descriptor
        WarArchive war = null;
        try
        {
            war = new DefaultWarArchive(new FileInputStream(this.srcFile));
            WebXml webXml = war.getWebXml();
            return webXml;
        }
        catch (SAXException e)
        {
            throw new BuildException(
View Full Code Here

                }
                if (force
                 || (srcFile.lastModified() > destFile.lastModified())
                 || (mergeFile.lastModified() > destFile.lastModified()))
                {
                    WebXml srcWebXml = WebXmlIo.parseWebXmlFromFile(
                        this.srcFile, this.xmlCatalog);
                    WebXml mergeWebXml = WebXmlIo.parseWebXmlFromFile(
                        this.mergeFile, this.xmlCatalog);
                    WebXmlMerger merger = new WebXmlMerger(srcWebXml);
                    merger.setLogger(new AntLogger(this));
                    merger.merge(mergeWebXml);
                    WebXmlIo.writeDescriptor(srcWebXml, this.destFile,
View Full Code Here

     */
    public void testConstructionWithNullDocument() throws Exception
    {
        try
        {
            new WebXml(null);
            fail("Expected NullPointerException");
        }
        catch (NullPointerException npe)
        {
            // expected
View Full Code Here

        String xml = "<!DOCTYPE web-app "
            + "PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN' "
            + "'http://java.sun.com/j2ee/dtds/web-app_2.2.dtd'>"
            + "<web-app></web-app>";
        Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
        WebXml webXml = new WebXml(doc);
        assertEquals(WebXmlVersion.V2_2, webXml.getVersion());
    }
View Full Code Here

        String xml = "<!DOCTYPE web-app "
            + "PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' "
            + "'http://java.sun.com/dtd/web-app_2_3.dtd'>"
            + "<web-app></web-app>";
        Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
        WebXml webXml = new WebXml(doc);
        assertEquals(WebXmlVersion.V2_3, webXml.getVersion());
    }
View Full Code Here

        String xml = "<!DOCTYPE web-app "
            + "PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 1.9//EN' "
            + "'http://java.sun.com/dtd/web-app_1_9.dtd'>"
            + "<web-app></web-app>";
        Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
        WebXml webXml = new WebXml(doc);
        assertNull(webXml.getVersion());
    }
View Full Code Here

     */
    public void testGetVersionWithoutDoctype() throws Exception
    {
        String xml = "<web-app></web-app>";
        Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
        WebXml webXml = new WebXml(doc);
        assertNull(webXml.getVersion());
    }
View Full Code Here

     */
    public void testHasFilterWithNullName() throws Exception
    {
        String xml = "<web-app></web-app>";
        Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
        WebXml webXml = new WebXml(doc);
        try
        {
            webXml.hasFilter(null);
            fail("Expected NullPointerException");
        }
        catch (NullPointerException npe)
        {
            // expected
View Full Code Here

            + "    <filter-name>f1</filter-name>"
            + "    <filter-class>fclass1</filter-class>"
            + "  </filter>"
            + "</web-app>";
        Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
        WebXml webXml = new WebXml(doc);
        assertTrue(webXml.hasFilter("f1"));
        assertTrue(!webXml.hasFilter("f2"));
    }
View Full Code Here

TOP

Related Classes of org.codehaus.cargo.module.webapp.WebXml

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.