Author: nlebas
Date: Tue Sep 16 02:21:04 2014
New Revision: 1625204

URL: http://svn.apache.org/r1625204
Log:
TILES-580 getAsString does not support expressions

Added:
    
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/layout_expr.jsp
    
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/testinsertdefinitionexpr.jsp
    
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/test/selenium/ConfiguredDefinitionExprTest.html
Modified:
    tiles/framework/branches/TILES_3_0_X/tiles-template/pom.xml
    
tiles/framework/branches/TILES_3_0_X/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java
    
tiles/framework/branches/TILES_3_0_X/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java
    tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/pom.xml
    
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
    
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/index.jsp
    
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/test/selenium/TestSuite.html

Modified: tiles/framework/branches/TILES_3_0_X/tiles-template/pom.xml
URL: 
http://svn.apache.org/viewvc/tiles/framework/branches/TILES_3_0_X/tiles-template/pom.xml?rev=1625204&r1=1625203&r2=1625204&view=diff
==============================================================================
--- tiles/framework/branches/TILES_3_0_X/tiles-template/pom.xml (original)
+++ tiles/framework/branches/TILES_3_0_X/tiles-template/pom.xml Tue Sep 16 
02:21:04 2014
@@ -45,6 +45,7 @@
                 </goals>
                 <configuration>
                     <name>tiles</name>
+                    
<requestClass>org.apache.tiles.request.Request</requestClass>
                 </configuration>
             </execution>
         </executions>

Modified: 
tiles/framework/branches/TILES_3_0_X/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java
URL: 
http://svn.apache.org/viewvc/tiles/framework/branches/TILES_3_0_X/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java?rev=1625204&r1=1625203&r2=1625204&view=diff
==============================================================================
--- 
tiles/framework/branches/TILES_3_0_X/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java
 (original)
+++ 
tiles/framework/branches/TILES_3_0_X/tiles-template/src/main/java/org/apache/tiles/template/GetAsStringModel.java
 Tue Sep 16 02:21:04 2014
