You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by re...@apache.org on 2008/07/15 23:23:23 UTC

svn commit: r677043 - in /cocoon/whiteboard/corona/trunk: corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/ corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/ corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/actio...

Author: reinhard
Date: Tue Jul 15 14:23:23 2008
New Revision: 677043

URL: http://svn.apache.org/viewvc?rev=677043&view=rev
Log:
. fix subtle bug with actions and error invocations and make unit tests and integration test work again
. move test code into corona-sample

Removed:
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/action/CustomException.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/action/ErrorThrowingAction.java
Modified:
    cocoon/whiteboard/corona/trunk/corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/ReaderTest.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
    cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-pipeline-action.xml

Modified: cocoon/whiteboard/corona/trunk/corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/ReaderTest.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/ReaderTest.java?rev=677043&r1=677042&r2=677043&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/ReaderTest.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sample-webapp/src/test/java/org/apache/cocoon/corona/it/ReaderTest.java Tue Jul 15 14:23:23 2008
@@ -54,7 +54,6 @@
     public void testConditionalGet() throws Exception {
         this.loadResponse("read/javascript-resource-implicit.js");
         String lastModified = this.response.getResponseHeaderValue("Last-Modified");
-        System.out.println("lm=" + lastModified);
         assertNotNull("Last-Modified has to be set at this point!", lastModified);
         assertFalse("Last-Modified hast to be set at this point!", "".equals(lastModified));
         this.webClient.addRequestHeader("If-Modified-Since", lastModified);

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java?rev=677043&r1=677042&r2=677043&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/Invocation.java Tue Jul 15 14:23:23 2008
@@ -24,6 +24,8 @@
 
 public interface Invocation {
 
+    void clearActions();
+
     void execute() throws Exception;
 
     OutputStream getOutputStream();

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java?rev=677043&r1=677042&r2=677043&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/InvocationImpl.java Tue Jul 15 14:23:23 2008
@@ -59,7 +59,7 @@
 
     /**
      * Create a {@link InvocationImpl} object using the given output stream.
-     *
+     * 
      * @param outputStream The {@link OutputStream} where the result is written to.
      */
     public InvocationImpl(OutputStream outputStream) {
@@ -69,7 +69,7 @@
 
     /**
      * Create a {@link InvocationImpl} object using the given output stream and requestURI.
-     *
+     * 
      * @param outputStream The {@link OutputStream} where the result is written to.
      * @param requestURI The requested path.
      */
@@ -81,7 +81,7 @@
 
     /**
      * Create a {@link InvocationImpl} object using the given output stream, requestURI and parameters.
-     *
+     * 
      * @param outputStream The {@link OutputStream} where the result is written to.
      * @param requestURI The requested path.
      * @param parameters A {@link Map} of parameters that are used when the pipeline is being executed.
@@ -95,7 +95,16 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
+     * @see org.apache.cocoon.corona.sitemap.Invocation#clearActions()
+     */
+    public void clearActions() {
+        this.actions.clear();
+    }
+
+    /**
+     * {@inheritDoc}
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#execute()
      */
     public void execute() throws Exception {
@@ -104,13 +113,13 @@
         }
 
         // first setup everything
-        for(final Action action : this.actions) {
+        for (final Action action : this.actions) {
             action.setup(this.parameters);
         }
         this.pipeline.setup(this.parameters, this.outputStream);
 
         // then execute
-        for(final Action action : this.actions) {
+        for (final Action action : this.actions) {
             action.execute();
         }
         this.pipeline.execute();
@@ -118,7 +127,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#getOutputStream()
      */
     public OutputStream getOutputStream() {
@@ -127,7 +136,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#getParameter(java.lang.String)
      */
     public Object getParameter(String name) {
@@ -139,7 +148,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#getParameters()
      */
     public Map<String, Object> getParameters() {
@@ -148,7 +157,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#getRequestURI()
      */
     public String getRequestURI() {
@@ -157,7 +166,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#getThrowable()
      */
     public Throwable getThrowable() {
@@ -166,7 +175,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#hasCompletePipeline()
      */
     public boolean hasCompletePipeline() {
@@ -175,7 +184,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#installAction(java.lang.String)
      */
     public void installAction(String type) {
@@ -189,7 +198,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#installComponent(java.lang.String, java.util.Map)
      */
     public void installComponent(String type, Map<String, ? extends Object> componentParameters) {
@@ -209,7 +218,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#installPipeline(java.lang.String)
      */
     public void installPipeline(String type) {
@@ -218,7 +227,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#isErrorInvocation()
      */
     public boolean isErrorInvocation() {
@@ -227,7 +236,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#popSitemapParameters()
      */
     public void popSitemapParameters() {
@@ -236,7 +245,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#pushSitemapParameters(java.lang.String, java.util.Map)
      */
     public void pushSitemapParameters(String nodeName, Map<String, ? extends Object> sitemapParameters) {
@@ -245,7 +254,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#resolve(java.lang.String)
      */
     public URL resolve(String resource) {
@@ -262,7 +271,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#setOutputStream(java.io.OutputStream)
      */
     public void setOutputStream(OutputStream outputStream) {
@@ -271,7 +280,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#setParameters(java.util.Map)
      */
     public void setParameters(Map<String, Object> parameters) {
@@ -284,7 +293,7 @@
 
     /**
      * {@inheritDoc}
-     *
+     * 
      * @see org.apache.cocoon.corona.sitemap.Invocation#setThrowable(java.lang.Throwable)
      */
     public void setThrowable(Throwable throwable) {

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java?rev=677043&r1=677042&r2=677043&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/node/PipelineNode.java Tue Jul 15 14:23:23 2008
@@ -46,6 +46,7 @@
     @Override
     public InvocationResult invoke(Invocation invocation) {
         this.installPipeline(invocation);
+        this.clearActions(invocation);
 
         try {
             // now proceed as usual (invoking our children)
@@ -65,6 +66,10 @@
         }
     }
 
+    private void clearActions(Invocation invocation) {
+        invocation.clearActions();
+    }
+
     /**
      * {@inheritDoc}
      * 

Modified: cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-pipeline-action.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-pipeline-action.xml?rev=677043&r1=677042&r2=677043&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-pipeline-action.xml (original)
+++ cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/resources/META-INF/cocoon/spring/corona-pipeline-action.xml Tue Jul 15 14:23:23 2008
@@ -21,21 +21,8 @@
 <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
 
-  <!--
-    <bean name="org.apache.cocoon.corona.sitemap.spring.ActionFactory"
-    class="org.apache.cocoon.corona.sitemap.spring.ReflectionActionFactory">
-    <property name="types">
-    <map>
-    <entry key="error-throwing" value="org.apache.cocoon.corona.pipeline.action.ErrorThrowingAction" />
-    </map>
-    </property>
-    </bean>
-  -->
-
   <bean name="org.apache.cocoon.corona.sitemap.spring.ActionFactory"
     class="org.apache.cocoon.corona.sitemap.spring.PrototypeActionFactory">
   </bean>
 
-  <bean name="action:error-throwing" class="org.apache.cocoon.corona.pipeline.action.ErrorThrowingAction" scope="prototype" />
-
-</beans>
+</beans>
\ No newline at end of file