From 9faede848e84027c5e0a84c2a3fd6dfb7aba735b Mon Sep 17 00:00:00 2001 From: markt Date: Wed, 3 Mar 2010 20:59:23 +0000 Subject: [PATCH] Add tests for bugs 47977 and 48827 git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@918682 13f79535-47bb-0310-9956-ffa450edef68 --- test/org/apache/TestAll.java | 2 + .../jasper/compiler/TestJspDocumentParser.java | 69 ++++++++++++++++++++++ test/webapp/bug47977.jspx | 26 ++++++++ test/webapp/bug48827.jspx | 30 ++++++++++ 4 files changed, 127 insertions(+) create mode 100644 test/org/apache/jasper/compiler/TestJspDocumentParser.java create mode 100644 test/webapp/bug47977.jspx create mode 100644 test/webapp/bug48827.jspx diff --git a/test/org/apache/TestAll.java b/test/org/apache/TestAll.java index 8053ec7be..e403357c3 100644 --- a/test/org/apache/TestAll.java +++ b/test/org/apache/TestAll.java @@ -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 index 000000000..af8fccd20 --- /dev/null +++ b/test/org/apache/jasper/compiler/TestJspDocumentParser.java @@ -0,0 +1,69 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.jasper.compiler; + +import java.io.File; +import java.io.IOException; + +import org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; + +public class TestJspDocumentParser extends TomcatBaseTest { + + public void testBug47977() throws Exception { + Tomcat tomcat = getTomcatInstance(); + + File appDir = + new File("test/webapp"); + // app dir is relative to server home + tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); + + tomcat.start(); + + Exception e = null; + try { + getUrl("http://localhost:" + getPort() + "/test/bug47977.jspx"); + } catch (IOException ioe) { + e = ioe; + } + + // Failure is expected + assertNotNull(e); + } + + public void testBug48827() throws Exception { + Tomcat tomcat = getTomcatInstance(); + + File appDir = + new File("test/webapp"); + // app dir is relative to server home + tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); + + tomcat.start(); + + Exception e = null; + try { + getUrl("http://localhost:" + getPort() + "/test/bug48827.jspx"); + } catch (IOException ioe) { + e = ioe; + } + + // Should not fail + assertNull(e); + } +} diff --git a/test/webapp/bug47977.jspx b/test/webapp/bug47977.jspx new file mode 100644 index 000000000..a04162a94 --- /dev/null +++ b/test/webapp/bug47977.jspx @@ -0,0 +1,26 @@ + + + + + + xxx + + + \ No newline at end of file diff --git a/test/webapp/bug48827.jspx b/test/webapp/bug48827.jspx new file mode 100644 index 000000000..1060d9a06 --- /dev/null +++ b/test/webapp/bug48827.jspx @@ -0,0 +1,30 @@ + + + + + + + 00-Hello World + + + + + + \ No newline at end of file -- 2.11.0