You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tiles.apache.org by ap...@apache.org on 2007/07/21 13:44:12 UTC

svn commit: r558316 - in /tiles/framework/trunk/tiles-test: ./ src/main/webapp/ src/main/webapp/WEB-INF/ src/test/selenium/

Author: apetrelli
Date: Sat Jul 21 04:44:11 2007
New Revision: 558316

URL: http://svn.apache.org/viewvc?view=rev&rev=558316
Log:
TILES-169
Added test case in "tiles-test" webapp to check how FreeMarker integrates with Tiles.

Added:
    tiles/framework/trunk/tiles-test/src/main/webapp/layout.ftl   (with props)
    tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_freemarker.jsp   (with props)
    tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionFreeMarkerTest.html   (with props)
Modified:
    tiles/framework/trunk/tiles-test/pom.xml
    tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
    tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml
    tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp
    tiles/framework/trunk/tiles-test/src/main/webapp/selectlocale.jsp   (contents, props changed)
    tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html

Modified: tiles/framework/trunk/tiles-test/pom.xml
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/pom.xml?view=diff&rev=558316&r1=558315&r2=558316
==============================================================================
--- tiles/framework/trunk/tiles-test/pom.xml (original)
+++ tiles/framework/trunk/tiles-test/pom.xml Sat Jul 21 04:44:11 2007
@@ -66,6 +66,11 @@
          <version>1.1.2</version>
          <scope>runtime</scope>
       </dependency>
+      <dependency>
+        <groupId>org.freemarker</groupId>
+        <artifactId>freemarker</artifactId>
+        <version>2.3.10</version>
+      </dependency>
    </dependencies>
    
    <build>

