You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by da...@apache.org on 2005/06/02 00:38:28 UTC

svn commit: r179443 - in /cocoon/trunk/src/test/org/apache/cocoon/components/blocks: BlocksManagerTestCase.java test1/block-sitemap.xmap test1/sub/sitemap.xmap test2/block-sitemap.xmap test3/COB-INF/block.xml test3/block-properties.xsl test3/block-sitemap.xmap test3/prop-expected.xml wiring.xml

Author: danielf
Date: Wed Jun  1 15:38:26 2005
New Revision: 179443

URL: http://svn.apache.org/viewcvs?rev=179443&view=rev
Log:
Test case for block properties and some tidying.

Added:
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-properties.xsl   (with props)
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/prop-expected.xml   (with props)
Modified:
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.java
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/block-sitemap.xmap
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/sub/sitemap.xmap
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/block-sitemap.xmap
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/COB-INF/block.xml   (contents, props changed)
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-sitemap.xmap
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/wiring.xml

Modified: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.java?rev=179443&r1=179442&r2=179443&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.java (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.java Wed Jun  1 15:38:26 2005
@@ -85,4 +85,8 @@
     public void testBlockExtend4() throws Exception {
         pipeTest("ext/test4", "test1/test.xml");
     }
+
+    public void testBlockProperty() throws Exception {
+        pipeTest("ext/prop", "test3/prop-expected.xml");
+    }
 }

