Add tests for bugs 47977 and 48827
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 3 Mar 2010 20:59:23 +0000 (20:59 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Wed, 3 Mar 2010 20:59:23 +0000 (20:59 +0000)
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@918682 13f79535-47bb-0310-9956-ffa450edef68

test/org/apache/TestAll.java
test/org/apache/jasper/compiler/TestJspDocumentParser.java [new file with mode: 0644]
test/webapp/bug47977.jspx [new file with mode: 0644]
test/webapp/bug48827.jspx [new file with mode: 0644]

index 8053ec7..e403357 100644 (file)
@@ -39,6 +39,7 @@ import org.apache.el.TestValueExpressionImpl;
 import org.apache.el.lang.TestELSupport;
 import org.apache.jasper.compiler.TestAttributeParser;
 import org.apache.jasper.compiler.TestGenerator;
+import org.apache.jasper.compiler.TestJspDocumentParser;
 import org.apache.jasper.compiler.TestParser;
 import org.apache.jasper.compiler.TestScriptingVariabler;
 import org.apache.jasper.compiler.TestValidator;
@@ -89,6 +90,7 @@ public class TestAll {
         
         // o.a.jasper
         suite.addTestSuite(TestAttributeParser.class);
+        suite.addTestSuite(TestJspDocumentParser.class);
         suite.addTestSuite(TestGenerator.class);
         suite.addTestSuite(TestParser.class);
         suite.addTestSuite(TestScriptingVariabler.class);
diff --git a/test/org/apache/jasper/compiler/TestJspDocumentParser.java b/test/org/apache/jasper/compiler/TestJspDocumentParser.java
new file mode 100644 (file)
index 0000000..af8fccd
--- /dev/null
@@ -0,0 +1,69 @@
+/*\r
+ * Licensed to the Apache Software Foundation (ASF) under one or more\r
+ * contributor license agreements.  See the NOTICE file distributed with\r
+ * this work for additional information regarding copyright ownership.\r
+ * The ASF licenses this file to You under the Apache License, Version 2.0\r
+ * (the "License"); you may not use this file except in compliance with\r
+ * the License.  You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package org.apache.jasper.compiler;\r
+\r
+import java.io.File;\r
+import java.io.IOException;\r
+\r
+import org.apache.catalina.startup.Tomcat;\r
+import org.apache.catalina.startup.TomcatBaseTest;\r
+\r
+public class TestJspDocumentParser extends TomcatBaseTest {\r
+    \r
+    public void testBug47977() throws Exception {\r
+        Tomcat tomcat = getTomcatInstance();\r
+\r
+        File appDir = \r
+            new File("test/webapp");\r
+        // app dir is relative to server home\r
+        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());\r
+        \r
+        tomcat.start();\r
+\r
+        Exception e = null;\r
+        try {\r
+            getUrl("http://localhost:" + getPort() + "/test/bug47977.jspx");\r
+        } catch (IOException ioe) {\r
+            e = ioe;\r
+        }\r
+\r
+        // Failure is expected\r
+        assertNotNull(e);\r
+    }\r
+    \r
+    public void testBug48827() throws Exception {\r
+        Tomcat tomcat = getTomcatInstance();\r
+\r
+        File appDir = \r
+            new File("test/webapp");\r
+        // app dir is relative to server home\r
+        tomcat.addWebapp(null, "/test", appDir.getAbsolutePath());\r
+        \r
+        tomcat.start();\r
+\r
+        Exception e = null;\r
+        try {\r
+            getUrl("http://localhost:" + getPort() + "/test/bug48827.jspx");\r
+        } catch (IOException ioe) {\r
+            e = ioe;\r
+        }\r
+\r
+        // Should not fail\r
+        assertNull(e);\r
+    }\r
+}\r
diff --git a/test/webapp/bug47977.jspx b/test/webapp/bug47977.jspx
new file mode 100644 (file)
index 0000000..a04162a
--- /dev/null
@@ -0,0 +1,26 @@
+<!--\r
+  Licensed to the Apache Software Foundation (ASF) under one or more\r
+  contributor license agreements.  See the NOTICE file distributed with\r
+  this work for additional information regarding copyright ownership.\r
+  The ASF licenses this file to You under the Apache License, Version 2.0\r
+  (the "License"); you may not use this file except in compliance with\r
+  the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+  Unless required by applicable law or agreed to in writing, software\r
+  distributed under the License is distributed on an "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  See the License for the specific language governing permissions and\r
+  limitations under the License.\r
+-->\r
+<jsp:root\r
+  xmlns:jsp="http://java.sun.com/JSP/Page" version="2.2"\r
+  xmlns:tags="urn:jsptagdir:/WEB-INF/tags" >\r
+  <jsp:directive.page isELIgnored="false" />\r
+<html>\r
+  <body>\r
+    <tags:echo echo="00-Hello World">xxx</tags:echo>\r
+  </body>\r
+</html>\r
+</jsp:root>
\ No newline at end of file
diff --git a/test/webapp/bug48827.jspx b/test/webapp/bug48827.jspx
new file mode 100644 (file)
index 0000000..1060d9a
--- /dev/null
@@ -0,0 +1,30 @@
+<!--\r
+  Licensed to the Apache Software Foundation (ASF) under one or more\r
+  contributor license agreements.  See the NOTICE file distributed with\r
+  this work for additional information regarding copyright ownership.\r
+  The ASF licenses this file to You under the Apache License, Version 2.0\r
+  (the "License"); you may not use this file except in compliance with\r
+  the License.  You may obtain a copy of the License at\r
+\r
+      http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+  Unless required by applicable law or agreed to in writing, software\r
+  distributed under the License is distributed on an "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+  See the License for the specific language governing permissions and\r
+  limitations under the License.\r
+-->\r
+<jsp:root\r
+  xmlns:jsp="http://java.sun.com/JSP/Page" version="2.2"\r
+  xmlns:tags="urn:jsptagdir:/WEB-INF/tags" >\r
+  <jsp:directive.page isELIgnored="false" />\r
+<html>\r
+  <body>\r
+    <tags:echo>\r
+      <jsp:attribute name="echo">00-Hello World</jsp:attribute>\r
+    </tags:echo>\r
+    <tags:echo echo="01-Hello World"></tags:echo>\r
+    <tags:echo echo="02-Hello World"> </tags:echo>\r
+  </body>\r
+</html>\r
+</jsp:root>
\ No newline at end of file