Modified: tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml?view=diff&rev=558316&r1=558315&r2=558316
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml (original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml Sat Jul 21 04:44:11 2007
@@ -47,6 +47,12 @@
       <put-attribute name="body"   value="/body.jsp"/>
   </definition>
 
+  <definition name="test.definition.freemarker" template="/layout.ftl">
+      <put-attribute name="title"  value="This is the title."/>
+      <put-attribute name="header" value="/header.jsp"/>
+      <put-attribute name="body"   value="/body.jsp"/>
+  </definition>
+
   <definition name="test.definition.flush" template="/layout_flush.jsp">
       <put-attribute name="title"  value="This is the title."/>
       <put-attribute name="header" value="/header.jsp"/>

Modified: tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml?view=diff&rev=558316&r1=558315&r2=558316
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml (original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/WEB-INF/web.xml Sat Jul 21 04:44:11 2007
@@ -69,6 +69,40 @@
         </init-param>
         <load-on-startup>2</load-on-startup>
     </servlet>
+    <servlet>
+        <servlet-name>freemarker</servlet-name>
+        <servlet-class>freemarker.ext.servlet.FreemarkerServlet</servlet-class>
+        
+        <!-- FreemarkerServlet settings: -->
+        <init-param>
+            <param-name>TemplatePath</param-name>
+            <param-value>/</param-value>
+        </init-param>
+        <init-param>
+            <param-name>NoCache</param-name>
+            <param-value>true</param-value>
+        </init-param>
+        <init-param>
+            <param-name>ContentType</param-name>
+            <param-value>text/html</param-value>
+        </init-param>
+        
+        <!-- FreeMarker settings: -->
+        <init-param>
+            <param-name>template_update_delay</param-name>
+            <param-value>0</param-value> <!-- 0 is for development only! Use higher value otherwise. -->
+        </init-param>
+        <init-param>
+            <param-name>default_encoding</param-name>
+            <param-value>ISO-8859-1</param-value>
+        </init-param>
+        <init-param>
+            <param-name>number_format</param-name>
+            <param-value>0.##########</param-value>
+        </init-param>
+        
+        <load-on-startup>3</load-on-startup>
+    </servlet>
 
     <servlet>
         <servlet-name>Tiles Dispatch Servlet</servlet-name>
@@ -93,6 +127,10 @@
         <welcome-file>index.jsp</welcome-file>
     </welcome-file-list>
 
+    <servlet-mapping>
+        <servlet-name>freemarker</servlet-name>
+        <url-pattern>*.ftl</url-pattern>
+    </servlet-mapping>
     <servlet-mapping>
         <servlet-name>layoutServlet</servlet-name>
         <url-pattern>/servlets/layoutServlet</url-pattern>

Modified: tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp?view=diff&rev=558316&r1=558315&r2=558316
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp (original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/index.jsp Sat Jul 21 04:44:11 2007
@@ -42,6 +42,7 @@
     <a href="testinsertdefinition_inline.jsp">Test Insert Configured Definition with an inline content</a><br/>
     <a href="testinsertdefinition_composite.jsp">Test Insert Configured Definition that contains another definition inside</a><br/>
     <a href="testinsertdefinition_exception.jsp">Test Insert Configured Definition with an exception in an attribute page</a><br/>
+    <a href="testinsertdefinition_freemarker.jsp">Test Insert Configured Definition with FreeMarker</a><br/>
     <a href="testput.jsp">Test Put Tag</a><br/>
     <a href="testput_flush.jsp">Test Put Tag with Flush</a><br/>
     <a href="testput_el.jsp">Test Put Tag using EL</a><br/>

Added: tiles/framework/trunk/tiles-test/src/main/webapp/layout.ftl
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/layout.ftl?view=auto&rev=558316
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/layout.ftl (added)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/layout.ftl Sat Jul 21 04:44:11 2007
@@ -0,0 +1,39 @@
+<#--
+/*
+ * $Id$
+ *
+ * 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.
+ *
+ */
+-->
+<#assign tiles=JspTaglibs["http://tiles.apache.org/tags-tiles"]>
+
+<table  border="2"  width="300"  bordercolor="Gray">
+  <tr>
+    <td  bgcolor="Blue"><strong><@tiles.getAsString name="title"/></strong></td>
+  </tr>
+  <tr>
+    <td><@tiles.insertAttribute name="header"/></td>
+  </tr>
+  <tr>
+    <td><@tiles.insertAttribute name="body"/></td>
+  </tr>
+  <tr>
+    <td>This layout is made in FreeMarker.</td>
+  </tr>
+</table>           
\ No newline at end of file

Propchange: tiles/framework/trunk/tiles-test/src/main/webapp/layout.ftl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/framework/trunk/tiles-test/src/main/webapp/layout.ftl
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: tiles/framework/trunk/tiles-test/src/main/webapp/selectlocale.jsp
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/selectlocale.jsp?view=diff&rev=558316&r1=558315&r2=558316
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/selectlocale.jsp (original)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/selectlocale.jsp Sat Jul 21 04:44:11 2007
@@ -1,44 +1,44 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
-<%--
-/*
- * $Id$
- *
- * 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.
- *
- */
---%>
+<%--
+/*
+ * $Id$
+ *
+ * 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>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 <title>Select your locale</title>
 </head>
 <body>
-<form action="servlets/selectLocaleServlet">
-Select your locale:
-<select name="locale">
-<option selected="selected" value="">Default</option>
-<option value="en_US">American English</option>
-<option value="en_GB">British English</option>
-<option value="fr_FR">French</option>
-<option value="it_IT">Italian</option>
-</select>
-<input type="submit" value="Submit" />
-</form>
+<form action="servlets/selectLocaleServlet">
+Select your locale:
+<select name="locale">
+<option selected="selected" value="">Default</option>
+<option value="en_US">American English</option>
+<option value="en_GB">British English</option>
+<option value="fr_FR">French</option>
+<option value="it_IT">Italian</option>
+</select>
+<input type="submit" value="Submit" />
+</form>
 <div id="defaultLocaleMessage">Your default Locale is <%=request.getLocale().toString() %></div>
 </body>
-</html>
\ No newline at end of file
+</html>

Propchange: tiles/framework/trunk/tiles-test/src/main/webapp/selectlocale.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_freemarker.jsp
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_freemarker.jsp?view=auto&rev=558316
==============================================================================
--- tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_freemarker.jsp (added)
+++ tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_freemarker.jsp Sat Jul 21 04:44:11 2007
@@ -0,0 +1,26 @@
+<%--
+/*
+ * $Id$
+ *
+ * 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 uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %>
+
+<tiles:insertDefinition name="test.definition.freemarker" />

Propchange: tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_freemarker.jsp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/framework/trunk/tiles-test/src/main/webapp/testinsertdefinition_freemarker.jsp
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Added: tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionFreeMarkerTest.html
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionFreeMarkerTest.html?view=auto&rev=558316
==============================================================================
--- tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionFreeMarkerTest.html (added)
+++ tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionFreeMarkerTest.html Sat Jul 21 04:44:11 2007
@@ -0,0 +1,66 @@
+<!--
+/*
+ * $Id$
+ *
+ * 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>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>Configured Definition Test with FreeMarker</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Configured Definition Test with FreeMarker</td></tr>
+</thead><tbody>
+<tr>
+	<td>open</td>
+	<td>/tiles-test/index.jsp</td>
+	<td></td>
+</tr>
+<tr>
+	<td>clickAndWait</td>
+	<td>link=Test Insert Configured Definition with FreeMarker</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>This is the title.</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>This is the header</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>This is a body</td>
+	<td></td>
+</tr>
+<tr>
+	<td>assertTextPresent</td>
+	<td>This layout is made in FreeMarker.</td>
+	<td></td>
+</tr>
+
+</tbody></table>
+</body>
+</html>

Propchange: tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionFreeMarkerTest.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/framework/trunk/tiles-test/src/test/selenium/ConfiguredDefinitionFreeMarkerTest.html
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html?view=diff&rev=558316&r1=558315&r2=558316
==============================================================================
--- tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html (original)
+++ tiles/framework/trunk/tiles-test/src/test/selenium/TestSuite.html Sat Jul 21 04:44:11 2007
@@ -37,6 +37,9 @@
         <td><a href="ConfiguredDefinitionFlushTest.html">Configured Definition with Flush Test</a></td>
     </tr>
     <tr>
+        <td><a href="ConfiguredDefinitionFreeMarkerTest.html">Configured Definition with FreeMarker Test</a></td>
+    </tr>
+    <tr>
         <td><a href="ConfiguredDefinitionWithPreparerTest.html">Configured Definition with Preparer Test</a></td>
     </tr>
     <tr>