cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dani...@apache.org
Subject svn commit: r170261 - in /cocoon/trunk/src/test/org/apache/cocoon/components/blocks: BlocksManagerTestCase.java BlocksManagerTestCase.xconf BlocksManagerTestCase.xtest test2/ test2/COB-INF/ test2/COB-INF/block.xml test2/block-sitemap.xmap test2/test.xml wiring.xml
Date Sun, 15 May 2005 20:24:31 GMT
Author: danielf
Date: Sun May 15 13:24:30 2005
New Revision: 170261

URL: http://svn.apache.org/viewcvs?rev=170261&view=rev
Log:
Tests for mount points for the BlocksManager. Content for a second test block.

Added:
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xconf
      - copied, changed from r169877, cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xtest
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/COB-INF/
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/COB-INF/block.xml   (with
props)
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/block-sitemap.xmap   (with
props)
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/test.xml   (with props)
Removed:
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xtest
Modified:
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.java
    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=170261&r1=170260&r2=170261&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 Sun
May 15 13:24:30 2005
@@ -16,21 +16,29 @@
 package org.apache.cocoon.components.blocks;
 
 import org.apache.avalon.framework.service.ServiceException;
-import org.apache.cocoon.SitemapComponentTestCase;
+import org.apache.cocoon.SitemapTestCase;
+import org.apache.cocoon.environment.mock.MockEnvironment;
 
