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 2009/01/16 12:26:26 UTC

svn commit: r734977 - in /tiles/framework/trunk/tiles-core/src: main/java/org/apache/tiles/definition/digester/ test/java/org/apache/tiles/config/ test/java/org/apache/tiles/definition/digester/

Author: apetrelli
Date: Fri Jan 16 03:26:14 2009
New Revision: 734977

URL: http://svn.apache.org/viewvc?rev=734977&view=rev
Log:
TILES-352
Fixed the DEF_LIST_TAG constant, that should intercept all <put-list-attribute> elements.
Added regression test case.

Added:
    tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/config/defs_regression_TILES-352.xml   (with props)
Modified:
    tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java
    tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/digester/TestDigesterDefinitionsReader.java

Modified: tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java?rev=734977&r1=734976&r2=734977&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java (original)
+++ tiles/framework/trunk/tiles-core/src/main/java/org/apache/tiles/definition/digester/DigesterDefinitionsReader.java Fri Jan 16 03:26:14 2009
@@ -96,15 +96,10 @@
     private static final String ADD_DEFINITION_TAG = "*/add-attribute/definition";
 
     /**
-     * Intercepts a &lt;put-list-attribute&gt; tag.
-     */
-    private static final String LIST_TAG = "put-list-attribute";
-
-    /**
      * Intercepts a &lt;put-list-attribute&gt; tag inside a %lt;definition&gt;
      * tag.
      */
-    private static final String DEF_LIST_TAG = DEFINITION_TAG + "/" + LIST_TAG;
+    private static final String DEF_LIST_TAG = "*/definition/put-list-attribute";
 
     /**
      * Intercepts a &lt;add-attribute&gt; tag.

Added: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/config/defs_regression_TILES-352.xml
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/config/defs_regression_TILES-352.xml?rev=734977&view=auto
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/config/defs_regression_TILES-352.xml (added)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/config/defs_regression_TILES-352.xml Fri Jan 16 03:26:14 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+ <!--
+  /* * $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. */
+ -->
+
+ <!DOCTYPE tiles-definitions PUBLIC
+       "-//Apache Software Foundation//DTD Tiles Configuration 2.1//EN"
+       "http://tiles.apache.org/dtds/tiles-config_2_1.dtd">
+
+ <!-- Definitions to check regression from TILES-252    -->
+
+<tiles-definitions>
+ <definition name="root">
+  <put-attribute name="body">
+   <definition template="/my/template.jsp">
+    <put-list-attribute name="list">
+     <add-attribute value="This is a value" type="string" />
+    </put-list-attribute>
+   </definition>
+  </put-attribute>
+ </definition>
+
+</tiles-definitions>

Propchange: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/config/defs_regression_TILES-352.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/config/defs_regression_TILES-352.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Modified: tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/digester/TestDigesterDefinitionsReader.java
URL: http://svn.apache.org/viewvc/tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/digester/TestDigesterDefinitionsReader.java?rev=734977&r1=734976&r2=734977&view=diff
==============================================================================
--- tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/digester/TestDigesterDefinitionsReader.java (original)
+++ tiles/framework/trunk/tiles-core/src/test/java/org/apache/tiles/definition/digester/TestDigesterDefinitionsReader.java Fri Jan 16 03:26:14 2009
@@ -303,4 +303,28 @@
             fail("Exception reading configuration." + e);
         }
     }
+
+    /**
+     * Regression test for bug TILES-352.
+     *
+     * @throws IOException If something goes wrong.
+     */
+    @SuppressWarnings("unchecked")
+    public void testRegressionTiles352() throws IOException {
+        reader.init(new HashMap<String, String>());
+
+        URL configFile = this.getClass().getClassLoader().getResource(
+                "org/apache/tiles/config/defs_regression_TILES-352.xml");
+        assertNotNull("Config file not found", configFile);
+
+        InputStream source = configFile.openStream();
+        Map<String, Definition> name2defs = reader.read(source);
+        source.close();
+        Definition root = name2defs.get("root");
+        Attribute attribute = root.getAttribute("body");
+        Definition child = name2defs.get((String) attribute.getValue());
+        ListAttribute listAttribute = (ListAttribute) child.getAttribute("list");
+        List<Object> list = (List<Object>) listAttribute.getValue();
+        assertEquals(((Attribute) list.get(0)).getValue(), "This is a value");
+    }
 }