Author: markt Date: Sun Mar 7 20:32:26 2010 New Revision: 920096 URL: http://svn.apache.org/viewvc?rev=920096&view=rev Log: Test that tags from libraries that declare various JSP versions have EL and deferred EL enabled/disabled as appropriate. This currently triggers a failure - fix to follow shortly.
Added: tomcat/trunk/test/webapp-3.0/WEB-INF/tags11.tld (with props) tomcat/trunk/test/webapp-3.0/WEB-INF/tags12.tld (with props) tomcat/trunk/test/webapp-3.0/WEB-INF/tags20.tld (with props) tomcat/trunk/test/webapp-3.0/WEB-INF/tags21.tld (with props) tomcat/trunk/test/webapp-3.0/tld-versions.jsp (with props) Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestValidator.java Modified: tomcat/trunk/test/org/apache/jasper/compiler/TestValidator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/jasper/compiler/TestValidator.java?rev=920096&r1=920095&r2=920096&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/jasper/compiler/TestValidator.java (original) +++ tomcat/trunk/test/org/apache/jasper/compiler/TestValidator.java Sun Mar 7 20:32:26 2010 @@ -20,8 +20,12 @@ import java.io.File; import java.io.IOException; +import javax.servlet.jsp.JspException; +import javax.servlet.jsp.tagext.TagSupport; + import org.apache.catalina.startup.Tomcat; import org.apache.catalina.startup.TomcatBaseTest; +import org.apache.tomcat.util.buf.ByteChunk; public class TestValidator extends TomcatBaseTest { @@ -45,4 +49,54 @@ // Failure is expected assertNotNull(e); } + + + public void testTldVersions30() 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/tld-versions.jsp"); + + String result = res.toString(); + + assertTrue(result.indexOf("<p>${'00-hello world'}</p>") > 0); + assertTrue(result.indexOf("<p>#{'01-hello world'}</p>") > 0); + assertTrue(result.indexOf("<p>${'02-hello world'}</p>") > 0); + assertTrue(result.indexOf("<p>#{'03-hello world'}</p>") > 0); + assertTrue(result.indexOf("<p>04-hello world</p>") > 0); + assertTrue(result.indexOf("<p>#{'05-hello world'}</p>") > 0); + assertTrue(result.indexOf("<p>06-hello world</p>") > 0); + } + + public static class Echo extends TagSupport { + + private static final long serialVersionUID = 1L; + + private String echo = null; + + public void setEcho(String echo) { + this.echo = echo; + } + + public String getEcho() { + return echo; + } + + @Override + public int doStartTag() throws JspException { + try { + pageContext.getOut().print("<p>" + echo + "</p>"); + } catch (IOException e) { + pageContext.getServletContext().log("Tag (Echo21) failure", e); + } + return super.doStartTag(); + } + } } Added: tomcat/trunk/test/webapp-3.0/WEB-INF/tags11.tld URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0/WEB-INF/tags11.tld?rev=920096&view=auto ============================================================================== --- tomcat/trunk/test/webapp-3.0/WEB-INF/tags11.tld (added) +++ tomcat/trunk/test/webapp-3.0/WEB-INF/tags11.tld Sun Mar 7 20:32:26 2010 @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!-- + 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. +--><!DOCTYPE taglib + PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" + "http://java.sun.com/dtd/web-jsptaglibrary_1_1.dtd"> +<taglib> + <tlibversion>1.0</tlibversion> + <jspversion>1.1</jspversion> + <shortname>Tags11</shortname> + <uri>http://tomcat.apache.org/tags11</uri> + + <tag> + <name>Echo</name> + <tagclass>org.apache.jasper.compiler.TestValidator$Echo</tagclass> + <bodycontent>empty</bodycontent> + <attribute> + <name>echo</name> + <required>yes</required> + </attribute> + </tag> + +</taglib> \ No newline at end of file Propchange: tomcat/trunk/test/webapp-3.0/WEB-INF/tags11.tld ------------------------------------------------------------------------------ svn:eol-style = native Added: tomcat/trunk/test/webapp-3.0/WEB-INF/tags12.tld URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0/WEB-INF/tags12.tld?rev=920096&view=auto ============================================================================== --- tomcat/trunk/test/webapp-3.0/WEB-INF/tags12.tld (added) +++ tomcat/trunk/test/webapp-3.0/WEB-INF/tags12.tld Sun Mar 7 20:32:26 2010 @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!-- + 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. +--><!DOCTYPE taglib + PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN" + "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd"> +<taglib> + <tlib-version>1.0</tlib-version> + <jsp-version>1.2</jsp-version> + <short-name>Tags12</short-name> + <uri>http://tomcat.apache.org/tags12</uri> + + <tag> + <name>Echo</name> + <tagclass>org.apache.jasper.compiler.TestValidator$Echo</tagclass> + <body-content>empty</body-content> + <attribute> + <name>echo</name> + <required>yes</required> + </attribute> + </tag> + +</taglib> \ No newline at end of file Propchange: tomcat/trunk/test/webapp-3.0/WEB-INF/tags12.tld ------------------------------------------------------------------------------ svn:eol-style = native Added: tomcat/trunk/test/webapp-3.0/WEB-INF/tags20.tld URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0/WEB-INF/tags20.tld?rev=920096&view=auto ============================================================================== --- tomcat/trunk/test/webapp-3.0/WEB-INF/tags20.tld (added) +++ tomcat/trunk/test/webapp-3.0/WEB-INF/tags20.tld Sun Mar 7 20:32:26 2010 @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!-- + 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 xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee + http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_0.xsd" + version="2.0"> + <tlib-version>1.0</tlib-version> + <short-name>Tags20</short-name> + <uri>http://tomcat.apache.org/tags20</uri> + + <tag> + <name>Echo</name> + <tagclass>org.apache.jasper.compiler.TestValidator$Echo</tagclass> + <body-content>empty</body-content> + <attribute> + <name>echo</name> + <required>yes</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + +</taglib> \ No newline at end of file Propchange: tomcat/trunk/test/webapp-3.0/WEB-INF/tags20.tld ------------------------------------------------------------------------------ svn:eol-style = native Added: tomcat/trunk/test/webapp-3.0/WEB-INF/tags21.tld URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0/WEB-INF/tags21.tld?rev=920096&view=auto ============================================================================== --- tomcat/trunk/test/webapp-3.0/WEB-INF/tags21.tld (added) +++ tomcat/trunk/test/webapp-3.0/WEB-INF/tags21.tld Sun Mar 7 20:32:26 2010 @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="ISO-8859-1" ?> +<!-- + 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 xmlns="http://java.sun.com/xml/ns/javaee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/javaee + http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd" + version="2.1"> + <tlib-version>1.0</tlib-version> + <short-name>Tags21</short-name> + <uri>http://tomcat.apache.org/tags21</uri> + + <tag> + <name>Echo</name> + <tagclass>org.apache.jasper.compiler.TestValidator$Echo</tagclass> + <body-content>empty</body-content> + <attribute> + <name>echo</name> + <required>yes</required> + <rtexprvalue>true</rtexprvalue> + </attribute> + </tag> + +</taglib> \ No newline at end of file Propchange: tomcat/trunk/test/webapp-3.0/WEB-INF/tags21.tld ------------------------------------------------------------------------------ svn:eol-style = native Added: tomcat/trunk/test/webapp-3.0/tld-versions.jsp URL: http://svn.apache.org/viewvc/tomcat/trunk/test/webapp-3.0/tld-versions.jsp?rev=920096&view=auto ============================================================================== --- tomcat/trunk/test/webapp-3.0/tld-versions.jsp (added) +++ tomcat/trunk/test/webapp-3.0/tld-versions.jsp Sun Mar 7 20:32:26 2010 @@ -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. +--%> +<html><body> +<%@ 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" %> +<tags11:Echo echo="${'00-hello world'}"/> +<tags11:Echo echo="#{'01-hello world'}"/> +<tags12:Echo echo="${'02-hello world'}"/> +<tags12:Echo echo="#{'03-hello world'}"/> +<tags20:Echo echo="${'04-hello world'}"/> +<tags20:Echo echo="#{'05-hello world'}"/> +<tags21:Echo echo="${'06-hello world'}"/> +</body></html> \ No newline at end of file Propchange: tomcat/trunk/test/webapp-3.0/tld-versions.jsp ------------------------------------------------------------------------------ svn:eol-style = native --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org