Author: markt
Date: Sat Oct 10 11:34:48 2015
New Revision: 1707866

URL: http://svn.apache.org/viewvc?rev=1707866&view=rev
Log:
Servlet 4.0
Update tests for 4.0 schemas

Added:
    tomcat/trunk/test/webapp-4.0/
      - copied from r1707839, tomcat/trunk/test/webapp-3.1/
Modified:
    tomcat/trunk/test/javax/servlet/resources/TestSchemaValidation.java
    tomcat/trunk/test/org/apache/jasper/servlet/TestJspCServletContext.java
    tomcat/trunk/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java
    tomcat/trunk/test/webapp-4.0/WEB-INF/web.xml

Modified: tomcat/trunk/test/javax/servlet/resources/TestSchemaValidation.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/javax/servlet/resources/TestSchemaValidation.java?rev=1707866&r1=1707865&r2=1707866&view=diff
==============================================================================
--- tomcat/trunk/test/javax/servlet/resources/TestSchemaValidation.java 
(original)
+++ tomcat/trunk/test/javax/servlet/resources/TestSchemaValidation.java Sat Oct 
10 11:34:48 2015
@@ -130,5 +130,17 @@ public class TestSchemaValidation {
         Assert.assertEquals(0, handler.getWarnings().size());
     }
 
-    // TODO Servlet 4.0
+    @Test
+    public void testWebapp_4_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-4.0/WEB-INF/web.xml"));
+        Assert.assertEquals("4.0", desc.getVersion());
+        Assert.assertEquals(0, handler.getErrors().size());
+        Assert.assertEquals(0, handler.getWarnings().size());
+    }
 }

Modified: 
tomcat/trunk/test/org/apache/jasper/servlet/TestJspCServletContext.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/servlet/TestJspCServletContext.java?rev=1707866&r1=1707865&r2=1707866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/jasper/servlet/TestJspCServletContext.java 
(original)
+++ tomcat/trunk/test/org/apache/jasper/servlet/TestJspCServletContext.java Sat 
Oct 10 11:34:48 2015
@@ -113,8 +113,15 @@ public class TestJspCServletContext {
         Assert.assertEquals(1, context.getEffectiveMinorVersion());
     }
 
-    // TODO Servlet 4.0
-    // Once a 4.0 web.xml is available
+    @Test
+    public void testWebapp_4_0() throws Exception {
+        File appDir = new File("test/webapp-4.0");
+        JspCServletContext context = new JspCServletContext(
+                null, appDir.toURI().toURL(), null, false, false);
+        Assert.assertEquals(4, context.getEffectiveMajorVersion());
+        Assert.assertEquals(0, context.getEffectiveMinorVersion());
+    }
+
 
     @Test
     public void testWebresources() throws Exception {

Modified: 
tomcat/trunk/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java?rev=1707866&r1=1707865&r2=1707866&view=diff
==============================================================================
--- tomcat/trunk/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java 
(original)
+++ tomcat/trunk/test/org/apache/tomcat/util/descriptor/web/TestWebXml.java Sat 
Oct 10 11:34:48 2015
@@ -170,7 +170,10 @@ public class TestWebXml {
         doTestValidateVersion("3.1");
     }
 
-    // TODO Servlet 4.0
+    @Test
+    public void testValidateVersion40() throws IOException, SAXException {
+        doTestValidateVersion("4.0");
+    }
 
     private void doTestValidateVersion(String version) throws IOException, 
SAXException {
         WebXml webxml = new WebXml();

Modified: tomcat/trunk/test/webapp-4.0/WEB-INF/web.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-4.0/WEB-INF/web.xml?rev=1707866&r1=1707839&r2=1707866&view=diff
==============================================================================
--- tomcat/trunk/test/webapp-4.0/WEB-INF/web.xml (original)
+++ tomcat/trunk/test/webapp-4.0/WEB-INF/web.xml Sat Oct 10 11:34:48 2015
@@ -18,16 +18,16 @@
 <web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
   xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
-                      http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd";
-  version="3.1"
+                      http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd";
+  version="4.0"
   metadata-complete="true">
 
-  <display-name>Tomcat Servlet 3.1 Tests</display-name>
+  <display-name>Tomcat Servlet 4.0 Tests</display-name>
   <description>
     Provides a web application used by the Tomcat unit tests to ensure that
     Tomcat meets the requirements of the current JSP and Servlet specification
-    for web applications that declare that they follow version 3.1 of the
-    Servlet specification and version 2.3 of the JSP specification. This
+    for web applications that declare that they follow version 4.0 of the
+    Servlet specification and version 2.4 of the JSP specification. This
     typically means ensuring that features introduced in later versions of the
     specification do not change the behaviour of applications that declared an
     earlier version of the specification.



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to