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/08 00:20:22 UTC

svn commit: r160479 - in cocoon/trunk/src/test/org/apache/cocoon: environment/mock/MockEnvironment.java reading/ reading/VirtualPipelineReaderTestCase.java reading/VirtualPipelineReaderTestCase.xconf reading/vpc-sitemap.xmap reading/vpc-test.xml

Author: danielf
Date: Thu Apr  7 15:20:20 2005
New Revision: 160479

URL: http://svn.apache.org/viewcvs?view=rev&rev=160479
Log:
Simple test case for VirtualPipelineReader, needed to extend the MockEnvironment.

Added:
    cocoon/trunk/src/test/org/apache/cocoon/reading/
    cocoon/trunk/src/test/org/apache/cocoon/reading/VirtualPipelineReaderTestCase.java
    cocoon/trunk/src/test/org/apache/cocoon/reading/VirtualPipelineReaderTestCase.xconf
    cocoon/trunk/src/test/org/apache/cocoon/reading/vpc-sitemap.xmap
    cocoon/trunk/src/test/org/apache/cocoon/reading/vpc-test.xml
Modified:
    cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java

Modified: cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java?view=diff&r1=160478&r2=160479
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/environment/mock/MockEnvironment.java Thu Apr  7 15:20:20 2005
@@ -107,11 +107,10 @@
     }
 
     public boolean isResponseModified(long lastModified) {
-        throw new AssertionFailedError("Not implemented");
+        return false;
     }
 
     public void setResponseIsNotModified() {
-        throw new AssertionFailedError("Not implemented");
     }
 
     public void setAttribute(String name, Object value) {

Added: cocoon/trunk/src/test/org/apache/cocoon/reading/VirtualPipelineReaderTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/reading/VirtualPipelineReaderTestCase.java?view=auto&rev=160479
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/reading/VirtualPipelineReaderTestCase.java (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/reading/VirtualPipelineReaderTestCase.java Thu Apr  7 15:20:20 2005
@@ -0,0 +1,24 @@
+/*
+ * 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.reading;
+
+import org.apache.cocoon.SitemapTestCase;
+
+public class VirtualPipelineReaderTestCase extends SitemapTestCase {
+    public void testVirtualPipe() throws Exception {
+        pipeTest("v1", "vpc-test.xml");
+    }
+}

Added: cocoon/trunk/src/test/org/apache/cocoon/reading/VirtualPipelineReaderTestCase.xconf
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/reading/VirtualPipelineReaderTestCase.xconf?view=auto&rev=160479
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/reading/VirtualPipelineReaderTestCase.xconf (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/reading/VirtualPipelineReaderTestCase.xconf Thu Apr  7 15:20:20 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.
+-->
+
+<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/>
+
+  <input-modules>
+    <component-instance class="org.apache.cocoon.components.modules.input.EnvironmentAttributeModule" name="environment-attribute"/>
+  </input-modules>
+
+  <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.cocoon.components.source.impl.ModuleSourceFactory" name="module"/>
+    <component-instance class="org.apache.cocoon.components.source.impl.XModuleSourceFactory" name="xmodule"/>
+    <component-instance class="org.apache.excalibur.source.impl.FileSourceFactory" name="file"/>
+    <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
+  </source-factories>
+
+  <!-- Relative sitemap path works during sitemap execution but
+       give exceptions during decommissioning -->
+  <sitemap file="resource://org/apache/cocoon/reading/vpc-sitemap.xmap"/>
+
+</components>
\ No newline at end of file

Added: cocoon/trunk/src/test/org/apache/cocoon/reading/vpc-sitemap.xmap
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/reading/vpc-sitemap.xmap?view=auto&rev=160479
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/reading/vpc-sitemap.xmap (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/reading/vpc-sitemap.xmap Thu Apr  7 15:20:20 2005
@@ -0,0 +1,63 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Copyright 1999-2004 The Apache Software Foundation
+
+  Licensed under the Apache License, Version 2.0 (the "License");
+  you may not use this file except in compliance with the License.
+  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+
+<!-- SVN $Id$ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+  <map:components>
+    <map:generators default="file">
+      <map:generator name="file" src="org.apache.cocoon.generation.FileGenerator"/>
+    </map:generators>
+
+    <map:transformers default="xslt">
+      <map:transformer name="xslt" src="org.apache.cocoon.transformation.TraxTransformer">
+        <xslt-processor-role>xalan</xslt-processor-role>
+      </map:transformer>
+    </map:transformers>
+
+    <map:serializers default="xml">
+      <map:serializer mime-type="text/xml" name="xml" src="org.apache.cocoon.serialization.XMLSerializer"/>
+    </map:serializers>
+
+    <map:readers>
+      <map:reader name="virtual1" src="org.apache.cocoon.reading.VirtualPipelineReader">
+        <map:generate type="file" src="vpc-test.xml"/>
+        <map:serialize type="xml"/>
+      </map:reader>
+    </map:readers>
+
+    <map:matchers default="wildcard">
+      <map:matcher name="wildcard" src="org.apache.cocoon.matching.WildcardURIMatcher"/>
+    </map:matchers>
+
+    <map:pipes default="noncaching">
+      <map:pipe name="noncaching" src="org.apache.cocoon.components.pipeline.impl.NonCachingProcessingPipeline">
+      </map:pipe>
+    </map:pipes>
+  </map:components>
+
+  <map:pipelines>
+    <map:pipeline>
+
+      <map:match pattern="v1">
+        <map:read type="virtual1"/>
+      </map:match>
+
+    </map:pipeline>
+  </map:pipelines>
+</map:sitemap>

Added: cocoon/trunk/src/test/org/apache/cocoon/reading/vpc-test.xml
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/reading/vpc-test.xml?view=auto&rev=160479
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/reading/vpc-test.xml (added)
+++ cocoon/trunk/src/test/org/apache/cocoon/reading/vpc-test.xml Thu Apr  7 15:20:20 2005
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><test/>
\ No newline at end of file



Re: svn commit: r160479 - in cocoon/trunk/src/test/org/apache/cocoon: environment/mock/MockEnvironment.java reading/ reading/VirtualPipelineReaderTestCase.java reading/VirtualPipelineReaderTestCase.xconf reading/vpc-sitemap.xmap reading/vpc-test.xml

Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Vadim Gritsenko wrote:

> danielf@apache.org wrote:
>
>>  
>>      public boolean isResponseModified(long lastModified) {
>> -        throw new AssertionFailedError("Not implemented");
>> +        return false;
>>      }
>
>
> IIUC, it should be 'true', otherwise you should be getting empty 
> response (in http env, this is 304 Not Modified), and reader won't 
> even get called.
>
> Vadim

Thanks, that helps a little bit, still don't get any output though.

/Daniel


Re: svn commit: r160479 - in cocoon/trunk/src/test/org/apache/cocoon: environment/mock/MockEnvironment.java reading/ reading/VirtualPipelineReaderTestCase.java reading/VirtualPipelineReaderTestCase.xconf reading/vpc-sitemap.xmap reading/vpc-test.xml

Posted by Vadim Gritsenko <va...@reverycodes.com>.
danielf@apache.org wrote:
>  
>      public boolean isResponseModified(long lastModified) {
> -        throw new AssertionFailedError("Not implemented");
> +        return false;
>      }

IIUC, it should be 'true', otherwise you should be getting empty response (in 
http env, this is 304 Not Modified), and reader won't even get called.

Vadim