Package org.codehaus.cargo.module.webapp

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


            + "    <param-name>param1</param-name>"
            + "    <param-value>value1</param-value>"
            + "  </context-param>"
            + "</web-app>";
        Document doc = builder.parse(new ByteArrayInputStream(xml.getBytes()));
        WebXml webXml = new WebXml(doc);
        Element contextParamElement =
            createContextParamElement(doc, "param2", "value2");
        webXml.addContextParam(contextParamElement);
        assertTrue(webXml.hasContextParam("param1"));
        assertTrue(webXml.hasContextParam("param2"));
    }
View Full Code Here


            + "    <param-value>value</param-value>"
            + "  </context-param>"
            + "</web-app>";
        Document srcDoc =
            builder.parse(new ByteArrayInputStream(srcXml.getBytes()));
        WebXml srcWebXml = new WebXml(srcDoc);
        String mergeXml = srcXml;
        Document mergeDoc =
            builder.parse(new ByteArrayInputStream(mergeXml.getBytes()));
        WebXml mergeWebXml = new WebXml(mergeDoc);
        WebXmlMerger merger = new WebXmlMerger(srcWebXml);
        merger.merge(mergeWebXml);
        assertTrue(srcWebXml.hasContextParam("param"));
    }
View Full Code Here

            + "    <filter-class>fclass1</filter-class>"
            + "  </filter>"
            + "</web-app>";
        Document srcDoc =
            builder.parse(new ByteArrayInputStream(srcXml.getBytes()));
        WebXml srcWebXml = new WebXml(srcDoc);
        String mergeXml = "<!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>"
            + "  <filter>"
            + "    <filter-name>f1</filter-name>"
            + "    <filter-class>fclass1</filter-class>"
            + "    <init-param>"
            + "      <param-name>f1param1</param-name>"
            + "      <param-value>f1param1value</param-value>"
            + "    </init-param>"
            + "  </filter>"
            + "</web-app>";
        Document mergeDoc =
            builder.parse(new ByteArrayInputStream(mergeXml.getBytes()));
        WebXml mergeWebXml = new WebXml(mergeDoc);
        WebXmlMerger merger = new WebXmlMerger(srcWebXml);
        merger.merge(mergeWebXml);
        assertTrue(srcWebXml.hasFilter("f1"));
        Iterator initParams = srcWebXml.getFilterInitParamNames("f1");
        assertEquals("f1param1", initParams.next());
View Full Code Here

            + "    <filter-class>fclass3</filter-class>"
            + "  </filter>"
            + "</web-app>";
        Document srcDoc =
            builder.parse(new ByteArrayInputStream(srcXml.getBytes()));
        WebXml srcWebXml = new WebXml(srcDoc);
        String mergeXml = "<web-app>"
            + "  <filter>"
            + "    <filter-name>f4</filter-name>"
            + "    <filter-class>fclass4</filter-class>"
            + "  </filter>"
            + "</web-app>";
        Document mergeDoc =
            builder.parse(new ByteArrayInputStream(mergeXml.getBytes()));
        WebXml mergeWebXml = new WebXml(mergeDoc);
        WebXmlMerger merger = new WebXmlMerger(srcWebXml);
        merger.merge(mergeWebXml);
        Iterator filterNames = srcWebXml.getFilterNames();
        assertEquals("f1", filterNames.next());
        assertEquals("f2", filterNames.next());
