Search in sources :

Example 11 with WebXml

use of org.apache.catalina.deploy.WebXml in project tomcat70 by apache.

the class TestWebRuleSet method testLifecycleMethodsDefinitions.

@Test
public void testLifecycleMethodsDefinitions() throws Exception {
    // post-construct and pre-destroy
    parse(new WebXml(), "web-1lifecyclecallback.xml", false, true);
    // conflicting post-construct definitions
    parse(new WebXml(), "web-2lifecyclecallback.xml", false, false);
}
Also used : WebXml(org.apache.catalina.deploy.WebXml) Test(org.junit.Test)

Example 12 with WebXml

use of org.apache.catalina.deploy.WebXml in project tomcat70 by apache.

the class TestWebRuleSet method testSingleNameInWebFragmentXml.

@Test
public void testSingleNameInWebFragmentXml() throws Exception {
    WebXml webXml = new WebXml();
    parse(webXml, "web-fragment-1name.xml", true, true);
    Assert.assertEquals("name1", webXml.getName());
}
Also used : WebXml(org.apache.catalina.deploy.WebXml) Test(org.junit.Test)

Example 13 with WebXml

use of org.apache.catalina.deploy.WebXml in project tomcat70 by apache.

the class TestSchemaValidation method testWebapp_2_5.

@Test
public void testWebapp_2_5() throws Exception {
    XmlErrorHandler handler = new XmlErrorHandler();
    Digester digester = DigesterFactory.newDigester(true, true, new WebRuleSet(false), true);
    digester.setErrorHandler(handler);
    digester.push(new WebXml());
    WebXml desc = (WebXml) digester.parse(new File("test/webapp-2.5/WEB-INF/web.xml"));
    Assert.assertEquals("2.5", desc.getVersion());
    Assert.assertEquals(0, handler.getErrors().size());
    Assert.assertEquals(0, handler.getWarnings().size());
}
Also used : WebXml(org.apache.catalina.deploy.WebXml) Digester(org.apache.tomcat.util.digester.Digester) XmlErrorHandler(org.apache.tomcat.util.descriptor.XmlErrorHandler) WebRuleSet(org.apache.catalina.startup.WebRuleSet) File(java.io.File) Test(org.junit.Test)

Example 14 with WebXml

use of org.apache.catalina.deploy.WebXml in project tomcat70 by apache.

the class TestSchemaValidation method testWebapp_2_4.

@Test
public void testWebapp_2_4() throws Exception {
    XmlErrorHandler handler = new XmlErrorHandler();
    Digester digester = DigesterFactory.newDigester(true, true, new WebRuleSet(false), true);
    digester.setErrorHandler(handler);
    digester.push(new WebXml());
    WebXml desc = (WebXml) digester.parse(new File("test/webapp-2.4/WEB-INF/web.xml"));
    Assert.assertEquals("2.4", desc.getVersion());
    Assert.assertEquals(0, handler.getErrors().size());
    Assert.assertEquals(0, handler.getWarnings().size());
}
Also used : WebXml(org.apache.catalina.deploy.WebXml) Digester(org.apache.tomcat.util.digester.Digester) XmlErrorHandler(org.apache.tomcat.util.descriptor.XmlErrorHandler) WebRuleSet(org.apache.catalina.startup.WebRuleSet) File(java.io.File) Test(org.junit.Test)

Example 15 with WebXml

use of org.apache.catalina.deploy.WebXml in project tomcat70 by apache.

the class TestSchemaValidation method testWebapp_3_0.

@Test
public void testWebapp_3_0() throws Exception {
    XmlErrorHandler handler = new XmlErrorHandler();
    Digester digester = DigesterFactory.newDigester(true, true, new WebRuleSet(false), true);
    digester.setErrorHandler(handler);
    digester.push(new WebXml());
    WebXml desc = (WebXml) digester.parse(new File("test/webapp-3.0/WEB-INF/web.xml"));
    Assert.assertEquals("3.0", desc.getVersion());
    Assert.assertEquals(0, handler.getErrors().size());
    Assert.assertEquals(0, handler.getWarnings().size());
}
Also used : WebXml(org.apache.catalina.deploy.WebXml) Digester(org.apache.tomcat.util.digester.Digester) XmlErrorHandler(org.apache.tomcat.util.descriptor.XmlErrorHandler) WebRuleSet(org.apache.catalina.startup.WebRuleSet) File(java.io.File) Test(org.junit.Test)

Aggregations

WebXml (org.apache.catalina.deploy.WebXml)26 Test (org.junit.Test)20 File (java.io.File)17 ServletDef (org.apache.catalina.deploy.ServletDef)5 WebRuleSet (org.apache.catalina.startup.WebRuleSet)5 XmlErrorHandler (org.apache.tomcat.util.descriptor.XmlErrorHandler)5 Digester (org.apache.tomcat.util.digester.Digester)5 URL (java.net.URL)4 FilterDef (org.apache.catalina.deploy.FilterDef)3 IOException (java.io.IOException)2 HashSet (java.util.HashSet)2 LinkedHashSet (java.util.LinkedHashSet)2 NamingException (javax.naming.NamingException)2 ServletContainerInitializer (javax.servlet.ServletContainerInitializer)2 StandardContext (org.apache.catalina.core.StandardContext)2 FilterMap (org.apache.catalina.deploy.FilterMap)2 FileDirContext (org.apache.naming.resources.FileDirContext)2 InputSource (org.xml.sax.InputSource)2 JarURLConnection (java.net.JarURLConnection)1 MalformedURLException (java.net.MalformedURLException)1