From 0e5a665cca392e730f462b59b60c7e9e4366bc92 Mon Sep 17 00:00:00 2001 From: markt Date: Sun, 7 Mar 2010 11:09:09 +0000 Subject: [PATCH] Add a test the EL doesn't work if the web-app is a 2.3 web-app git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@919966 13f79535-47bb-0310-9956-ffa450edef68 --- test/org/apache/jasper/compiler/TestJspConfig.java | 46 ++++++++++++++++++++++ test/webapp-2.3/WEB-INF/web.xml | 32 +++++++++++++++ test/webapp-2.3/no-el.jsp | 21 ++++++++++ 3 files changed, 99 insertions(+) create mode 100644 test/org/apache/jasper/compiler/TestJspConfig.java create mode 100644 test/webapp-2.3/WEB-INF/web.xml create mode 100644 test/webapp-2.3/no-el.jsp diff --git a/test/org/apache/jasper/compiler/TestJspConfig.java b/test/org/apache/jasper/compiler/TestJspConfig.java new file mode 100644 index 000000000..9dce88e52 --- /dev/null +++ b/test/org/apache/jasper/compiler/TestJspConfig.java @@ -0,0 +1,46 @@ +/* + * 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 org.apache.catalina.startup.Tomcat; +import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.buf.ByteChunk; + +public class TestJspConfig extends TomcatBaseTest { + + public void testServlet23NoEL() throws Exception { + Tomcat tomcat = getTomcatInstance(); + + File appDir = + new File("test/webapp-2.3"); + // app dir is relative to server home + tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); + + tomcat.start(); + + ByteChunk res = getUrl("http://localhost:" + getPort() + + "/test/no-el.jsp"); + + String result = res.toString(); + + assertTrue(result.indexOf("

00-${'hello world'}

") > 0); + } + +} diff --git a/test/webapp-2.3/WEB-INF/web.xml b/test/webapp-2.3/WEB-INF/web.xml new file mode 100644 index 000000000..06e870c72 --- /dev/null +++ b/test/webapp-2.3/WEB-INF/web.xml @@ -0,0 +1,32 @@ + + + + + Tomcat Servlet 2.3 Tests + + 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 2.3 of the + Servlet specification and version 1.2 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. + + \ No newline at end of file diff --git a/test/webapp-2.3/no-el.jsp b/test/webapp-2.3/no-el.jsp new file mode 100644 index 000000000..f48e1143b --- /dev/null +++ b/test/webapp-2.3/no-el.jsp @@ -0,0 +1,21 @@ +<%-- + 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. +--%> + + +

00-${'hello world'}

+ + \ No newline at end of file -- 2.11.0