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

svn commit: r164141 - in /cocoon/trunk/src/test/org/apache/cocoon/components/blocks: ./ BlockManagerTestCase.java BlockManagerTestCase.xconf BlocksManagerTestCase.java BlocksManagerTestCase.xtest test1/ test1/COB-INF/ test1/COB-INF/block.xml wiring.xml

Author: danielf
Date: Thu Apr 21 15:23:38 2005
New Revision: 164141

URL: http://svn.apache.org/viewcvs?rev=164141&view=rev
Log:
Test code for the block management and some block configuration files to test on. It is only tested that the blockmanager and blocksmanager can be created and configured.

Added:
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.java   (with props)
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.xconf   (with props)
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.java   (with props)
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xtest   (with props)
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/COB-INF/
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/COB-INF/block.xml   (with props)
    cocoon/trunk/src/test/org/apache/cocoon/components/blocks/wiring.xml   (with props)

Added: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.java?rev=164141&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.java (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.java Thu Apr 21 15:23:38 2005
@@ -0,0 +1,26 @@
+/*
+ * 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.components.blocks;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.cocoon.SitemapTestCase;
+
+public class BlockManagerTestCase extends SitemapTestCase {
+    public void testConfigure() throws ServiceException {
+        BlockManager block = (BlockManager)this.lookup(BlockManager.ROLE);
+        this.release(block);
+    }
+}

Propchange: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.xconf
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.xconf?rev=164141&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.xconf (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.xconf Thu Apr 21 15:23:38 2005
@@ -0,0 +1,48 @@
+<?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.
+-->
+
+<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>
+
+  <component role="org.apache.cocoon.components.blocks.BlockManager"
+             class="org.apache.cocoon.components.blocks.BlockManager"
+             id="test1id" location="test1">
+    <mount path="/test1/"/>
+    <connections>
+      <connection name="test2" block="test2id"/>
+    </connections>
+    <properties>
+      <property name="foo" value="bar"/>
+    </properties>
+  </component>
+
+</components>

Propchange: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlockManagerTestCase.xconf
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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=164141&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.java (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.java Thu Apr 21 15:23:38 2005
@@ -0,0 +1,36 @@
+/*
+ * 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.components.blocks;
+
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.cocoon.SitemapComponentTestCase;
+
+public class BlocksManagerTestCase extends SitemapComponentTestCase {
+
+    /**
+     * 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 testConfigure() throws ServiceException {
+        BlocksManager blocks = (BlocksManager)this.lookup(BlocksManager.ROLE);
+        this.release(blocks);
+    }
+}

Propchange: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: 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.xtest?rev=164141&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xtest (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xtest Thu Apr 21 15:23:38 2005
@@ -0,0 +1,59 @@
+<?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.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>
+
+    <blocks file="resource://org/apache/cocoon/components/blocks/wiring.xml"/> 
+
+  </components>
+
+</testcase>

Propchange: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/BlocksManagerTestCase.xtest
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/COB-INF/block.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/COB-INF/block.xml?rev=164141&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/COB-INF/block.xml (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/test1/COB-INF/block.xml Thu Apr 21 15:23:38 2005
@@ -0,0 +1,43 @@
+<?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/anyblock/1.0">
+  <name>anyblock</name>
+  <description href="http://cocoon.apache.org/blocks/anyblock/1.0">
+    A 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="sitemap.xmap"/>
+  <properties>
+    <property name="foo">
+      <default>baz</default>
+      <description>A test property</description>
+    </property>
+  </properties>
+  <requirements>
+    <requires interface="http://cocoon.apache.org/blocks/another-interface/1.0"
+              name="test2"
+              default="http://cocoon.apache.org/blocks/another-block/1.0"/>
+  </requirements>
+</block>
\ No newline at end of file

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

Added: 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=164141&view=auto
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/components/blocks/wiring.xml (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/components/blocks/wiring.xml Thu Apr 21 15:23:38 2005
@@ -0,0 +1,33 @@
+<!--
+  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. 
+-->
+<wiring xmlns="http://apache.org/cocoon/blocks/wiring/1.0"
+        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+        xsi:schemaLocation="http://apache.org/cocoon/blocks/wiring/1.0 wiring-schema-1.0.xsd"
+>
+
+  <block id="test1id" location="./test1">
+    <mount path="/test1/"/>
+    <connections>
+      <connection name="test2" block="test2id"/>
+    </connections>
+    <properties>
+      <property name="foo" value="bar"/>
+    </properties>
+  </block>
+
+  <block id="test2id" location="./test2"/>
+
+</wiring>
\ No newline at end of file

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