@@ -174,7 +174,10 @@ public class GetAsStringModel {
             if (attribute == null && ignore) {
                 return;
             }
-            writer.write(attribute.getValue().toString());
+            Object value = container.evaluate(attribute, request);
+            if(value != null) {
+               writer.write(value.toString());
+            }
         } catch (IOException e) {
             if (!ignore) {
                 throw e;

Modified: 
tiles/framework/branches/TILES_3_0_X/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java
URL: 
http://svn.apache.org/viewvc/tiles/framework/branches/TILES_3_0_X/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java?rev=1625204&r1=1625203&r2=1625204&view=diff
==============================================================================
--- 
tiles/framework/branches/TILES_3_0_X/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java
 (original)
+++ 
tiles/framework/branches/TILES_3_0_X/tiles-template/src/test/java/org/apache/tiles/template/GetAsStringModelTest.java
 Tue Sep 16 02:21:04 2014
@@ -77,7 +77,7 @@ public class GetAsStringModelTest {
     @Test
     public void testExecute() throws IOException {
         TilesContainer container = createMock(TilesContainer.class);
-        Attribute attribute = new Attribute("myValue");
+        Attribute attribute = createMock(Attribute.class);
         AttributeContext attributeContext = createMock(AttributeContext.class);
         Request request = createMock(Request.class);
         Writer writer = createMock(Writer.class);
@@ -96,6 +96,7 @@ public class GetAsStringModelTest {
         expect(resolver.computeAttribute(container, attribute, "myName", 
"myRole", false, "myDefaultValue",
                 "myDefaultValueRole", "myDefaultValueType", 
request)).andReturn(attribute);
         expect(container.startContext(request)).andReturn(attributeContext);
+        expect(container.evaluate(attribute, request)).andReturn("myValue");
         writer.write("myValue");
         container.endContext(request);
 

Modified: tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/pom.xml
URL: 
http://svn.apache.org/viewvc/tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/pom.xml?rev=1625204&r1=1625203&r2=1625204&view=diff
==============================================================================
--- tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/pom.xml 
(original)
+++ tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/pom.xml Tue 
Sep 16 02:21:04 2014
@@ -105,7 +105,7 @@
       <dependency>
         <groupId>org.springframework</groupId>
         <artifactId>spring-jdbc</artifactId>
-        <version>2.5.6</version>
+        <version>3.2.0.RELEASE</version>
         <exclusions>
           <exclusion>
             <groupId>commons-logging</groupId>
@@ -126,7 +126,7 @@
           <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-war-plugin</artifactId>
-              <version>2.1-beta-1</version>
+              <version>2.4</version>
               <configuration>
                   <webResources>
                       <resource>
@@ -284,7 +284,7 @@
                                 </goals>
                                 <configuration>
                                     <background>true</background>
-                                    <browser>*firefox</browser>
+                                    <browser>*googlechrome</browser>
                                     
<startURL>http://localhost:8080/tiles-test/</startURL>
                                     
<suite>src/test/selenium/TestSuite.html</suite>
                                 </configuration>

Modified: 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
URL: 
http://svn.apache.org/viewvc/tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml?rev=1625204&r1=1625203&r2=1625204&view=diff
==============================================================================
--- 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
 (original)
+++ 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/WEB-INF/tiles-defs.xml
 Tue Sep 16 02:21:04 2014
@@ -47,6 +47,12 @@
       <put-attribute name="body"   value="/body.jsp"/>
   </definition>
 
+  <definition name="test.definition.expr" template="/layout.jsp">
+      <put-attribute name="title"  expression="This is the title."/>
+      <put-attribute name="header" value="/header.jsp"/>
+      <put-attribute name="body"   value="/body.jsp"/>
+  </definition>
+
   <definition name="test.definition.ignore" template="/layout_ignore.jsp">
       <put-attribute name="title"  value="This is the title."/>
       <put-attribute name="body"   value="/body.jsp"/>
@@ -66,6 +72,7 @@
 
   <definition name="test.definition.exception" template="/layout.jsp">
       <put-attribute name="title"  value="This is the title."/>
+      <put-attribute name="title"  value="This is the title."/>
       <put-attribute name="header" value="/exception.jsp"/>
       <put-attribute name="body"   value="/body.jsp"/>
   </definition>

Modified: 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/index.jsp
URL: 
http://svn.apache.org/viewvc/tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/index.jsp?rev=1625204&r1=1625203&r2=1625204&view=diff
==============================================================================
--- 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/index.jsp
 (original)
+++ 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/index.jsp
 Tue Sep 16 02:21:04 2014
@@ -36,6 +36,7 @@
 
     <h3>Standard Render/Attribute Tests</h3>
     <a href="testinsertdefinition.jsp">Test Insert Configured 
Definition</a><br/>
+    <a href="testinsertdefinitionexpr.jsp">Test Insert Configured Definition 
With Expression</a><br/>
     <a href="testinsertdefinition_ignore.jsp">Test Insert Configured 
Definition with Ignore</a><br/>
     <a href="testinsertdefinition_flush.jsp">Test Insert Configured Definition 
with Flush</a><br/>
     <a href="testinsertdefinition_preparer.jsp">Test Insert Configured 
Definition with Preparer</a><br/>

Added: 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/layout_expr.jsp
URL: 
http://svn.apache.org/viewvc/tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/layout_expr.jsp?rev=1625204&view=auto
==============================================================================
--- 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/layout_expr.jsp
 (added)
+++ 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/layout_expr.jsp
 Tue Sep 16 02:21:04 2014
@@ -0,0 +1,37 @@
+<%@ page session="false" %>
+<%--
+/*
+ * $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" %>
+
+<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>
+</table>           
\ No newline at end of file

Added: 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/testinsertdefinitionexpr.jsp
URL: 
http://svn.apache.org/viewvc/tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/testinsertdefinitionexpr.jsp?rev=1625204&view=auto
==============================================================================
--- 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/testinsertdefinitionexpr.jsp
 (added)
+++ 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/main/webapp/testinsertdefinitionexpr.jsp
 Tue Sep 16 02:21:04 2014
@@ -0,0 +1,27 @@
+<%@ page session="false" %>
+<%--
+/*
+ * $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.expr" />

Added: 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/test/selenium/ConfiguredDefinitionExprTest.html
URL: 
http://svn.apache.org/viewvc/tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/test/selenium/ConfiguredDefinitionExprTest.html?rev=1625204&view=auto
==============================================================================
--- 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/test/selenium/ConfiguredDefinitionExprTest.html
 (added)
+++ 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/test/selenium/ConfiguredDefinitionExprTest.html
 Tue Sep 16 02:21:04 2014
@@ -0,0 +1,61 @@
+<!--
+/*
+ * $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</title>
+</head>
+<body>
+<table cellpadding="1" cellspacing="1" border="1">
+<thead>
+<tr><td rowspan="1" colspan="3">Configured Definition With Expression 
Test</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 Expression</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>
+
+</tbody></table>
+</body>
+</html>

Modified: 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/test/selenium/TestSuite.html
URL: 
http://svn.apache.org/viewvc/tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/test/selenium/TestSuite.html?rev=1625204&r1=1625203&r2=1625204&view=diff
==============================================================================
--- 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/test/selenium/TestSuite.html
 (original)
+++ 
tiles/framework/branches/TILES_3_0_X/tiles-test-pom/tiles-test/src/test/selenium/TestSuite.html
 Tue Sep 16 02:21:04 2014
@@ -34,6 +34,9 @@
         <td><a href="ConfiguredDefinitionTest.html">Configured Definition 
Test</a></td>
     </tr>
     <tr>
+        <td><a href="ConfiguredDefinitionExprTest.html">Configured Definition 
With Expression Test</a></td>
+    </tr>
+    <tr>
         <td><a href="ConfiguredDefinitionIgnoreTest.html">Configured 
Definition with Ignore Test</a></td>
     </tr>
     <tr>


Reply via email to