View Full Code Here

    public void testMergeMultipleFiltersIntoEmptyDocument() throws Exception
    {
        String srcXml = "<!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 srcDoc =
            builder.parse(new ByteArrayInputStream(srcXml.getBytes()));
        WebXml srcWebXml = new WebXml(srcDoc);
        String mergeXml = "<web-app>"
            + "  <filter>"
            + "    <filter-name>f1</filter-name>"
            + "    <filter-class>fclass1</filter-class>"
            + "  </filter>"
            + "  <filter>"
            + "    <filter-name>f2</filter-name>"
            + "    <filter-class>fclass2</filter-class>"
            + "  </filter>"
            + "  <filter>"
            + "    <filter-name>f3</filter-name>"
            + "    <filter-class>fclass3</filter-class>"
            + "  </filter>"
            + "</web-app>";
        Document mergeDoc =
            builder.parse(new ByteArrayInputStream(mergeXml.getBytes()));
        WebXml mergeWebXml = new WebXml(mergeDoc);
        WebXmlMerger merger = new WebXmlMerger(srcWebXml);
        merger.merge(mergeWebXml);
        Iterator filterNames = srcWebXml.getFilterNames();
        assertEquals("f1", filterNames.next());
        assertEquals("f2", filterNames.next());
View Full Code Here

        throws Exception
    {
        String srcXml = "<!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 srcDoc =
            builder.parse(new ByteArrayInputStream(srcXml.getBytes()));
        WebXml srcWebXml = new WebXml(srcDoc);
        String mergeXml = "<web-app>"
            + "  <filter>"
            + "    <filter-name>f1</filter-name>"
            + "    <filter-class>fclass1</filter-class>"
            + "  </filter>"
            + "  <filter-mapping>"
            + "    <filter-name>f1</filter-name>"
            + "    <url-pattern>/f1mapping1</url-pattern>"
            + "  </filter-mapping>"
            + "</web-app>";
        Document mergeDoc =
            builder.parse(new ByteArrayInputStream(mergeXml.getBytes()));
        WebXml mergeWebXml = new WebXml(mergeDoc);
        WebXmlMerger merger = new WebXmlMerger(srcWebXml);
        merger.merge(mergeWebXml);
        assertTrue(srcWebXml.hasFilter("f1"));
        Iterator filterMappings = srcWebXml.getFilterMappings("f1");
        assertEquals("/f1mapping1", filterMappings.next());
View Full Code Here

        throws Exception
    {
        String srcXml = "<!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 srcDoc =
            builder.parse(new ByteArrayInputStream(srcXml.getBytes()));
        WebXml srcWebXml = new WebXml(srcDoc);
        String mergeXml = "<web-app>"
            + "  <filter>"
            + "    <filter-name>f1</filter-name>"
            + "    <filter-class>fclass1</filter-class>"
            + "  </filter>"
            + "  <filter-mapping>"
            + "    <filter-name>f1</filter-name>"
            + "    <url-pattern>/f1mapping1</url-pattern>"
            + "  </filter-mapping>"
            + "  <filter-mapping>"
            + "    <filter-name>f1</filter-name>"
            + "    <url-pattern>/f1mapping2</url-pattern>"
            + "  </filter-mapping>"
            + "  <filter-mapping>"
            + "    <filter-name>f1</filter-name>"
            + "    <url-pattern>/f1mapping3</url-pattern>"
            + "  </filter-mapping>"
            + "</web-app>";
        Document mergeDoc =
            builder.parse(new ByteArrayInputStream(mergeXml.getBytes()));
        WebXml mergeWebXml = new WebXml(mergeDoc);
        WebXmlMerger merger = new WebXmlMerger(srcWebXml);
        merger.merge(mergeWebXml);
        assertTrue(srcWebXml.hasFilter("f1"));
        Iterator filterMappings = srcWebXml.getFilterMappings("f1");
        assertEquals("/f1mapping1", filterMappings.next());
View Full Code Here

    public void testMergeOneServletIntoEmptyDocument() throws Exception
    {
        String srcXml = "<!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 srcDoc =
            builder.parse(new ByteArrayInputStream(srcXml.getBytes()));
        WebXml srcWebXml = new WebXml(srcDoc);
        String mergeXml = "<web-app>"
            + "  <servlet>"
            + "    <servlet-name>s1</servlet-name>"
            + "    <servlet-class>sclass1</servlet-class>"
            + "  </servlet>"
            + "</web-app>";
        Document mergeDoc =
            builder.parse(new ByteArrayInputStream(mergeXml.getBytes()));
        WebXml mergeWebXml = new WebXml(mergeDoc);
        WebXmlMerger merger = new WebXmlMerger(srcWebXml);
        merger.merge(mergeWebXml);
        assertTrue(srcWebXml.hasServlet("s1"));
    }
View Full Code Here

            + "    <servlet-class>sclass1</servlet-class>"
            + "  </servlet>"
            + "</web-app>";
        Document srcDoc =
            builder.parse(new ByteArrayInputStream(srcXml.getBytes()));
        WebXml srcWebXml = new WebXml(srcDoc);
        String mergeXml = "<web-app>"
            + "  <servlet>"
            + "    <servlet-name>s2</servlet-name>"
            + "    <servlet-class>sclass2</servlet-class>"
            + "  </servlet>"
            + "</web-app>";
        Document mergeDoc =
            builder.parse(new ByteArrayInputStream(mergeXml.getBytes()));
        WebXml mergeWebXml = new WebXml(mergeDoc);
        WebXmlMerger merger = new WebXmlMerger(srcWebXml);
        merger.merge(mergeWebXml);
        assertTrue(srcWebXml.hasServlet("s1"));
        assertTrue(srcWebXml.hasServlet("s2"));
    }
View Full Code Here

            + "    <servlet-class>sclass1</servlet-class>"
            + "  </servlet>"
            + "</web-app>";
        Document srcDoc =
            builder.parse(new ByteArrayInputStream(srcXml.getBytes()));
        WebXml srcWebXml = new WebXml(srcDoc);
        String mergeXml = "<web-app>"
            + "  <servlet>"
            + "    <servlet-name>s1</servlet-name>"
            + "    <servlet-class>sclass1</servlet-class>"
            + "  </servlet>"
            + "</web-app>";
        Document mergeDoc =
            builder.parse(new ByteArrayInputStream(mergeXml.getBytes()));
        WebXml mergeWebXml = new WebXml(mergeDoc);
        WebXmlMerger merger = new WebXmlMerger(srcWebXml);
        merger.merge(mergeWebXml);
        assertTrue(srcWebXml.hasServlet("s1"));
    }
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.