Modified: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/block-sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/block-sitemap.xmap?rev=179443&r1=179442&r2=179443&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/block-sitemap.xmap (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/block-sitemap.xmap Wed Jun  1 15:38:26 2005
@@ -15,7 +15,7 @@
   limitations under the License.
 -->
 
-<!-- SVN $Id$ -->
+<!-- SVN $Id:$ -->
 
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
 
@@ -33,9 +33,7 @@
     </map:generators>
 
     <map:transformers default="xslt">
-      <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer">
-        <xslt-processor-role>xalan</xslt-processor-role>
-      </map:transformer>
+      <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer"/>
     </map:transformers>
 
     <map:serializers default="xml">
@@ -56,23 +54,23 @@
     <map:pipeline>
 
       <map:match pattern="test">
-        <map:generate type="file" src="test.xml"/>
-        <map:serialize type="xml"/>
+        <map:generate src="test.xml"/>
+        <map:serialize/>
       </map:match>
 
       <map:match pattern="test2">
-        <map:generate type="file" src="block:test2:/test"/>
-        <map:serialize type="xml"/>
+        <map:generate src="block:test2:/test"/>
+        <map:serialize/>
       </map:match>
 
       <map:match pattern="test3">
-        <map:generate type="file" src="block:/test"/>
-        <map:serialize type="xml"/>
+        <map:generate src="block:/test"/>
+        <map:serialize/>
       </map:match>
 
       <map:match pattern="test4">
-        <map:generate type="file" src="resource://test.xml"/>
-        <map:serialize type="xml"/>
+        <map:generate src="resource://test.xml"/>
+        <map:serialize/>
       </map:match>
 
       <map:match pattern="sub/**">

Modified: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/sub/sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/sub/sitemap.xmap?rev=179443&r1=179442&r2=179443&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/sub/sitemap.xmap (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/sub/sitemap.xmap Wed Jun  1 15:38:26 2005
@@ -22,18 +22,18 @@
     <map:pipeline>
 
       <map:match pattern="test">
-        <map:generate type="file" src="test.xml"/>
-        <map:serialize type="xml"/>
+        <map:generate src="test.xml"/>
+        <map:serialize/>
       </map:match>
 
       <map:match pattern="test2">
-        <map:generate type="file" src="block:./test"/>
-        <map:serialize type="xml"/>
+        <map:generate src="block:./test"/>
+        <map:serialize/>
       </map:match>
 
       <map:match pattern="test3">
-        <map:generate type="file" src="block:/test"/>
-        <map:serialize type="xml"/>
+        <map:generate src="block:/test"/>
+        <map:serialize/>
       </map:match>
 
     </map:pipeline>

Modified: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/block-sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/block-sitemap.xmap?rev=179443&r1=179442&r2=179443&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/block-sitemap.xmap (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/block-sitemap.xmap Wed Jun  1 15:38:26 2005
@@ -15,7 +15,7 @@
   limitations under the License.
 -->
 
-<!-- SVN $Id$ -->
+<!-- SVN $Id:$ -->
 
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
 
@@ -25,9 +25,7 @@
     </map:generators>
 
     <map:transformers default="xslt">
-      <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer">
-        <xslt-processor-role>xalan</xslt-processor-role>
-      </map:transformer>
+      <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer"/>
     </map:transformers>
 
     <map:serializers default="xml">
@@ -48,8 +46,8 @@
     <map:pipeline>
 
       <map:match pattern="test">
-        <map:generate type="file" src="test.xml"/>
-        <map:serialize type="xml"/>
+        <map:generate src="test.xml"/>
+        <map:serialize/>
       </map:match>
 
     </map:pipeline>

Modified: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/COB-INF/block.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/COB-INF/block.xml?rev=179443&r1=179442&r2=179443&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/COB-INF/block.xml (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/COB-INF/block.xml Wed Jun  1 15:38:26 2005
@@ -1,39 +1,42 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Copyright 1999-2004 The Apache Software Foundation
-
-  Licensed 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. 
--->
-<block xmlns="http://apache.org/cocoon/blocks/cob/1.0"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
-       xsi:schemaLocation="http://apache.org/cocoon/blocks/cob/1.0 cob-schema-1.0.xsd"
-       id="http://cocoon.apache.org/blocks/extendedblock/1.0">
-  <name>extendedblock</name>
-  <description href="http://cocoon.apache.org/blocks/extendedblock/1.0">
-    An extended test block
-  </description>
-  <state href="http://cocoon.apache.org/blocks/extendedblock/1.0/state.html" 
-         community="committed" 
-         interfaces="unstable" 
-         implementation="stable"/>
-  <license href="http://www.apache.org/licenses/">Apache License 2.0</license>
-  <author href="http://cocoon.apache.org">Apache Cocoon community</author>
-  <sitemap src="block-sitemap.xmap"/>
-  <properties>
-    <property name="bar">
-      <default>gazonk</default>
-      <description>Another test property</description>
-    </property>
-  </properties>
-  <extends block="http://cocoon.apache.org/blocks/anyblock/1.0"/>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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. 
+-->
+<block xmlns="http://apache.org/cocoon/blocks/cob/1.0"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+       xsi:schemaLocation="http://apache.org/cocoon/blocks/cob/1.0 cob-schema-1.0.xsd"
+       id="http://cocoon.apache.org/blocks/extendedblock/1.0">
+  <name>extendedblock</name>
+  <description href="http://cocoon.apache.org/blocks/extendedblock/1.0">
+    An extended test block
+  </description>
+  <state href="http://cocoon.apache.org/blocks/extendedblock/1.0/state.html" 
+         community="committed" 
+         interfaces="unstable" 
+         implementation="stable"/>
+  <license href="http://www.apache.org/licenses/">Apache License 2.0</license>
+  <author href="http://cocoon.apache.org">Apache Cocoon community</author>
+  <sitemap src="block-sitemap.xmap"/>
+  <properties>
+    <property name="bar">
+      <default>gazonk</default>
+      <description>Another test property</description>
+    </property>
+    <property name="baz">
+      <description>Still another test property</description>
+    </property>
+  </properties>
+  <extends block="http://cocoon.apache.org/blocks/anyblock/1.0"/>
 </block>

Propchange: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/COB-INF/block.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-properties.xsl
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-properties.xsl?rev=179443&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-properties.xsl (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-properties.xsl Wed Jun  1 15:38:26 2005
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed 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:$ -->
+
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+  <xsl:param name="foo"/>
+  <xsl:param name="bar"/>
+  <xsl:param name="baz"/>
+
+  <xsl:template match="/">
+    <properties foo="{$foo}" bar="{$bar}" baz="{$baz}"/>
+  </xsl:template>
+
+</xsl:stylesheet>

Propchange: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-properties.xsl
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-sitemap.xmap?rev=179443&r1=179442&r2=179443&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-sitemap.xmap (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/block-sitemap.xmap Wed Jun  1 15:38:26 2005
@@ -15,7 +15,7 @@
   limitations under the License.
 -->
 
-<!-- SVN $Id$ -->
+<!-- SVN $Id:$ -->
 
 <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
 
@@ -25,14 +25,16 @@
       <component-instance class="org.apache.cocoon.components.source.impl.BlockSourceFactory" name="block"/>
     </source-factories>
 
+    <input-modules>
+      <component-instance name="block-property"  class="org.apache.cocoon.components.modules.input.BlockPropertyModule"/>
+    </input-modules>
+
     <map:generators default="file">
       <map:generator name="file" src="org.apache.cocoon.generation.FileGenerator"/>
     </map:generators>
 
     <map:transformers default="xslt">
-      <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer">
-        <xslt-processor-role>xalan</xslt-processor-role>
-      </map:transformer>
+      <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer"/>
     </map:transformers>
 
     <map:serializers default="xml">
@@ -57,13 +59,23 @@
     <map:pipeline>
 
       <map:match pattern="test">
-        <map:generate type="file" src="test.xml"/>
-        <map:serialize type="xml"/>
+        <map:generate src="test.xml"/>
+        <map:serialize/>
       </map:match>
 
       <map:match pattern="test4">
-        <map:generate type="file" src="block:super:/test"/>
-        <map:serialize type="xml"/>
+        <map:generate src="block:super:/test"/>
+        <map:serialize/>
+      </map:match>
+
+      <map:match pattern="prop">
+        <map:generate src="test.xml"/>
+        <map:transform src="block-properties.xsl">
+          <map:parameter name="foo" value="{block-property:foo}"/>
+          <map:parameter name="bar" value="{block-property:bar}"/>
+          <map:parameter name="baz" value="{block-property:baz}"/>
+        </map:transform>
+        <map:serialize/>
       </map:match>
 
       <map:match pattern="**">

Added: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/prop-expected.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/prop-expected.xml?rev=179443&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/prop-expected.xml (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/prop-expected.xml Wed Jun  1 15:38:26 2005
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><properties baz="blah" bar="gazonk" foo="bar"/>
\ No newline at end of file

Propchange: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test3/prop-expected.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/wiring.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/wiring.xml?rev=179443&r1=179442&r2=179443&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/wiring.xml (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/wiring.xml Wed Jun  1 15:38:26 2005
@@ -37,6 +37,9 @@
     <connections>
       <connection name="super" block="test1id"/>
     </connections>
+    <properties>
+      <property name="baz" value="blah"/>
+    </properties>
   </block>
 
 </wiring>