From: markt Date: Sun, 7 Mar 2010 20:51:34 +0000 (+0000) Subject: Rename no-el to el-as-literal X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a121de236ac02387351485e76c643cb28135ba9a;p=tomcat7.0 Rename no-el to el-as-literal Add tests for 2.3, 2.4 & 2.5 webapps with Tag libraries that require various JSP versions These currently all work and I think some should fail - looking into that next git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@920109 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/test/org/apache/jasper/compiler/TestJspConfig.java b/test/org/apache/jasper/compiler/TestJspConfig.java index 0695aa93c..cab6f85f7 100644 --- a/test/org/apache/jasper/compiler/TestJspConfig.java +++ b/test/org/apache/jasper/compiler/TestJspConfig.java @@ -36,7 +36,7 @@ public class TestJspConfig extends TomcatBaseTest { tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + - "/test/no-el.jsp"); + "/test/el-as-literal.jsp"); String result = res.toString(); @@ -44,4 +44,59 @@ public class TestJspConfig extends TomcatBaseTest { assertTrue(result.indexOf("

01-#{'hello world'}

") > 0); } + public void testServlet24NoEL() throws Exception { + Tomcat tomcat = getTomcatInstance(); + + File appDir = + new File("test/webapp-2.4"); + // app dir is relative to server home + tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); + + tomcat.start(); + + ByteChunk res = getUrl("http://localhost:" + getPort() + + "/test/el-as-literal.jsp"); + + String result = res.toString(); + + assertTrue(result.indexOf("

00-hello world

") > 0); + assertTrue(result.indexOf("

01-#{'hello world'}

") > 0); + } + + public void testServlet25NoEL() throws Exception { + Tomcat tomcat = getTomcatInstance(); + + File appDir = + new File("test/webapp-2.5"); + // app dir is relative to server home + tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); + + tomcat.start(); + + ByteChunk res = getUrl("http://localhost:" + getPort() + + "/test/el-as-literal.jsp"); + + String result = res.toString(); + + assertTrue(result.indexOf("

00-hello world

") > 0); + } + + public void testServlet30NoEL() throws Exception { + Tomcat tomcat = getTomcatInstance(); + + File appDir = + new File("test/webapp-3.0"); + // app dir is relative to server home + tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); + + tomcat.start(); + + ByteChunk res = getUrl("http://localhost:" + getPort() + + "/test/el-as-literal.jsp"); + + String result = res.toString(); + + assertTrue(result.indexOf("

00-hello world

") > 0); + } + } diff --git a/test/org/apache/jasper/compiler/TestValidator.java b/test/org/apache/jasper/compiler/TestValidator.java index c2a74e5eb..dd1d08d14 100644 --- a/test/org/apache/jasper/compiler/TestValidator.java +++ b/test/org/apache/jasper/compiler/TestValidator.java @@ -51,6 +51,81 @@ public class TestValidator extends TomcatBaseTest { } + public void testTldVersions23() 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/tld-versions.jsp"); + + String result = res.toString(); + + assertTrue(result.indexOf("

${'00-hello world'}

") > 0); + assertTrue(result.indexOf("

#{'01-hello world'}

") > 0); + assertTrue(result.indexOf("

${'02-hello world'}

") > 0); + assertTrue(result.indexOf("

#{'03-hello world'}

") > 0); + assertTrue(result.indexOf("

${'04-hello world'}

") > 0); + assertTrue(result.indexOf("

#{'05-hello world'}

") > 0); + assertTrue(result.indexOf("

${'06-hello world'}

") > 0); + } + + + public void testTldVersions24() throws Exception { + Tomcat tomcat = getTomcatInstance(); + + File appDir = + new File("test/webapp-2.4"); + // app dir is relative to server home + tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); + + tomcat.start(); + + ByteChunk res = getUrl("http://localhost:" + getPort() + + "/test/tld-versions.jsp"); + + String result = res.toString(); + + assertTrue(result.indexOf("

${'00-hello world'}

") > 0); + assertTrue(result.indexOf("

#{'01-hello world'}

") > 0); + assertTrue(result.indexOf("

${'02-hello world'}

") > 0); + assertTrue(result.indexOf("

#{'03-hello world'}

") > 0); + assertTrue(result.indexOf("

04-hello world

") > 0); + assertTrue(result.indexOf("

#{'05-hello world'}

") > 0); + assertTrue(result.indexOf("

06-hello world

") > 0); + } + + + public void testTldVersions25() throws Exception { + Tomcat tomcat = getTomcatInstance(); + + File appDir = + new File("test/webapp-2.5"); + // app dir is relative to server home + tomcat.addWebapp(null, "/test", appDir.getAbsolutePath()); + + tomcat.start(); + + ByteChunk res = getUrl("http://localhost:" + getPort() + + "/test/tld-versions.jsp"); + + String result = res.toString(); + + assertTrue(result.indexOf("

${'00-hello world'}

") > 0); + assertTrue(result.indexOf("

#{'01-hello world'}

") > 0); + assertTrue(result.indexOf("

${'02-hello world'}

") > 0); + assertTrue(result.indexOf("

#{'03-hello world'}

") > 0); + assertTrue(result.indexOf("

04-hello world

") > 0); + assertTrue(result.indexOf("

#{'05-hello world'}

") > 0); + assertTrue(result.indexOf("

06-hello world

") > 0); + } + + public void testTldVersions30() throws Exception { Tomcat tomcat = getTomcatInstance(); diff --git a/test/webapp-2.3/WEB-INF/tags11.tld b/test/webapp-2.3/WEB-INF/tags11.tld new file mode 100644 index 000000000..b78be0327 --- /dev/null +++ b/test/webapp-2.3/WEB-INF/tags11.tld @@ -0,0 +1,36 @@ + + + + 1.0 + 1.1 + Tags11 + http://tomcat.apache.org/tags11 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + + + + \ No newline at end of file diff --git a/test/webapp-2.3/WEB-INF/tags12.tld b/test/webapp-2.3/WEB-INF/tags12.tld new file mode 100644 index 000000000..55908d982 --- /dev/null +++ b/test/webapp-2.3/WEB-INF/tags12.tld @@ -0,0 +1,36 @@ + + + + 1.0 + 1.2 + Tags12 + http://tomcat.apache.org/tags12 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + + + + \ No newline at end of file diff --git a/test/webapp-2.3/WEB-INF/tags20.tld b/test/webapp-2.3/WEB-INF/tags20.tld new file mode 100644 index 000000000..9130867cb --- /dev/null +++ b/test/webapp-2.3/WEB-INF/tags20.tld @@ -0,0 +1,37 @@ + + + 1.0 + Tags20 + http://tomcat.apache.org/tags20 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + true + + + + \ No newline at end of file diff --git a/test/webapp-2.3/WEB-INF/tags21.tld b/test/webapp-2.3/WEB-INF/tags21.tld new file mode 100644 index 000000000..7b8c3c542 --- /dev/null +++ b/test/webapp-2.3/WEB-INF/tags21.tld @@ -0,0 +1,37 @@ + + + 1.0 + Tags21 + http://tomcat.apache.org/tags21 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + true + + + + \ No newline at end of file diff --git a/test/webapp-2.3/el-as-literal.jsp b/test/webapp-2.3/el-as-literal.jsp new file mode 100644 index 000000000..9b47cc04a --- /dev/null +++ b/test/webapp-2.3/el-as-literal.jsp @@ -0,0 +1,22 @@ +<%-- + 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'}

+

01-#{'hello world'}

+ + \ No newline at end of file diff --git a/test/webapp-2.3/no-el.jsp b/test/webapp-2.3/no-el.jsp deleted file mode 100644 index 9b47cc04a..000000000 --- a/test/webapp-2.3/no-el.jsp +++ /dev/null @@ -1,22 +0,0 @@ -<%-- - 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'}

-

01-#{'hello world'}

- - \ No newline at end of file diff --git a/test/webapp-2.3/tld-versions.jsp b/test/webapp-2.3/tld-versions.jsp new file mode 100644 index 000000000..debf2501d --- /dev/null +++ b/test/webapp-2.3/tld-versions.jsp @@ -0,0 +1,29 @@ +<%-- + 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. +--%> + +<%@ taglib prefix="tags11" uri="http://tomcat.apache.org/tags11" %> +<%@ taglib prefix="tags12" uri="http://tomcat.apache.org/tags12" %> +<%@ taglib prefix="tags20" uri="http://tomcat.apache.org/tags20" %> +<%@ taglib prefix="tags21" uri="http://tomcat.apache.org/tags21" %> + + + + + + + + \ No newline at end of file diff --git a/test/webapp-2.4/WEB-INF/tags11.tld b/test/webapp-2.4/WEB-INF/tags11.tld new file mode 100644 index 000000000..b78be0327 --- /dev/null +++ b/test/webapp-2.4/WEB-INF/tags11.tld @@ -0,0 +1,36 @@ + + + + 1.0 + 1.1 + Tags11 + http://tomcat.apache.org/tags11 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + + + + \ No newline at end of file diff --git a/test/webapp-2.4/WEB-INF/tags12.tld b/test/webapp-2.4/WEB-INF/tags12.tld new file mode 100644 index 000000000..55908d982 --- /dev/null +++ b/test/webapp-2.4/WEB-INF/tags12.tld @@ -0,0 +1,36 @@ + + + + 1.0 + 1.2 + Tags12 + http://tomcat.apache.org/tags12 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + + + + \ No newline at end of file diff --git a/test/webapp-2.4/WEB-INF/tags20.tld b/test/webapp-2.4/WEB-INF/tags20.tld new file mode 100644 index 000000000..9130867cb --- /dev/null +++ b/test/webapp-2.4/WEB-INF/tags20.tld @@ -0,0 +1,37 @@ + + + 1.0 + Tags20 + http://tomcat.apache.org/tags20 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + true + + + + \ No newline at end of file diff --git a/test/webapp-2.4/WEB-INF/tags21.tld b/test/webapp-2.4/WEB-INF/tags21.tld new file mode 100644 index 000000000..7b8c3c542 --- /dev/null +++ b/test/webapp-2.4/WEB-INF/tags21.tld @@ -0,0 +1,37 @@ + + + 1.0 + Tags21 + http://tomcat.apache.org/tags21 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + true + + + + \ No newline at end of file diff --git a/test/webapp-2.4/WEB-INF/web.xml b/test/webapp-2.4/WEB-INF/web.xml new file mode 100644 index 000000000..1ac8b2779 --- /dev/null +++ b/test/webapp-2.4/WEB-INF/web.xml @@ -0,0 +1,33 @@ + + + + Tomcat Servlet 2.4 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.4 of the + Servlet specification and version 2.0 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.4/el-as-literal.jsp b/test/webapp-2.4/el-as-literal.jsp new file mode 100644 index 000000000..9b47cc04a --- /dev/null +++ b/test/webapp-2.4/el-as-literal.jsp @@ -0,0 +1,22 @@ +<%-- + 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'}

+

01-#{'hello world'}

+ + \ No newline at end of file diff --git a/test/webapp-2.4/tld-versions.jsp b/test/webapp-2.4/tld-versions.jsp new file mode 100644 index 000000000..debf2501d --- /dev/null +++ b/test/webapp-2.4/tld-versions.jsp @@ -0,0 +1,29 @@ +<%-- + 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. +--%> + +<%@ taglib prefix="tags11" uri="http://tomcat.apache.org/tags11" %> +<%@ taglib prefix="tags12" uri="http://tomcat.apache.org/tags12" %> +<%@ taglib prefix="tags20" uri="http://tomcat.apache.org/tags20" %> +<%@ taglib prefix="tags21" uri="http://tomcat.apache.org/tags21" %> + + + + + + + + \ No newline at end of file diff --git a/test/webapp-2.5/WEB-INF/tags11.tld b/test/webapp-2.5/WEB-INF/tags11.tld new file mode 100644 index 000000000..b78be0327 --- /dev/null +++ b/test/webapp-2.5/WEB-INF/tags11.tld @@ -0,0 +1,36 @@ + + + + 1.0 + 1.1 + Tags11 + http://tomcat.apache.org/tags11 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + + + + \ No newline at end of file diff --git a/test/webapp-2.5/WEB-INF/tags12.tld b/test/webapp-2.5/WEB-INF/tags12.tld new file mode 100644 index 000000000..55908d982 --- /dev/null +++ b/test/webapp-2.5/WEB-INF/tags12.tld @@ -0,0 +1,36 @@ + + + + 1.0 + 1.2 + Tags12 + http://tomcat.apache.org/tags12 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + + + + \ No newline at end of file diff --git a/test/webapp-2.5/WEB-INF/tags20.tld b/test/webapp-2.5/WEB-INF/tags20.tld new file mode 100644 index 000000000..9130867cb --- /dev/null +++ b/test/webapp-2.5/WEB-INF/tags20.tld @@ -0,0 +1,37 @@ + + + 1.0 + Tags20 + http://tomcat.apache.org/tags20 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + true + + + + \ No newline at end of file diff --git a/test/webapp-2.5/WEB-INF/tags21.tld b/test/webapp-2.5/WEB-INF/tags21.tld new file mode 100644 index 000000000..7b8c3c542 --- /dev/null +++ b/test/webapp-2.5/WEB-INF/tags21.tld @@ -0,0 +1,37 @@ + + + 1.0 + Tags21 + http://tomcat.apache.org/tags21 + + + Echo + org.apache.jasper.compiler.TestValidator$Echo + empty + + echo + yes + true + + + + \ No newline at end of file diff --git a/test/webapp-2.5/WEB-INF/web.xml b/test/webapp-2.5/WEB-INF/web.xml new file mode 100644 index 000000000..383287dae --- /dev/null +++ b/test/webapp-2.5/WEB-INF/web.xml @@ -0,0 +1,33 @@ + + + + Tomcat Servlet 2.5 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.5 of the + Servlet specification and version 2.1 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.5/el-as-literal.jsp b/test/webapp-2.5/el-as-literal.jsp new file mode 100644 index 000000000..f48e1143b --- /dev/null +++ b/test/webapp-2.5/el-as-literal.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 diff --git a/test/webapp-2.5/tld-versions.jsp b/test/webapp-2.5/tld-versions.jsp new file mode 100644 index 000000000..debf2501d --- /dev/null +++ b/test/webapp-2.5/tld-versions.jsp @@ -0,0 +1,29 @@ +<%-- + 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. +--%> + +<%@ taglib prefix="tags11" uri="http://tomcat.apache.org/tags11" %> +<%@ taglib prefix="tags12" uri="http://tomcat.apache.org/tags12" %> +<%@ taglib prefix="tags20" uri="http://tomcat.apache.org/tags20" %> +<%@ taglib prefix="tags21" uri="http://tomcat.apache.org/tags21" %> + + + + + + + + \ No newline at end of file diff --git a/test/webapp-3.0/el-as-literal.jsp b/test/webapp-3.0/el-as-literal.jsp new file mode 100644 index 000000000..f48e1143b --- /dev/null +++ b/test/webapp-3.0/el-as-literal.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