-public class BlocksManagerTestCase extends SitemapComponentTestCase {
+public class BlocksManagerTestCase extends SitemapTestCase {
 
-    /**
-     * This method should return true if the source factories should
-     * be added automatically. Can be overwritten by subclasses. The
-     * default is true.
-     */
-    protected boolean addSourceFactories() {
-        return false;
+    public void testCreate() throws ServiceException {
+        BlocksManager blocks = (BlocksManager)this.lookup(BlocksManager.ROLE);
+        this.release(blocks);
     }
-    
-    public void testConfigure() throws ServiceException {
+
+    public void testMount() throws Exception {
+        BlocksManager blocks = (BlocksManager)this.lookup(BlocksManager.ROLE);
+        MockEnvironment env = getEnvironment("/test1/test");
+        blocks.process(env);
+        getLogger().info("Output: " + new String(env.getOutput(), "UTF-8"));
+        this.release(blocks);
+    }
+
+    public void testBlockId() throws Exception {
         BlocksManager blocks = (BlocksManager)this.lookup(BlocksManager.ROLE);
+        MockEnvironment env = getEnvironment("test");
+        blocks.process("test1id", env);
+        getLogger().info("Output: " + new String(env.getOutput(), "UTF-8"));
         this.release(blocks);
     }
 }

Copied: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xconf
(from r169877, cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xtest)
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xconf?p2=cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xconf&p1=cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xtest&r1=169877&r2=170261&rev=170261&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xtest
(original)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xconf
Sun May 15 13:24:30 2005
@@ -15,45 +15,33 @@
   limitations under the License.
 -->
 
-<testcase>
-  <roles>
-    <role name="org.apache.excalibur.xml.sax.SAXParser"
-          shorthand="xml-parser"
-          default-class="org.apache.excalibur.xml.impl.JaxpParser"/>
-    <role name="org.apache.excalibur.xmlizer.XMLizer"
-          shorthand="xmlizer"
-          default-class="org.apache.excalibur.xmlizer.DefaultXMLizer"/>
-    <role name="org.apache.excalibur.source.SourceResolver"
-          shorthand="source-resolver"
-          default-class="org.apache.cocoon.components.source.CocoonSourceResolver"/>
-    <role name="org.apache.excalibur.source.SourceFactorySelector"
-          shorthand="source-factories"
-          default-class="org.apache.cocoon.core.container.DefaultServiceSelector"/>
-    <role name="org.apache.cocoon.components.blocks.BlocksManager"
-          shorthand="blocks"
-          default-class="org.apache.cocoon.components.blocks.BlocksManager"/>
-  </roles>
-
-  <components>
-    <xml-parser class="org.apache.excalibur.xml.impl.JaxpParser">
-      <parameter name="validate" value="false"/>
-      <parameter name="namespace-prefixes" value="false"/>
-      <parameter name="stop-on-warning" value="true"/>
-      <parameter name="stop-on-recoverable-error" value="true"/>
-      <parameter name="reuse-parsers" value="false"/>
-    </xml-parser>
-
-    <xmlizer/>
-
-    <source-factories>
-      <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory"
name="resource"/>
-      <component-instance class="org.apache.cocoon.components.source.impl.ContextSourceFactory"
name="context"/>
-      <component-instance class="org.apache.excalibur.source.impl.FileSourceFactory" name="file"/>
-      <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
-    </source-factories>
+<cocoon version="2.2">
 
-    <blocks file="resource://org/apache/cocoon/components/blocks/wiring.xml"/> 
+  <include src="resource://org/apache/cocoon/cocoon.roles"/>
 
-  </components>
+  <xml-parser class="org.apache.excalibur.xml.impl.JaxpParser">
+    <parameter name="validate" value="false"/>
+    <parameter name="namespace-prefixes" value="false"/>
+    <parameter name="stop-on-warning" value="true"/>
+    <parameter name="stop-on-recoverable-error" value="true"/>
+    <parameter name="reuse-parsers" value="false"/>
+  </xml-parser>
 
-</testcase>
+  <xmlizer/>
+
+  <source-resolver/>
+
+  <fam/>
+
+  <source-factories>
+    <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory"
name="resource"/>
+    <component-instance class="org.apache.cocoon.components.source.impl.ContextSourceFactory"
name="context"/>
+    <component-instance class="org.apache.excalibur.source.impl.FileSourceFactory" name="file"/>
+    <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
+  </source-factories>
+
+  <component role="org.apache.cocoon.components.blocks.BlocksManager"
+             class="org.apache.cocoon.components.blocks.BlocksManager"
+             file="wiring.xml"/>
+
+</cocoon>

Added: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/COB-INF/block.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/COB-INF/block.xml?rev=170261&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/COB-INF/block.xml (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/COB-INF/block.xml Sun
May 15 13:24:30 2005
@@ -0,0 +1,32 @@
+<?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/anyblock2/1.0">
+  <name>anyblock2</name>
+  <description href="http://cocoon.apache.org/blocks/anyblock2/1.0">
+    Another test block
+  </description>
+  <state href="http://cocoon.apache.org/blocks/anyblock/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"/>
+</block>
\ No newline at end of file

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

Added: 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=170261&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/block-sitemap.xmap (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/block-sitemap.xmap Sun
May 15 13:24:30 2005
@@ -0,0 +1,57 @@
+<?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.
+-->
+
+<!-- SVN $Id$ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+  <map:components>
+    <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:transformers>
+
+    <map:serializers default="xml">
+      <map:serializer mime-type="text/xml" name="xml" src="org.apache.cocoon.serialization.XMLSerializer"/>
+    </map:serializers>
+
+    <map:matchers default="wildcard">
+      <map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"/>
+    </map:matchers>
+
+    <map:pipes default="noncaching">
+      <map:pipe name="noncaching" src="org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline">
+      </map:pipe>
+    </map:pipes>
+  </map:components>
+
+  <map:pipelines>
+    <map:pipeline>
+
+      <map:match pattern="test">
+        <map:generate type="file" src="test.xml"/>
+        <map:serialize type="xml"/>
+      </map:match>
+
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Propchange: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/block-sitemap.xmap
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/test.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/test.xml?rev=170261&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/test.xml (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/test.xml Sun May 15 13:24:30
2005
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><test/>
\ No newline at end of file

Propchange: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test2/test.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=170261&r1=170260&r2=170261&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 Sun May 15 13:24:30
2005
@@ -18,7 +18,7 @@
         xsi:schemaLocation="http://apache.org/cocoon/blocks/wiring/1.0 wiring-schema-1.0.xsd"
 >
 
-  <block id="test1id" location="./test1/">
+  <block id="test1id" location="test1/">
     <mount path="/test1/"/>
     <connections>
       <connection name="test2" block="test2id"/>
@@ -28,6 +28,8 @@
     </properties>
   </block>
 
-  <block id="test2id" location="./test2/"/>
+  <block id="test2id" location="test2/">
+    <mount path="/test2/"/>
+  </block>
 
 </wiring>



Mime
View raw message