cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jheym...@apache.org
Subject svn commit: r330548 [73/132] - in /cocoon/whiteboard/maven2/cocoon-flat-layout: ./ cocoon-ajax-block/ cocoon-ajax-block/api/ cocoon-ajax-block/api/src/ cocoon-ajax-block/api/src/main/ cocoon-ajax-block/api/src/main/java/ cocoon-ajax-block/api/src/main/...
Date Thu, 03 Nov 2005 14:00:48 GMT
Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/store/default.ccf
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/store/default.ccf?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/store/default.ccf (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/store/default.ccf Thu Nov  3 05:41:06 2005
@@ -0,0 +1,44 @@
+# Cache configuration defaults.
+
+# 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.
+
+
+jcs.default=DC
+jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.default.cacheattributes.MaxObjects=100
+jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+
+# SYSTEM GROUP ID CACHE
+jcs.system.groupIdCache=DC
+jcs.system.groupIdCache.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.system.groupIdCache.cacheattributes.MaxObjects=1000
+jcs.system.groupIdCache.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+
+##### AUXILIARY CACHES
+
+# Indexed Disk Cache
+jcs.auxiliary.DC=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheFactory
+jcs.auxiliary.DC.attributes=org.apache.jcs.auxiliary.disk.indexed.IndexedDiskCacheAttributes
+#jcs.auxiliary.DC.attributes.DiskPath=
+
+# PRE-DEFINED CACHE REGIONS   
+
+jcs.region.main=DC
+jcs.region.main.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
+jcs.region.main.cacheattributes.MaxObjects=100
+jcs.region.main.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
+jcs.region.main.cacheattributes.UseMemoryShrinker=true
+jcs.region.main.cacheattributes.MaxMemoryIdleTimeSeconds=3600
+jcs.region.main.cacheattributes.ShrinkerIntervalSeconds=60

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/store/impl/ehcache.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/store/impl/ehcache.xml?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/store/impl/ehcache.xml (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/store/impl/ehcache.xml Thu Nov  3 05:41:06 2005
@@ -0,0 +1,68 @@
+<?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.
+-->
+<ehcache>
+
+    <!-- Sets the path to the directory where cache .data files are created.
+
+         If the path is a Java System Property it is replaced by
+         its value in the running VM.
+
+         The following properties are translated:
+         user.home - User's home directory
+         user.dir - User's current working directory
+         java.io.tmpdir - Default temp file path -->
+    <diskStore path="java.io.tmpdir"/>
+
+    <!--Default Cache configuration. These will be applied to caches programmatically created through
+        the CacheManager.
+
+        The following attributes are required:
+
+        maxElementsInMemory            - Sets the maximum number of objects that will be created in memory
+        eternal                        - Sets whether elements are eternal. If eternal,  timeouts are ignored and the
+                                         element is never expired.
+        overflowToDisk                 - Sets whether elements can overflow to disk when the in-memory cache
+                                         has reached the maxInMemory limit.
+
+        The following attributes are optional:
+        timeToIdleSeconds              - Sets the time to idle for an element before it expires.
+                                         i.e. The maximum amount of time between accesses before an element expires
+                                         Is only used if the element is not eternal.
+                                         Optional attribute. A value of 0 means that an Element can idle for infinity.
+                                         The default value is 0.
+        timeToLiveSeconds              - Sets the time to live for an element before it expires.
+                                         i.e. The maximum time between creation time and when an element expires.
+                                         Is only used if the element is not eternal.
+                                         Optional attribute. A value of 0 means that and Element can live for infinity.
+                                         The default value is 0.
+        diskPersistent                 - Whether the disk store persists between restarts of the Virtual Machine.
+                                         The default value is false.
+        diskExpiryThreadIntervalSeconds- The number of seconds between runs of the disk expiry thread. The default value
+                                         is 120 seconds.
+        -->
+
+    <defaultCache
+        maxElementsInMemory="10000"
+        eternal="true"
+        timeToIdleSeconds="0"
+        timeToLiveSeconds="0"
+        overflowToDisk="true"
+        diskPersistent="true"
+        diskExpiryThreadIntervalSeconds="120"
+        />
+
+</ehcache>

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/store/impl/ehcache.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/treeprocessor/sitemap-language.xml
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/treeprocessor/sitemap-language.xml?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/treeprocessor/sitemap-language.xml (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/treeprocessor/sitemap-language.xml Thu Nov  3 05:41:06 2005
@@ -0,0 +1,148 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<!DOCTYPE sitemap-language [
+  <!ELEMENT sitemap-language (nodes)>
+  <!ELEMENT nodes (node+)>
+  <!ELEMENT node (allowed-children*, ignored-children*, forbidden-children*)>
+  <!ATTLIST node
+    name CDATA #REQUIRED
+    builder CDATA #REQUIRED
+  >
+  <!ELEMENT allowed-children (#PCDATA)>
+  <!ELEMENT ignored-children (#PCDATA)>
+  <!ELEMENT forbidden-children (#PCDATA)>
+]>
+
+<!--+
+    | The sitemap language.
+    | $Id: sitemap-language.xml 160478 2005-04-07 22:18:29Z danielf $
+    +-->
+<sitemap-language>
+
+    <!-- node definitions for the sitemap language -->
+    <nodes>
+      <!-- A node has the following attributes :
+           - name : the node name, given as a local name in the language namespace (no prefix)
+           - builder : the class name of the ProcessingNodeBuilder for this node
+           
+           The contents of a node definition is the configuration of Configurable
+           ProcessingNodeBuilders.
+        -->
+      
+      <!-- Sitemap root node -->
+      <node name="sitemap" builder="org.apache.cocoon.components.treeprocessor.sitemap.SitemapNodeBuilder">
+        <allowed-children>components, views, action-sets, resources, flow, pipelines</allowed-children>
+      </node>
+
+      <node name="components" builder="org.apache.cocoon.components.treeprocessor.sitemap.ComponentsNodeBuilder"/>
+
+      <node name="generators" builder="org.apache.cocoon.components.treeprocessor.sitemap.VPCsNodeBuilder"/>
+
+      <node name="generator" builder="org.apache.cocoon.components.treeprocessor.sitemap.VPCNodeBuilder">
+        <ignored-children>source</ignored-children>
+      </node>
+
+      <node name="transformers" builder="org.apache.cocoon.components.treeprocessor.sitemap.VPCsNodeBuilder"/>
+
+      <node name="transformer" builder="org.apache.cocoon.components.treeprocessor.sitemap.VPCNodeBuilder">
+        <ignored-children>source</ignored-children>
+      </node>
+
+      <node name="serializers" builder="org.apache.cocoon.components.treeprocessor.sitemap.VPCsNodeBuilder"/>
+
+      <node name="serializer" builder="org.apache.cocoon.components.treeprocessor.sitemap.VPCNodeBuilder">
+        <ignored-children>source</ignored-children>
+      </node>
+
+      <node name="readers" builder="org.apache.cocoon.components.treeprocessor.sitemap.VPCsNodeBuilder"/>
+
+      <node name="reader" builder="org.apache.cocoon.components.treeprocessor.sitemap.VPCNodeBuilder">
+        <ignored-children>source</ignored-children>
+      </node>
+
+      <node name="views" builder="org.apache.cocoon.components.treeprocessor.CategoryNodeBuilder">
+        <allowed-children>view</allowed-children>
+      </node>
+
+      <node name="view" builder="org.apache.cocoon.components.treeprocessor.sitemap.ViewNodeBuilder"/>
+
+      <node name="action-sets" builder="org.apache.cocoon.components.treeprocessor.CategoryNodeBuilder">
+        <allowed-children>action-set</allowed-children>
+      </node>
+
+      <node name="action-set" builder="org.apache.cocoon.components.treeprocessor.sitemap.ActionSetNodeBuilder"/>
+
+      <node name="resources" builder="org.apache.cocoon.components.treeprocessor.CategoryNodeBuilder">
+        <allowed-children>resource</allowed-children>
+      </node>
+
+      <node name="resource" builder="org.apache.cocoon.components.treeprocessor.NamedContainerNodeBuilder"/>
+
+      <node name="flow" builder="org.apache.cocoon.components.treeprocessor.sitemap.FlowNodeBuilder">
+        <allowed-children>script</allowed-children>
+      </node>
+
+      <node name="script" builder="org.apache.cocoon.components.treeprocessor.sitemap.ScriptNodeBuilder"/>
+
+      <node name="pipelines" builder="org.apache.cocoon.components.treeprocessor.sitemap.PipelinesNodeBuilder">
+        <allowed-children>pipeline, handle-errors</allowed-children>
+        <ignored-children>component-configurations</ignored-children>
+      </node>
+
+      <node name="pipeline" builder="org.apache.cocoon.components.treeprocessor.sitemap.PipelineNodeBuilder">
+        <forbidden-children>sitemap, components, pipeline</forbidden-children>
+      </node>
+
+      <node name="match" builder="org.apache.cocoon.components.treeprocessor.sitemap.MatchNodeBuilder">
+        <forbidden-children>sitemap, components, pipeline, handle-errors</forbidden-children>
+      </node>
+
+      <node name="select" builder="org.apache.cocoon.components.treeprocessor.sitemap.SelectNodeBuilder">
+        <forbidden-children>sitemap, components, pipeline, handle-errors</forbidden-children>
+      </node>
+
+      <node name="act" builder="org.apache.cocoon.components.treeprocessor.sitemap.ActNodeBuilder">
+        <forbidden-children>sitemap, components, pipeline, handle-errors</forbidden-children>
+      </node>
+
+      <node name="redirect-to" builder="org.apache.cocoon.components.treeprocessor.sitemap.RedirectToNodeBuilder"/>
+
+      <node name="call" builder="org.apache.cocoon.components.treeprocessor.sitemap.CallNodeBuilder"/>
+
+      <node name="mount" builder="org.apache.cocoon.components.treeprocessor.sitemap.MountNodeBuilder"/>
+
+      <node name="read" builder="org.apache.cocoon.components.treeprocessor.sitemap.ReadNodeBuilder"/>
+
+      <node name="aggregate" builder="org.apache.cocoon.components.treeprocessor.sitemap.AggregateNodeBuilder"/>
+
+      <node name="generate" builder="org.apache.cocoon.components.treeprocessor.sitemap.GenerateNodeBuilder"/>
+
+      <node name="transform" builder="org.apache.cocoon.components.treeprocessor.sitemap.TransformNodeBuilder"/>
+
+      <node name="serialize" builder="org.apache.cocoon.components.treeprocessor.sitemap.SerializeNodeBuilder"/>
+
+      <node name="handle-errors" builder="org.apache.cocoon.components.treeprocessor.sitemap.HandleErrorsNodeBuilder"/>
+
+    </nodes>
+
+    <!--+
+        | You can add specific nodes for a specific sitemap version, using
+        | &lt;nodes-{version}&gt;
+        +-->
+
+</sitemap-language>

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/treeprocessor/sitemap-language.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/xpointer/parser/xpointer-fw.jj
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/xpointer/parser/xpointer-fw.jj?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/xpointer/parser/xpointer-fw.jj (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/components/xpointer/parser/xpointer-fw.jj Thu Nov  3 05:41:06 2005
@@ -0,0 +1,304 @@
+/*
+ * 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.
+ */
+/*
+   Parser for the XPointer Framework Syntax, see the specification at:
+   http://www.w3.org/TR/2003/REC-xptr-framework-20030325/
+
+   Some of the token definitions (for recognizing NCName's) were copied from
+   the JXPath parser from Jakarta Commons (to save some typing), written by
+   Ingo Macherius, Gerald Huck <{macherius, huck}@gmd.de> and Dmitri Plotnikov.
+*/
+
+options {
+  STATIC = false;
+}
+
+PARSER_BEGIN(XPointerFrameworkParser)
+
+  package org.apache.cocoon.components.xpointer.parser;
+
+  import org.apache.cocoon.components.xpointer.*;
+  import java.util.HashMap;
+
+  public class XPointerFrameworkParser {
+    private XPointer xpointer = new XPointer();
+    private HashMap namespaces = new HashMap();
+
+    public static void main(String [] args) throws Exception {
+      System.out.println("will parse this: " + args[0]);
+      XPointerFrameworkParser xfp = new XPointerFrameworkParser(new java.io.StringReader(args[0]));
+      xfp.pointer();
+    }
+
+    public static XPointer parse(String xpointer) throws ParseException {
+      XPointerFrameworkParser xfp = new XPointerFrameworkParser(new java.io.StringReader(xpointer));
+      xfp.pointer();
+      return xfp.getXPointer();
+    }
+
+    public XPointer getXPointer() {
+      return xpointer;
+    }
+
+    private String unescape(String data) throws ParseException {
+      StringBuffer result = new StringBuffer(data.length());
+      boolean inCircumflex = false;
+      for (int i = 0; i < data.length(); i++) {
+        char c = data.charAt(i);
+        if (inCircumflex) {
+          switch (c) {
+            case '^':
+            case '(':
+            case ')':
+              result.append(c);
+              inCircumflex = false;
+              break;
+            default:
+              throw new ParseException("Incorrect use of circumflex character at position " + i + " in the string " + data);
+          }
+        } else if (c == '^') {
+          inCircumflex = true;
+        } else {
+          result.append(c);
+        }
+      }
+      return result.toString();
+    }
+  }
+
+PARSER_END(XPointerFrameworkParser)
+
+TOKEN :
+{
+  <#Letter : <BaseChar> | <Ideographic> >
+| <#BaseChar :
+        (
+        ["\u0041"-"\u005A"] | ["\u0061"-"\u007A"] | ["\u00C0"-"\u00D6"] | ["\u00D8"-"\u00F6"] |
+        ["\u00F8"-"\u00FF"] | ["\u0100"-"\u0131"] | ["\u0134"-"\u013E"] | ["\u0141"-"\u0148"] |
+        ["\u014A"-"\u017E"] | ["\u0180"-"\u01C3"] | ["\u01CD"-"\u01F0"] | ["\u01F4"-"\u01F5"] |
+        ["\u01FA"-"\u0217"] | ["\u0250"-"\u02A8"] | ["\u02BB"-"\u02C1"] | "\u0386" | ["\u0388"-"\u038A"] |
+        "\u038C" | ["\u038E"-"\u03A1"] | ["\u03A3"-"\u03CE"] | ["\u03D0"-"\u03D6"] | "\u03DA" |
+        "\u03DC" |  "\u03DE" | "\u03E0" | ["\u03E2"-"\u03F3"] | ["\u0401"-"\u040C"] | ["\u040E"-"\u044F"] |
+        ["\u0451"-"\u045C"] | ["\u045E"-"\u0481"] | ["\u0490"-"\u04C4"] | ["\u04C7"-"\u04C8"] |
+        ["\u04CB"-"\u04CC"] | ["\u04D0"-"\u04EB"] | ["\u04EE"-"\u04F5"] | ["\u04F8"-"\u04F9"] |
+        ["\u0531"-"\u0556"] | "\u0559" | ["\u0561"-"\u0586"] | ["\u05D0"-"\u05EA"] | ["\u05F0"-"\u05F2"] |
+        ["\u0621"-"\u063A"] | ["\u0641"-"\u064A"] | ["\u0671"-"\u06B7"] | ["\u06BA"-"\u06BE"] |
+        ["\u06C0"-"\u06CE"] | ["\u06D0"-"\u06D3"] | "\u06D5" | ["\u06E5"-"\u06E6"] | ["\u0905"-"\u0939"] |
+        "\u093D" | ["\u0958"-"\u0961"] | ["\u0985"-"\u098C"] | ["\u098F"-"\u0990"] | ["\u0993"-"\u09A8"] |
+        ["\u09AA"-"\u09B0"] | "\u09B2" | ["\u09B6"-"\u09B9"] | ["\u09DC"-"\u09DD"] | ["\u09DF"-"\u09E1"] |
+        ["\u09F0"-"\u09F1"] | ["\u0A05"-"\u0A0A"] | ["\u0A0F"-"\u0A10"] | ["\u0A13"-"\u0A28"] |
+        ["\u0A2A"-"\u0A30"] | ["\u0A32"-"\u0A33"] | ["\u0A35"-"\u0A36"] | ["\u0A38"-"\u0A39"] |
+        ["\u0A59"-"\u0A5C"] | "\u0A5E" | ["\u0A72"-"\u0A74"] | ["\u0A85"-"\u0A8B"] | "\u0A8D" |
+        ["\u0A8F"-"\u0A91"] | ["\u0A93"-"\u0AA8"] | ["\u0AAA"-"\u0AB0"] | ["\u0AB2"-"\u0AB3"] |
+        ["\u0AB5"-"\u0AB9"] | "\u0ABD" | "\u0AE0" |  ["\u0B05"-"\u0B0C"] | ["\u0B0F"-"\u0B10"] |
+        ["\u0B13"-"\u0B28"] | ["\u0B2A"-"\u0B30"] | ["\u0B32"-"\u0B33"] | ["\u0B36"-"\u0B39"] |
+        "\u0B3D" | ["\u0B5C"-"\u0B5D"] | ["\u0B5F"-"\u0B61"] | ["\u0B85"-"\u0B8A"] |  ["\u0B8E"-"\u0B90"] |
+        ["\u0B92"-"\u0B95"] |  ["\u0B99"-"\u0B9A"] | "\u0B9C" | ["\u0B9E"-"\u0B9F"] | ["\u0BA3"-"\u0BA4"] |
+        ["\u0BA8"-"\u0BAA"] | ["\u0BAE"-"\u0BB5"] | ["\u0BB7"-"\u0BB9"] | ["\u0C05"-"\u0C0C"] |
+        ["\u0C0E"-"\u0C10"] | ["\u0C12"-"\u0C28"] | ["\u0C2A"-"\u0C33"] | ["\u0C35"-"\u0C39"] |
+        ["\u0C60"-"\u0C61"] | ["\u0C85"-"\u0C8C"] | ["\u0C8E"-"\u0C90"] | ["\u0C92"-"\u0CA8"] |
+        ["\u0CAA"-"\u0CB3"] | ["\u0CB5"-"\u0CB9"] | "\u0CDE" | ["\u0CE0"-"\u0CE1"] | ["\u0D05"-"\u0D0C"] |
+        ["\u0D0E"-"\u0D10"] | ["\u0D12"-"\u0D28"] | ["\u0D2A"-"\u0D39"] | ["\u0D60"-"\u0D61"] |
+        ["\u0E01"-"\u0E2E"] | "\u0E30" | ["\u0E32"-"\u0E33"] | ["\u0E40"-"\u0E45"] | ["\u0E81"-"\u0E82"] |
+        "\u0E84" | ["\u0E87"-"\u0E88"] | "\u0E8A" | "\u0E8D" | ["\u0E94"-"\u0E97"] | ["\u0E99"-"\u0E9F"] |
+        ["\u0EA1"-"\u0EA3"] | "\u0EA5" | "\u0EA7" | ["\u0EAA"-"\u0EAB"] | ["\u0EAD"-"\u0EAE"] | "\u0EB0" |
+        ["\u0EB2"-"\u0EB3"] | "\u0EBD" | ["\u0EC0"-"\u0EC4"] | ["\u0F40"-"\u0F47"] | ["\u0F49"-"\u0F69"] |
+        ["\u10A0"-"\u10C5"] | ["\u10D0"-"\u10F6"] | "\u1100" | ["\u1102"-"\u1103"] | ["\u1105"-"\u1107"] |
+        "\u1109" | ["\u110B"-"\u110C"] | ["\u110E"-"\u1112"] | "\u113C" | "\u113E" | "\u1140" | "\u114C" |
+        "\u114E" | "\u1150" | ["\u1154"-"\u1155"] | "\u1159" | ["\u115F"-"\u1161"] | "\u1163" | "\u1165" |
+        "\u1167" | "\u1169" | ["\u116D"-"\u116E"] | ["\u1172"-"\u1173"] | "\u1175" | "\u119E" | "\u11A8" |
+        "\u11AB" | ["\u11AE"-"\u11AF"] | ["\u11B7"-"\u11B8"] | "\u11BA" |  ["\u11BC"-"\u11C2"] | "\u11EB" |
+        "\u11F0" | "\u11F9" | ["\u1E00"-"\u1E9B"] | ["\u1EA0"-"\u1EF9"] | ["\u1F00"-"\u1F15"] |
+        ["\u1F18"-"\u1F1D"] |
+        ["\u1F20"-"\u1F45"] | ["\u1F48"-"\u1F4D"] | ["\u1F50"-"\u1F57"] | "\u1F59" | "\u1F5B" | "\u1F5D" |
+        ["\u1F5F"-"\u1F7D"] | ["\u1F80"-"\u1FB4"] | ["\u1FB6"-"\u1FBC"] | "\u1FBE" |  ["\u1FC2"-"\u1FC4"] |
+        ["\u1FC6"-"\u1FCC"] | ["\u1FD0"-"\u1FD3"] | ["\u1FD6"-"\u1FDB"] | ["\u1FE0"-"\u1FEC"] |
+        ["\u1FF2"-"\u1FF4"] | ["\u1FF6"-"\u1FFC"] | "\u2126" | ["\u212A"-"\u212B"] | "\u212E" |
+        ["\u2180"-"\u2182"] | ["\u3041"-"\u3094"] | ["\u30A1"-"\u30FA"] | ["\u3105"-"\u312C"] |
+        ["\uAC00"-"\uD7A3"]
+        ) >
+| <#Ideographic : (["\u4E00"-"\u9FA5"] | "\u3007" | ["\u3021"-"\u3029"]) >
+| <#CombiningChar :
+        (
+        ["\u0300"-"\u0345"]    |    ["\u0360"-"\u0361"]     |    ["\u0483"-"\u0486"]    |    ["\u0591"-"\u05A1"] |
+        ["\u05A3"-"\u05B9"]    |    ["\u05BB"-"\u05BD"]        |    "\u05BF"             |    ["\u05C1"-"\u05C2"] |
+        "\u05C4"             | ["\u064B"-"\u0652"] | "\u0670"             | ["\u06D6"-"\u06DC"] |
+        ["\u06DD"-"\u06DF"] | ["\u06E0"-"\u06E4"] | ["\u06E7"-"\u06E8"] | ["\u06EA"-"\u06ED"] |
+        ["\u0901"-"\u0903"] | "\u093C"    |["\u093E"-"\u094C"] | "\u094D" | ["\u0951"-"\u0954"] |
+        ["\u0962"-"\u0963"] | ["\u0981"-"\u0983"] | "\u09BC" | "\u09BE" | "\u09BF" | ["\u09C0"-"\u09C4"] |
+        ["\u09C7"-"\u09C8"] | ["\u09CB"-"\u09CD"] | "\u09D7" | ["\u09E2"-"\u09E3"] | "\u0A02" | "\u0A3C" |
+        "\u0A3E" | "\u0A3F" | ["\u0A40"-"\u0A42"] |
+        ["\u0A47"-"\u0A48"] | ["\u0A4B"-"\u0A4D"] | ["\u0A70"-"\u0A71"] | ["\u0A81"-"\u0A83"] | "\u0ABC" |
+        ["\u0ABE"-"\u0AC5"] | ["\u0AC7"-"\u0AC9"] | ["\u0ACB"-"\u0ACD"] | ["\u0B01"-"\u0B03"] | "\u0B3C" |
+        ["\u0B3E"-"\u0B43"] | ["\u0B47"-"\u0B48"] | ["\u0B4B"-"\u0B4D"] | ["\u0B56"-"\u0B57"] |
+        ["\u0B82"-"\u0B83"] | ["\u0BBE"-"\u0BC2"] | ["\u0BC6"-"\u0BC8"] | ["\u0BCA"-"\u0BCD"] | "\u0BD7" |
+        ["\u0C01"-"\u0C03"] | ["\u0C3E"-"\u0C44"] | ["\u0C46"-"\u0C48"] | ["\u0C4A"-"\u0C4D"] |
+        ["\u0C55"-"\u0C56"] | ["\u0C82"-"\u0C83"] | ["\u0CBE"-"\u0CC4"] | ["\u0CC6"-"\u0CC8"] |
+        ["\u0CCA"-"\u0CCD"] | ["\u0CD5"-"\u0CD6"] | ["\u0D02"-"\u0D03"] | ["\u0D3E"-"\u0D43"] |
+        ["\u0D46"-"\u0D48"] | ["\u0D4A"-"\u0D4D"] | "\u0D57" | "\u0E31" | ["\u0E34"-"\u0E3A"] |
+        ["\u0E47"-"\u0E4E"] | "\u0EB1" | ["\u0EB4"-"\u0EB9"] | ["\u0EBB"-"\u0EBC"] | ["\u0EC8"-"\u0ECD"] |
+        ["\u0F18"-"\u0F19"] | "\u0F35" | "\u0F37" | "\u0F39" | "\u0F3E" | "\u0F3F" | ["\u0F71"-"\u0F84"] |
+        ["\u0F86"-"\u0F8B"] | ["\u0F90"-"\u0F95"] | "\u0F97" | ["\u0F99"-"\u0FAD"] | ["\u0FB1"-"\u0FB7"] |
+        "\u0FB9" | ["\u20D0"-"\u20DC"] | "\u20E1" | ["\u302A"-"\u302F"] | "\u3099" | "\u309A"
+        )
+    >
+| <#UnicodeDigit :
+        ["\u0030"-"\u0039"] | ["\u0660"-"\u0669"] | ["\u06F0"-"\u06F9"] | ["\u0966"-"\u096F"] |
+        ["\u09E6"-"\u09EF"] | ["\u0A66"-"\u0A6F"] | ["\u0AE6"-"\u0AEF"] | ["\u0B66"-"\u0B6F"] |
+        ["\u0BE7"-"\u0BEF"] | ["\u0C66"-"\u0C6F"] | ["\u0CE6"-"\u0CEF"] | ["\u0D66"-"\u0D6F"] |
+        ["\u0E50"-"\u0E59"] | ["\u0ED0"-"\u0ED9"] | ["\u0F20"-"\u0F29"]
+    >
+| <#Extender :
+        "\u00B7" | "\u02D0" | "\u02D1" | "\u0387" | "\u0640" | "\u0E46" | "\u0EC6" |
+        "\u3005" | ["\u3031"-"\u3035"] | ["\u309D"-"\u309E"] | ["\u30FC"-"\u30FE"]
+    >
+| <NCName : (<Letter> | ["_"]) (<Letter> | <UnicodeDigit> | [".","-","_"] | <CombiningChar> | <Extender>)* >
+| <WS: ["\t", "\r", "\n", " "] >
+| <QName : (<NCName> ":")? <NCName> >
+}
+
+<DEFAULT, IN_SCHEME>
+TOKEN :
+{
+  <LBRACE: "(" >
+| <RBRACE: ")" >
+}
+
+<IN_SCHEME>
+TOKEN :
+{
+  <CIRC_LBRACE: "^(" >
+| <CIRC_RBRACE: "^)" >
+| <DOUBLE_CIRC: "^^" >
+| <NormalChar: ~["(", ")", "^"] >
+}
+
+void pointer():
+{
+}
+{
+  LOOKAHEAD(2) schemeBased() | shortHand()
+}
+
+void shortHand():
+{
+  Token x;
+}
+{
+  x = <NCName>
+  {
+    xpointer.addPart(new ShorthandPart(x.image));
+  }
+}
+
+void schemeBased():
+{
+}
+{
+  pointerPart() ( (<WS>)* pointerPart() )*
+}
+
+void pointerPart():
+{
+  Token x;
+  String schemeName;
+  String schemeData;
+}
+{
+  (x = <NCName> | x = <QName>)
+    <LBRACE>
+    {
+      // when going inside the scheme data, swith to a different lexical state
+      token_source.SwitchTo(IN_SCHEME);
+
+      // store the scheme name
+      schemeName = x.image;
+    }
+  schemeData = schemeData()
+    <RBRACE>
+    {
+      // when going outside the scheme data, swith back to the default lexical state
+      token_source.SwitchTo(DEFAULT);
+
+      // parse schemeName in prefix and localName
+      String schemeNamespace = null, schemeLocalName = null;
+      int colonPos = schemeName.indexOf(':');
+      if (colonPos != -1) {
+         String schemePrefix = schemeName.substring(0, colonPos);
+         schemeNamespace = (String)namespaces.get(schemePrefix);
+         schemeLocalName = schemeName.substring(colonPos + 1);
+       } else {
+         schemeLocalName = schemeName;
+       }
+
+
+      // add the pointer part
+      if (schemeNamespace == null && schemeLocalName.equals("xmlns")) {
+        int eqPos = schemeData.indexOf("=");
+        if (eqPos == -1)
+          throw new ParseException("xmlns scheme data should contain an equals sign");
+
+        // Note: the trimming below is not entirely correct, since space is only allowed left
+        // and right of the equal sign, but not at the beginning and end of the schemeData
+        String prefix = schemeData.substring(0, eqPos).trim();
+        String namespace = schemeData.substring(eqPos + 1, schemeData.length()).trim();
+        xpointer.addPart(new XmlnsPart(prefix, namespace));
+        namespaces.put(prefix, namespace);
+      } else if (schemeNamespace == null && schemeLocalName.equals("xpointer")) {
+        xpointer.addPart(new XPointerPart(schemeData));
+      } else if ("http://apache.org/cocoon/xpointer".equals(schemeNamespace) && schemeLocalName.equals("elementpath")) {
+        xpointer.addPart(new ElementPathPart(schemeData));
+      } else {
+        xpointer.addPart(new UnsupportedPart(schemeName));
+      }
+    }
+}
+
+String schemeData():
+{
+  String temp;
+  StringBuffer schemeData = new StringBuffer();
+}
+{
+  (
+   ( temp = escapedData() { schemeData.append(temp); } )*
+  )
+  {
+    return unescape(schemeData.toString());
+  }
+}
+
+String escapedData():
+{
+  Token x;
+  String temp;
+  StringBuffer data = new StringBuffer();
+}
+{
+  // The reason for not making a token out of this all is that tokens cannot contain recursive definitions
+  (
+   x = <NormalChar> { data.append(x.image); }
+   | x = <CIRC_LBRACE> { data.append(x.image); }
+   | x = <CIRC_RBRACE> { data.append(x.image); }
+   | x = <DOUBLE_CIRC> { data.append(x.image); }
+   | x = <LBRACE> { data.append(x.image); }
+     temp = schemeData() { data.append(temp); }
+     x = <RBRACE> { data.append(x.image); }
+  )
+  {
+    return data.toString();
+  }
+}

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/transformation/pagination/Paginator.xconf
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/transformation/pagination/Paginator.xconf?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/transformation/pagination/Paginator.xconf (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/transformation/pagination/Paginator.xconf Thu Nov  3 05:41:06 2005
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<!--
+  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.
+-->
+
+<xconf xpath="/cocoon" unless="component[@role='org.apache.cocoon.transformation.pagination.Paginator']">
+
+    <!-- ======================= Paginator =========================== -->
+  <component 
+     class="org.apache.cocoon.transformation.pagination.Paginator" 
+     role="org.apache.cocoon.transformation.pagination.Paginator"
+     logger="core.paginator"/>
+     
+</xconf>

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/main/resources/org/apache/cocoon/transformation/pagination/Paginator.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/CocoonTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/CocoonTestCase.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/CocoonTestCase.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/CocoonTestCase.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,84 @@
+/*
+ * 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.
+ */
+
+package org.apache.cocoon;
+
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.DefaultConfiguration;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.cocoon.core.container.CoreServiceManager;
+import org.apache.cocoon.core.container.StandaloneServiceSelector;
+import org.apache.cocoon.core.container.ContainerTestCase;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.source.impl.ResourceSourceFactory;
+import org.apache.excalibur.source.impl.SourceResolverImpl;
+import org.apache.excalibur.source.impl.URLSourceFactory;
+
+/**
+ * Testcase for Cocoon. 
+ *
+ * @version CVS $Id: SitemapComponentTestCase.java 55427 2004-10-24 11:38:37Z cziegeler $
+ */
+public abstract class CocoonTestCase extends ContainerTestCase {
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.core.container.ContainerTestCase#addComponents(org.apache.cocoon.core.container.CocoonServiceManager)
+     */
+    protected void addComponents(CoreServiceManager manager) 
+    throws ServiceException, ConfigurationException {
+        super.addComponents(manager);
+        if ( this.addSourceFactories() ) {
+            // Create configuration for source-factories
+            final DefaultConfiguration df = new DefaultConfiguration("source-factories");
+            DefaultConfiguration factory = new DefaultConfiguration("component-instance");
+            factory.setAttribute("class", ResourceSourceFactory.class.getName());
+            factory.setAttribute("name", "resource");
+            df.addChild(factory);
+            factory = new DefaultConfiguration("component-instance");
+            factory.setAttribute("class", URLSourceFactory.class.getName());
+            factory.setAttribute("name", "*");
+            df.addChild(factory);
+            manager.addComponent("org.apache.excalibur.source.SourceFactorySelector", 
+                                 StandaloneServiceSelector.class.getName(), 
+                                 df,
+                                 null);
+        }
+        if ( this.addSourceResolver() ) {
+            manager.addComponent(SourceResolver.ROLE, 
+                    SourceResolverImpl.class.getName(), 
+                    new DefaultConfiguration("", "-"),
+                    null);
+        }
+    }
+    
+    /**
+     * 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 true;
+    }
+    
+    /**
+     * This method should return true if the source resolver should
+     * be added automatically. Can be overwritten by subclasses. The
+     * default is true.
+     */
+    protected boolean addSourceResolver() {
+        return true;
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/CocoonTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/MockLogger.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/MockLogger.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/MockLogger.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/MockLogger.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,152 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon;
+
+import org.apache.avalon.framework.logger.Logger;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+
+/**
+ * Mock logger for test cases. Delegates to a Commons Logging logger.
+ * 
+ * @version CVS $Id$
+ */
+public class MockLogger implements Logger {
+    protected Log logger;
+    
+    /**
+     * Create a new logger for a given class.
+     * 
+     * @param clazz The class.
+     */
+    public MockLogger(Class clazz) {
+        this.logger = LogFactory.getLog(clazz);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#debug(java.lang.String)
+     */
+    public void debug(String msg) {
+        this.logger.debug(msg);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#debug(java.lang.String, java.lang.Throwable)
+     */
+    public void debug(String msg, Throwable t) {
+        this.logger.debug(msg, t);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#isDebugEnabled()
+     */
+    public boolean isDebugEnabled() {
+        return this.logger.isDebugEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#info(java.lang.String)
+     */
+    public void info(String msg) {
+        this.logger.info(msg);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#info(java.lang.String, java.lang.Throwable)
+     */
+    public void info(String msg, Throwable t) {
+        this.logger.info(msg, t);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#isInfoEnabled()
+     */
+    public boolean isInfoEnabled() {
+        return this.logger.isInfoEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#warn(java.lang.String)
+     */
+    public void warn(String msg) {
+        this.logger.warn(msg);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#warn(java.lang.String, java.lang.Throwable)
+     */
+    public void warn(String msg, Throwable t) {
+        this.logger.warn(msg, t);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#isWarnEnabled()
+     */
+    public boolean isWarnEnabled() {
+        return this.logger.isWarnEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#error(java.lang.String)
+     */
+    public void error(String msg) {
+        this.logger.error(msg);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#error(java.lang.String, java.lang.Throwable)
+     */
+    public void error(String msg, Throwable t) {
+        this.logger.error(msg, t);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#isErrorEnabled()
+     */
+    public boolean isErrorEnabled() {
+        return this.logger.isErrorEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#fatalError(java.lang.String)
+     */
+    public void fatalError(String msg) {
+        this.logger.fatal(msg);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#fatalError(java.lang.String, java.lang.Throwable)
+     */
+    public void fatalError(String msg, Throwable t) {
+        this.logger.fatal(msg, t);
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#isFatalErrorEnabled()
+     */
+    public boolean isFatalErrorEnabled() {
+        return this.logger.isFatalEnabled();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.avalon.framework.logger.Logger#getChildLogger(java.lang.String)
+     */
+    public Logger getChildLogger(String arg0) {
+        return null;
+    }
+
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/MockLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/MockProcessor.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/MockProcessor.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/MockProcessor.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/MockProcessor.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,92 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon;
+
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.cocoon.environment.Environment;
+import org.apache.cocoon.environment.SourceResolver;
+
+/**
+ * Mock processor
+ * 
+ * @version CVS $Id$
+ */
+public class MockProcessor implements Processor {
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#buildPipeline(org.apache.cocoon.environment.Environment)
+     */
+    public InternalPipelineDescription buildPipeline(Environment environment)
+    throws Exception {
+        return null;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getComponentConfigurations()
+     */
+    public Configuration[] getComponentConfigurations() {
+        return null;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getContext()
+     */
+    public String getContext() {
+        return null;
+    }
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getRootProcessor()
+     */
+    public Processor getRootProcessor() {
+        return this;
+    }
+    
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#getSourceResolver()
+     */
+    public SourceResolver getSourceResolver() {
+        return null;
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.Processor#process(org.apache.cocoon.environment.Environment)
+     */
+    public boolean process(Environment environment) throws Exception {
+        return false;
+    }
+
+    /**
+     * @see org.apache.cocoon.Processor#getAttribute(java.lang.String)
+     */
+    public Object getAttribute(String name) {
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.Processor#removeAttribute(java.lang.String)
+     */
+    public Object removeAttribute(String name) {
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.Processor#setAttribute(java.lang.String, java.lang.Object)
+     */
+    public void setAttribute(String name, Object value) {
+        // nothing to do
+    }
+
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/MockProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/SitemapComponentTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/SitemapComponentTestCase.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/SitemapComponentTestCase.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/SitemapComponentTestCase.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,812 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.configuration.DefaultConfiguration;
+import org.apache.avalon.framework.context.DefaultContext;
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.cocoon.acting.Action;
+import org.apache.cocoon.components.ContextHelper;
+import org.apache.cocoon.components.flow.AbstractInterpreter;
+import org.apache.cocoon.components.flow.FlowHelper;
+import org.apache.cocoon.components.flow.Interpreter;
+import org.apache.cocoon.components.source.SourceResolverAdapter;
+import org.apache.cocoon.core.container.CoreServiceManager;
+import org.apache.cocoon.core.container.StandaloneServiceSelector;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.internal.EnvironmentHelper;
+import org.apache.cocoon.environment.mock.MockContext;
+import org.apache.cocoon.environment.mock.MockEnvironment;
+import org.apache.cocoon.environment.mock.MockRedirector;
+import org.apache.cocoon.environment.mock.MockRequest;
+import org.apache.cocoon.environment.mock.MockResponse;
+import org.apache.cocoon.generation.Generator;
+import org.apache.cocoon.matching.Matcher;
+import org.apache.cocoon.serialization.Serializer;
+import org.apache.cocoon.sitemap.PatternException;
+import org.apache.cocoon.transformation.Transformer;
+import org.apache.cocoon.xml.WhitespaceFilter;
+import org.apache.cocoon.xml.dom.DOMBuilder;
+import org.apache.cocoon.xml.dom.DOMStreamer;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.xml.sax.SAXParser;
+import org.custommonkey.xmlunit.Diff;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Testcase for actions, generators, transformers and serializer components. 
+ *
+ * @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
+ * @author <a href="mailto:mark.leicester@energyintellect.com">Mark Leicester</a>
+ * @version CVS $Id: SitemapComponentTestCase.java 189596 2005-06-08 15:41:33Z bdelacretaz $
+ */
+public abstract class SitemapComponentTestCase extends CocoonTestCase {
+
+    public final static Parameters EMPTY_PARAMS = Parameters.EMPTY_PARAMETERS;
+
+    private MockRequest request = new MockRequest();
+    private MockResponse response = new MockResponse();
+    private MockContext context = new MockContext();
+    private MockRedirector redirector = new MockRedirector();
+    private Map objectmodel = new HashMap();
+
+    public final MockRequest getRequest() {
+        return request;
+    }
+
+    public final MockResponse getResponse() {
+        return response;
+    }
+
+    public final MockContext getContext() {
+        return context;
+    }
+
+    public final MockRedirector getRedirector() { 
+        return redirector;
+    }
+
+    public final Map getObjectModel() {
+        return objectmodel;
+    }
+    
+    protected void addContext(DefaultContext context) {
+        context.put(ContextHelper.CONTEXT_REQUEST_OBJECT, request);
+        context.put(ContextHelper.CONTEXT_RESPONSE_OBJECT, response);
+        context.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectmodel);
+        context.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, getContext());
+    }
+
+    /* (non-Javadoc)
+     * @see junit.framework.TestCase#setUp()
+     */
+    public void setUp() throws Exception {
+        super.setUp();
+        objectmodel.clear();
+
+        request.reset();
+        objectmodel.put(ObjectModelHelper.REQUEST_OBJECT, request);
+
+        response.reset();
+        objectmodel.put(ObjectModelHelper.RESPONSE_OBJECT, response);
+
+        context.reset();
+        objectmodel.put(ObjectModelHelper.CONTEXT_OBJECT, context);
+
+        redirector.reset();
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.cocoon.core.container.ContainerTestCase#addComponents(org.apache.cocoon.core.container.CocoonServiceManager)
+     */
+    protected void addComponents(CoreServiceManager manager) 
+    throws ServiceException, ConfigurationException {
+        super.addComponents(manager);
+        final String[] o = this.getSitemapComponentInfo();
+        if ( o != null ) {
+            final String typeClassName = o[0];
+            final String componentClassName = o[1];
+            final String key = o[2];
+            
+            // Create configuration for selector
+            final DefaultConfiguration df = new DefaultConfiguration("transformers");
+            final DefaultConfiguration factory = new DefaultConfiguration("component-instance");
+            factory.setAttribute("class", componentClassName);
+            factory.setAttribute("name", key);
+            df.addChild(factory);
+            manager.addComponent(typeClassName + "Selector", 
+                                 StandaloneServiceSelector.class.getName(), 
+                                 df,
+                                 null);
+        }
+    }
+
+    /**
+     * This triple can be used to add a sitemap component to the service manager
+     * @return A triple of strings: class name of the type, class name of the component, key
+     */
+    protected String[] getSitemapComponentInfo() {
+        return null;
+    }
+
+    /**
+     * Match with a pattern.
+     *
+     * @param type Hint of the matcher. 
+     * @param pattern Pattern for the matcher.
+     * @param parameters Matcher parameters.
+     */
+    public final Map match(String type, String pattern, Parameters parameters) throws PatternException {
+
+        ServiceSelector selector = null;
+        Matcher matcher = null;
+        SourceResolver resolver = null;
+
+        Map result = null;
+        try {
+            selector = (ServiceSelector) this.lookup(Matcher.ROLE +
+                "Selector");
+            assertNotNull("Test lookup of matcher selector", selector);
+
+            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+            assertNotNull("Test lookup of source resolver", resolver);
+
+            assertNotNull("Test if matcher name is not null", type);
+            matcher = (Matcher) selector.select(type);
+            assertNotNull("Test lookup of matcher", matcher);
+
+            result = matcher.match(pattern, objectmodel, parameters);
+
+        } catch (ServiceException ce) {
+            getLogger().error("Could not retrieve matcher", ce);
+            fail("Could not retrieve matcher: " + ce.toString());
+        } finally {
+            if (matcher != null) {
+                selector.release(matcher);
+            }
+            this.release(selector);
+            this.release(resolver);
+        }
+        return result;
+    }
+
+    /**
+     * Select with a pattern.
+     *
+     * @param type Hint of the matcher. 
+     * @param expression Expression for the selector.
+     * @param parameters Matcher parameters.
+     */
+    public final boolean select(String type, String expression, Parameters parameters) {
+
+        ServiceSelector selector = null;
+        org.apache.cocoon.selection.Selector sel = null;
+        SourceResolver resolver = null;
+
+        boolean result = false;
+        try {
+            selector = (ServiceSelector) this.lookup(org.apache.cocoon.selection.Selector.ROLE +
+                "Selector");
+            assertNotNull("Test lookup of selector selector", selector);
+
+            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+            assertNotNull("Test lookup of source resolver", resolver);
+
+            assertNotNull("Test if selector name is not null", type);
+            sel = (org.apache.cocoon.selection.Selector) selector.select(type);
+            assertNotNull("Test lookup of selector", sel);
+            
+
+            result = sel.select(expression, objectmodel, parameters);
+
+        } catch (ServiceException ce) {
+            getLogger().error("Could not retrieve selector", ce);
+            fail("Could not retrieve selector: " + ce.toString());
+        } finally {
+            if (sel != null) {
+                selector.release(sel);
+            }
+            this.release(selector);
+            this.release(resolver);
+        }
+        return result;
+    }
+
+    /**
+     * Perform the action component.
+     *
+     * @param type Hint of the action. 
+     * @param source Source for the action.
+     * @param parameters Action parameters.
+     */
+    public final Map act(String type, String source, Parameters parameters) throws Exception {
+        
+        redirector.reset();
+
+        ServiceSelector selector = null;
+        Action action = null;
+        SourceResolver resolver = null;
+
+        Map result = null;
+        try {
+            selector = (ServiceSelector) this.lookup(Action.ROLE +
+                "Selector");
+            assertNotNull("Test lookup of action selector", selector);
+
+            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+            assertNotNull("Test lookup of source resolver", resolver);
+
+            assertNotNull("Test if action name is not null", type);
+            action = (Action) selector.select(type);
+            assertNotNull("Test lookup of action", action);
+
+            result = action.act(redirector, new SourceResolverAdapter(resolver, this.getManager()),
+                                objectmodel, source, parameters);
+
+        } catch (ServiceException ce) {
+            getLogger().error("Could not retrieve action", ce);
+            fail("Could not retrieve action: " + ce.toString());
+        } finally {
+            if (action != null) {
+                selector.release(action);
+            }
+            this.release(selector);
+            this.release(resolver);
+        }
+        return result;
+    }
+
+    /**
+     * Generate the generator output.
+     *
+     * @param type Hint of the generator. 
+     * @param source Source for the generator.
+     * @param parameters Generator parameters.
+     */
+    public final Document generate(String type, String source, Parameters parameters) 
+        throws IOException, SAXException, ProcessingException {
+
+        ServiceSelector selector = null;
+        Generator generator = null;
+        SourceResolver resolver = null;
+        SAXParser parser = null;
+
+        Document document = null;
+        try {
+            selector = (ServiceSelector) this.lookup(Generator.ROLE +
+                "Selector");
+            assertNotNull("Test lookup of generator selector", selector);
+
+            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+            assertNotNull("Test lookup of source resolver", resolver);
+
+            parser = (SAXParser) this.lookup(SAXParser.ROLE);
+            assertNotNull("Test lookup of parser", parser);
+
+            assertNotNull("Test if generator name is not null", type);
+
+            generator = (Generator) selector.select(type);
+            assertNotNull("Test lookup of generator", generator);
+
+            generator.setup(new SourceResolverAdapter(resolver, getManager()),
+                            objectmodel, source, parameters);
+
+            DOMBuilder builder = new DOMBuilder();
+            generator.setConsumer(new WhitespaceFilter(builder));
+
+            generator.generate();
+
+            document = builder.getDocument();
+
+            assertNotNull("Test for generator document", document);
+
+        } catch (ServiceException ce) {
+            getLogger().error("Could not retrieve generator", ce);
+            fail("Could not retrieve generator: " + ce.toString());
+        } finally {
+            if (generator != null) {
+                selector.release(generator);
+            }
+            this.release(selector);
+            this.release(resolver);
+            this.release(parser);
+        }
+
+        return document;
+    }
+
+    /**     
+     * Trannsform a document by a transformer
+     *      
+     * @param type Hint of the transformer. 
+     * @param source Source for the transformer.
+     * @param parameters Generator parameters.
+     * @param input Input document.
+     */ 
+    public final Document transform(String type, String source, Parameters parameters, Document input) 
+    throws Exception {
+        // enter & leave environment, as a manager is looked up using
+        // the processing context stack
+        MockEnvironment env = new MockEnvironment();
+        Processor processor = new MockProcessor();
+        
+        EnvironmentHelper.enterProcessor(processor, this.getManager(), env);
+
+        try {
+            ServiceSelector selector = null;
+            Transformer transformer = null;
+            SourceResolver resolver = null;
+            SAXParser parser = null;
+            Source inputsource = null;
+    
+            assertNotNull("Test for component manager", this.getManager());
+    
+            Document document = null;
+            try {
+                selector = (ServiceSelector) this.lookup(Transformer.ROLE+
+                    "Selector");
+                assertNotNull("Test lookup of transformer selector", selector);
+    
+                resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+                assertNotNull("Test lookup of source resolver", resolver);
+    
+                parser = (SAXParser) this.lookup(SAXParser.ROLE);
+                assertNotNull("Test lookup of parser", parser);
+    
+    
+                assertNotNull("Test if transformer name is not null", type);
+                transformer = (Transformer) selector.select(type);
+                assertNotNull("Test lookup of transformer", transformer);
+    
+                transformer.setup(new SourceResolverAdapter(resolver, getManager()),
+                                      objectmodel, source, parameters);
+    
+                DOMBuilder builder = new DOMBuilder();
+                transformer.setConsumer(new WhitespaceFilter(builder));
+    
+                assertNotNull("Test if input document is not null", input);
+                DOMStreamer streamer = new DOMStreamer(transformer);
+                streamer.stream(input);
+    
+                document = builder.getDocument();
+                assertNotNull("Test for transformer document", document);
+    
+            } catch (ServiceException ce) {
+                getLogger().error("Could not retrieve transformer", ce);
+                ce.printStackTrace();
+                fail("Could not retrieve transformer:"+ce.toString());
+            } finally {
+                if (transformer!=null) {
+                    selector.release(transformer);
+                }
+    
+                if (selector!=null) {
+                    this.release(selector);
+                }
+    
+                if (inputsource!=null) {
+                    resolver.release(inputsource);
+                }
+    
+                if (resolver!=null) {
+                    this.release(resolver);
+                }
+    
+                if (parser!=null) {
+                    this.release(parser);
+                }
+            }
+    
+            return document;
+        } finally {
+            EnvironmentHelper.leaveProcessor();           
+        }
+    }
+
+    /**
+     * Serialize a document by a serializer
+     *
+     * @param type Hint of the serializer.
+     * @param parameters Serializer parameters.
+     * @param input Input document.
+     *
+     * @return Serialized data.
+     */
+    public final byte[] serialize(String type, Parameters parameters,
+                                  Document input) throws SAXException, IOException{
+
+        ServiceSelector selector = null;
+        Serializer serializer = null;
+        SourceResolver resolver = null;
+        Source inputsource = null;
+
+        assertNotNull("Test for component manager", this.getManager());
+
+        ByteArrayOutputStream document = null;
+
+        try {
+            selector = (ServiceSelector) this.lookup(Serializer.ROLE+
+                "Selector");
+            assertNotNull("Test lookup of serializer selector", selector);
+
+            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+            assertNotNull("Test lookup of source resolver", resolver);
+
+            assertNotNull("Test if serializer name is not null", type);
+            serializer = (Serializer) selector.select(type);
+            assertNotNull("Test lookup of serializer", serializer);
+
+            document = new ByteArrayOutputStream();
+            serializer.setOutputStream(document);
+
+            assertNotNull("Test if input document is not null", input);
+            DOMStreamer streamer = new DOMStreamer(serializer);
+
+            streamer.stream(input);
+        } catch (ServiceException ce) {
+            getLogger().error("Could not retrieve serializer", ce);
+            fail("Could not retrieve serializer:"+ce.toString());
+        } finally {
+            if (serializer!=null) {
+                selector.release(serializer);
+            }
+
+            if (selector!=null) {
+                this.release(selector);
+            }
+
+            if (inputsource!=null) {
+                resolver.release(inputsource);
+            }
+
+            if (resolver!=null) {
+                this.release(resolver);
+            }
+        }
+
+        return document.toByteArray();
+    }
+    
+    public String callFunction(String type, String source, String function, Map params) throws Exception {
+        
+        redirector.reset();
+        
+        ServiceSelector selector = null;
+        Interpreter interpreter = null;
+        SourceResolver resolver = null;
+
+        try {
+            selector = (ServiceSelector) this.lookup(Interpreter.ROLE + "Selector");
+            assertNotNull("Test lookup of interpreter selector", selector);
+
+            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+            assertNotNull("Test lookup of source resolver", resolver);
+
+            assertNotNull("Test if interpreter name is not null", type);
+            interpreter = (Interpreter) selector.select(type);
+            assertNotNull("Test lookup of interpreter", interpreter);
+            
+            ((AbstractInterpreter)interpreter).register(source);
+            
+            ArrayList parameters = new ArrayList();
+            for (Iterator i = params.keySet().iterator(); i.hasNext();) {
+                String name = (String)i.next();
+                String value = (String)params.get(name);
+                parameters.add(new Interpreter.Argument(name, value));
+            }
+            
+            interpreter.callFunction(function, parameters, getRedirector());
+            
+        } catch (ServiceException ce) {
+            getLogger().error("Could not retrieve interpeter", ce);
+            fail("Could not retrieve interpreter: " + ce.toString());
+        } finally {
+            if (interpreter != null) {
+                selector.release(interpreter);
+            }
+            this.release(selector);
+            this.release(resolver);
+        }
+        return FlowHelper.getWebContinuation(getObjectModel()).getId();
+    }
+    
+    public String callContinuation(String type, String source, String id, Map params) throws Exception {
+        
+        redirector.reset();
+        
+        ServiceSelector selector = null;
+        Interpreter interpreter = null;
+        SourceResolver resolver = null;
+
+        try {
+            selector = (ServiceSelector) this.lookup(Interpreter.ROLE + "Selector");
+            assertNotNull("Test lookup of interpreter selector", selector);
+
+            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+            assertNotNull("Test lookup of source resolver", resolver);
+
+            assertNotNull("Test if interpreter name is not null", type);
+            interpreter = (Interpreter) selector.select(type);
+            assertNotNull("Test lookup of interpreter", interpreter);
+
+            ((AbstractInterpreter)interpreter).register(source);
+            
+            ArrayList parameters = new ArrayList();
+            for (Iterator i = params.keySet().iterator(); i.hasNext();) {
+                String name = (String)i.next();
+                String value = (String)params.get(name);
+                parameters.add(new Interpreter.Argument(name, value));
+            }
+            
+            interpreter.handleContinuation(id, parameters, getRedirector());
+
+        } catch (ServiceException ce) {
+            getLogger().error("Could not retrieve interpreter", ce);
+            fail("Could not retrieve interpreter: " + ce.toString());
+        } finally {
+            if (interpreter != null) {
+                selector.release(interpreter);
+            }
+            this.release(selector);
+            this.release(resolver);
+        }
+        return FlowHelper.getWebContinuation(getObjectModel()).getId();
+    }
+    
+    public Object getFlowContextObject() {
+        return FlowHelper.getContextObject(getObjectModel());
+    }
+
+    public final void print(Document document) {
+        TransformerFactory factory = TransformerFactory.newInstance();
+        try
+        {
+          javax.xml.transform.Transformer serializer = factory.newTransformer();
+          serializer.transform(new DOMSource(document), new StreamResult(System.out));
+          System.out.println();
+        } 
+        catch (TransformerException te)
+        {
+          te.printStackTrace();
+        }
+    }
+
+    public final Document load(String source) {
+
+        SourceResolver resolver = null;
+        SAXParser parser = null;
+        Source assertionsource = null;
+
+        assertNotNull("Test for component manager", this.getManager());
+
+        Document assertiondocument = null;
+        try {
+            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+            assertNotNull("Test lookup of source resolver", resolver);
+
+            parser = (SAXParser) this.lookup(SAXParser.ROLE);
+            assertNotNull("Test lookup of parser", parser);
+
+            assertNotNull("Test if assertion document is not null",
+                          source);
+            assertionsource = resolver.resolveURI(source);
+            assertNotNull("Test lookup of assertion source",
+                          assertionsource);
+            assertTrue("Source '" + assertionsource.getURI() + "' must exist", assertionsource.exists());
+
+            DOMBuilder builder = new DOMBuilder();
+            assertNotNull("Test if inputstream of the assertion source is not null",
+                          assertionsource.getInputStream());
+
+            parser.parse(new InputSource(assertionsource.getInputStream()),
+                         new WhitespaceFilter(builder),
+                         builder);
+
+            assertiondocument = builder.getDocument();
+            assertNotNull("Test if assertion document exists", assertiondocument);
+
+        } catch (ServiceException ce) {
+            getLogger().error("Could not retrieve generator", ce);
+            fail("Could not retrieve generator: " + ce.toString());
+        } catch (Exception e) {
+            getLogger().error("Could not execute test", e);
+            fail("Could not execute test: " + e);
+        } finally {
+            if (resolver != null) {
+                resolver.release(assertionsource);
+            }
+            this.release(resolver);
+            this.release(parser);
+        }
+
+        return assertiondocument;
+    }
+
+    /**
+     * Load a binary document.
+     *
+     * @param source Source location.
+     *
+     * @return Binary data.
+     */
+    public final byte[] loadByteArray(String source) {
+
+        SourceResolver resolver = null;
+        SAXParser parser = null;
+        Source assertionsource = null;
+
+        assertNotNull("Test for component manager", this.getManager());
+
+        byte[] assertiondocument = null;
+
+        try {
+            resolver = (SourceResolver) this.lookup(SourceResolver.ROLE);
+            assertNotNull("Test lookup of source resolver", resolver);
+
+            parser = (SAXParser) this.lookup(SAXParser.ROLE);
+            assertNotNull("Test lookup of parser", parser);
+
+            assertNotNull("Test if assertion document is not null", source);
+            assertionsource = resolver.resolveURI(source);
+            assertNotNull("Test lookup of assertion source", assertionsource);
+            assertTrue("Test if source exist", assertionsource.exists());
+
+            assertNotNull("Test if inputstream of the assertion source is not null",
+                          assertionsource.getInputStream());
+
+            InputStream input = assertionsource.getInputStream();
+            long size = assertionsource.getContentLength();
+
+            assertiondocument = new byte[(int) size];
+            int i = 0;
+            int c;
+
+            while ((c = input.read())!=-1) {
+                assertiondocument[i] = (byte) c;
+                i++;
+            }
+
+        } catch (ServiceException ce) {
+            getLogger().error("Could not retrieve generator", ce);
+            fail("Could not retrieve generator: "+ce.toString());
+        } catch (Exception e) {
+            getLogger().error("Could not execute test", e);
+            fail("Could not execute test: "+e);
+        } finally {
+            if (resolver!=null) {
+                resolver.release(assertionsource);
+            }
+            this.release(resolver);
+            this.release(parser);
+        }
+
+        return assertiondocument;
+    }
+
+    /**
+     * Compare two XML documents provided as strings
+     * @param control Control document
+     * @param test Document to test
+     * @return Diff object describing differences in documents
+     */
+    public final Diff compareXML(Document control, Document test) {
+        return new Diff(control, test);
+    }
+
+    /**
+     * Assert that the result of an XML comparison is similar.
+     *
+     * @param msg The assertion message
+     * @param expected The expected XML document
+     * @param actual The actual XML Document
+     */
+    public final void assertEqual(String msg, Document expected, Document actual) {
+
+        expected.getDocumentElement().normalize();
+        actual.getDocumentElement().normalize();
+
+        Diff diff = compareXML(expected, actual);
+
+        assertEquals(msg + ", " + diff.toString(), true, diff.similar());
+    }
+
+    /**
+     * Assert that the result of an XML comparison is similar.
+     *
+     * @param expected The expected XML document
+     * @param actual The actual XML Document
+     */  
+    public final void assertEqual(Document expected, Document actual) {
+
+        expected.getDocumentElement().normalize();
+        actual.getDocumentElement().normalize();
+
+        Diff diff = compareXML(expected, actual);
+
+        assertEquals("Test if the assertion document is equal, " + diff.toString(), true, diff.similar());
+    }
+
+    /**
+     * Assert that the result of an XML comparison is identical.
+     *
+     * @param msg The assertion message
+     * @param expected The expected XML document
+     * @param actual The actual XML Document
+     */
+    public final void assertIdentical(String msg, Document expected, Document actual) {
+
+        expected.getDocumentElement().normalize();
+        actual.getDocumentElement().normalize();
+
+        Diff diff = compareXML(expected, actual);
+
+        assertEquals(msg + ", " + diff.toString(), true, diff.identical());
+    }
+
+    /**
+     * Assert that the result of an XML comparison is identical.
+     *
+     * @param expected The expected XML document
+     * @param actual The actual XML Document
+     */
+    public final void assertIdentical(Document expected, Document actual) {
+
+        expected.getDocumentElement().normalize();
+        actual.getDocumentElement().normalize();
+
+        Diff diff = compareXML(expected, actual);
+
+        assertEquals("Test if the assertion document is equal, " + diff.toString(), true, diff.identical());
+    }
+
+    /**
+     * Assert that the result of a byte comparison is identical.
+     *
+     * @param expected The expected byte array
+     * @param actual The actual byte array
+     */
+    public final void assertIdentical(byte[] expected, byte[] actual) {
+        assertEquals("Byte arrays of differing sizes, ", expected.length,
+                     actual.length);
+
+        if (expected.length>0) {
+            for (int i = 0; i<expected.length; i++) {
+                assertEquals("Byte array differs at index "+i, expected[i],
+                             actual[i]);
+            }
+        }
+
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/SitemapComponentTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/RequestParamActionTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/RequestParamActionTestCase.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/RequestParamActionTestCase.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/RequestParamActionTestCase.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,63 @@
+/*
+ * 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.
+ */
+
+package org.apache.cocoon.acting;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.environment.ObjectModelHelper;
+import org.apache.cocoon.environment.mock.MockRequest;
+
+/**
+ *
+ *
+ * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
+ * @version CVS $Id: RequestParamActionTestCase.java 55322 2004-10-22 17:09:48Z ugo $
+ */
+public class RequestParamActionTestCase extends TestCase {
+    private Map objectModel = new HashMap();
+
+    public RequestParamActionTestCase(String name) {
+        super(name);
+    }
+
+    public void testRequestAction() throws Exception {
+
+        MockRequest request = new MockRequest();
+        request.setRequestURI("test.xml?abc=def&ghi=jkl");
+        request.setQueryString("abc=def&ghi=jkl");
+        request.setContextPath("servlet");
+        request.addParameter("abc", "def");
+        objectModel.put(ObjectModelHelper.REQUEST_OBJECT, request);
+
+        Parameters parameters = new Parameters();
+        parameters.setParameter("parameters", "true");
+
+        RequestParamAction action = new RequestParamAction();
+        Map result = action.act(null, null, objectModel, null, parameters); 
+
+        assertNotNull("Test if resource exists", result);
+        assertEquals("Test for parameter", "test.xml?abc=def&ghi=jkl", result.get("requestURI"));
+        assertEquals("Test for parameter", "?abc=def&ghi=jkl", result.get("requestQuery"));
+        assertEquals("Test for parameter", "servlet", result.get("context"));
+        assertEquals("Test for parameter", "def", result.get("abc"));
+        assertNull("Test for parameter", result.get("ghi"));
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/RequestParamActionTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/RequestParamActionTestCase.xtest
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/RequestParamActionTestCase.xtest?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/RequestParamActionTestCase.xtest (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/RequestParamActionTestCase.xtest Thu Nov  3 05:41:06 2005
@@ -0,0 +1,46 @@
+<?xml version="1.0" ?>
+<!--
+  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.
+-->
+<testcase>
+ <roles>
+  <role name="org.apache.excalibur.source.SourceFactorySelector"
+        shorthand="source-factories"
+        default-class="org.apache.cocoon.core.container.StandaloneServiceSelector"/>
+
+  <role name="org.apache.excalibur.source.SourceResolver"
+        shorthand="source-resolver"
+        default-class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
+
+  <role name="org.apache.cocoon.acting.ActionSelector"
+        shorthand="actions"
+        default-class="org.apache.cocoon.core.container.StandaloneServiceSelector"/>
+ </roles>
+
+ <components>
+  <source-factories>
+   <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory" name="resource"/>
+   <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
+  </source-factories>
+
+  <source-resolver class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
+
+  <actions logger="test">
+   <component-instance class="org.apache.cocoon.acting.RequestParamAction" 
+                       name="request"/>
+  </actions>
+ </components>
+
+</testcase>

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/ResourceExistsActionTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/ResourceExistsActionTestCase.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/ResourceExistsActionTestCase.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/ResourceExistsActionTestCase.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,74 @@
+/*
+ * 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.
+ */
+
+package org.apache.cocoon.acting;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.cocoon.MockLogger;
+import org.apache.cocoon.environment.SourceResolver;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceNotFoundException;
+import org.jmock.Mock;
+import org.jmock.MockObjectTestCase;
+
+/**
+ *
+ *
+ * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
+ * @version CVS $Id: ResourceExistsActionTestCase.java 55488 2004-10-25 06:12:42Z ugo $
+ */
+public class ResourceExistsActionTestCase extends MockObjectTestCase {
+    private Map objectModel = new HashMap();
+
+    public ResourceExistsActionTestCase(String name) {
+        super(name);
+    }
+
+    public void testExists() throws Exception {
+        String src = "don't care";
+        Parameters parameters = new Parameters();
+        ResourceExistsAction action = new ResourceExistsAction();
+        action.enableLogging(new MockLogger(action.getClass()));
+        Mock resolver = new Mock(SourceResolver.class);
+        Mock source = new Mock(Source.class);
+        resolver.expects(once()).method("resolveURI").with(same(src)).
+                will(returnValue(source.proxy()));
+        resolver.expects(once()).method("release").with(same(source.proxy()));
+        source.expects(atLeastOnce()).method("exists").will(returnValue(true));
+        Map result = action.act(null, (SourceResolver) resolver.proxy(), 
+                objectModel, src, parameters);
+        assertSame("Test if resource exists", AbstractAction.EMPTY_MAP, result);
+        resolver.verify();
+        source.verify();
+    }
+
+    public void testNotExists() throws Exception {
+        String src = "don't care";
+        Parameters parameters = new Parameters();
+        ResourceExistsAction action = new ResourceExistsAction();
+        action.enableLogging(new MockLogger(action.getClass()));
+        Mock resolver = new Mock(SourceResolver.class);
+        resolver.expects(once()).method("resolveURI").with(same(src)).
+                will(this.throwException(new SourceNotFoundException("don't care")));
+        Map result = action.act(null, (SourceResolver) resolver.proxy(), 
+                objectModel, src, parameters);
+        assertNull("Test if resource not exists", result);
+        resolver.verify();
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/acting/ResourceExistsActionTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/bean/CocoonBeanTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/bean/CocoonBeanTestCase.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/bean/CocoonBeanTestCase.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/bean/CocoonBeanTestCase.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon.bean;
+
+import java.io.ByteArrayOutputStream;
+
+import org.apache.cocoon.bean.helpers.OutputStreamListener;
+
+import junit.framework.TestCase;
+
+/**
+ * <p>Test case for the CocoonBean.</p>
+ * 
+ * <p>To function correctly, this test case expects a built webapp at
+ *    <code>build/webapp/</code>, which includes the test-suite 
+ *    within it. Ensure this is included in build.properties by
+ *    commenting out <code>exclude.webapp.test-suite=true</code>.</p>
+ * 
+ * @version CVS $Id: CocoonBeanTestCase.java 30941 2004-07-29 19:56:58Z vgritsenko $
+ */
+public class CocoonBeanTestCase extends TestCase {
+
+	/**
+	 * Constructor for CocoonBeanTest.
+	 * @param arg0
+	 */
+	public CocoonBeanTestCase(String arg0) {
+		super(arg0);
+        
+	}
+    
+    public void testProcessToStream() throws Exception {
+        CocoonBean cocoon = getCocoonBean();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        cocoon.processURI("test-suite/static-site/index.html", baos);
+        String result = baos.toString();
+        assertEquals(1603, result.length());
+        assertTrue(result.indexOf("Cocoon TestSuite")>-1);
+        assertTrue(result.indexOf("<h1>General information</h1>")>-1);
+        cocoon.dispose();
+    }
+    
+    private CocoonBean getCocoonBean() throws Exception {
+        CocoonBean cocoon = new CocoonBean();
+        cocoon.setContextDir("build/webapp");
+        cocoon.setConfigFile("WEB-INF/cocoon.xconf");
+        cocoon.setPrecompileOnly(false);
+        cocoon.setWorkDir("build/work");
+        cocoon.setLogKit("build/webapp/WEB-INF/logkit.xconf");
+        cocoon.setLogger("cli-test");
+        cocoon.setLogLevel("DEBUG");
+        //cocoon.setAgentOptions(*something*));
+        //cocoon.setAcceptOptions(*something*);
+        //cocoon.setDefaultFilename(*something*);
+        //listener.setReportFile(*something*);
+        cocoon.setFollowLinks(true);
+        cocoon.setConfirmExtensions(false);
+        //cocoon.addLoadedClasses(Arrays.asList(*something*));
+        //cocoon.addTargets(BeanConfigurator.processURIFile(*some file*), destDir);
+        cocoon.addListener(new OutputStreamListener(System.out));
+        cocoon.initialize();
+        return cocoon;        
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-core/src/test/java/org/apache/cocoon/bean/CocoonBeanTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message