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:25:07 UTC
svn commit: r677044 - in /cocoon/whiteboard/corona/trunk/corona-sample: ./
src/main/java/org/ src/main/java/org/apache/
src/main/java/org/apache/cocoon/ src/main/java/org/apache/cocoon/corona/
src/main/java/org/apache/cocoon/corona/sample/ src/main/jav...
Author: reinhard
Date: Tue Jul 15 14:25:06 2008
New Revision: 677044
URL: http://svn.apache.org/viewvc?rev=677044&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
Added:
cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/
cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/
cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/
cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/
cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/
cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/
cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/CustomException.java (contents, props changed)
- copied, changed from r677021, cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/action/CustomException.java
cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/ErrorThrowingAction.java (contents, props changed)
- copied, changed from r677021, cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/action/ErrorThrowingAction.java
cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-action.xml (with props)
Modified:
cocoon/whiteboard/corona/trunk/corona-sample/ (props changed)
cocoon/whiteboard/corona/trunk/corona-sample/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Jul 15 14:25:06 2008
@@ -1,4 +1,5 @@
-.settings
-target
-.classpath
-.project
+.settings
+target
+.classpath
+.project
+rcl-config
Copied: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/CustomException.java (from r677021, cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/action/CustomException.java)
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/CustomException.java?p2=cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/CustomException.java&p1=cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/action/CustomException.java&r1=677021&r2=677044&rev=677044&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/action/CustomException.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/CustomException.java Tue Jul 15 14:25:06 2008
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cocoon.corona.sitemap.action;
+package org.apache.cocoon.corona.sample.action;
public class CustomException extends Exception {
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/CustomException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/CustomException.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/CustomException.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/CustomException.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/ErrorThrowingAction.java (from r677021, cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/action/ErrorThrowingAction.java)
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/ErrorThrowingAction.java?p2=cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/ErrorThrowingAction.java&p1=cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/action/ErrorThrowingAction.java&r1=677021&r2=677044&rev=677044&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sitemap/src/main/java/org/apache/cocoon/corona/sitemap/action/ErrorThrowingAction.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/ErrorThrowingAction.java Tue Jul 15 14:25:06 2008
@@ -16,10 +16,12 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.cocoon.corona.sitemap.action;
+package org.apache.cocoon.corona.sample.action;
import java.util.Map;
+import org.apache.cocoon.corona.sitemap.action.Action;
+
public class ErrorThrowingAction implements Action {
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/ErrorThrowingAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/ErrorThrowingAction.java
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/ErrorThrowingAction.java
------------------------------------------------------------------------------
svn:mergeinfo =
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/java/org/apache/cocoon/corona/sample/action/ErrorThrowingAction.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-action.xml
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-action.xml?rev=677044&view=auto
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-action.xml (added)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-action.xml Tue Jul 15 14:25:06 2008
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+ -->
+<!-- $Id$ -->
+<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="action:error-throwing" class="org.apache.cocoon.corona.sample.action.ErrorThrowingAction" scope="prototype" />
+
+</beans>
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-action.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-action.xml
------------------------------------------------------------------------------
svn:keywords = Id
Propchange: cocoon/whiteboard/corona/trunk/corona-sample/src/main/resources/META-INF/cocoon/spring/corona-sample-action.xml
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: cocoon/whiteboard/corona/trunk/corona-sample/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java
URL: http://svn.apache.org/viewvc/cocoon/whiteboard/corona/trunk/corona-sample/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java?rev=677044&r1=677043&r2=677044&view=diff
==============================================================================
--- cocoon/whiteboard/corona/trunk/corona-sample/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java (original)
+++ cocoon/whiteboard/corona/trunk/corona-sample/src/test/java/org/apache/cocoon/corona/sitemap/SitemapBuilderTest.java Tue Jul 15 14:25:06 2008
@@ -20,16 +20,12 @@
import java.net.URL;
import java.util.HashMap;
-import java.util.Map;
-
-import javax.servlet.http.HttpServletResponse;
import junit.framework.TestCase;
+import org.apache.cocoon.corona.sample.action.CustomException;
import org.apache.cocoon.corona.servlet.node.StatusCodeCollector;
import org.apache.cocoon.corona.servlet.util.HttpContextHelper;
-import org.apache.cocoon.corona.sitemap.action.CustomException;
-import org.apache.cocoon.corona.sitemap.node.InvocationResult;
import org.apache.cocoon.corona.sitemap.node.Sitemap;
import org.apache.cocoon.corona.sitemap.objectmodel.ObjectModel;
import org.springframework.context.ApplicationContext;
@@ -41,22 +37,6 @@
private SitemapBuilder sitemapBuilder;
private ComponentProvider componentProvider;
- public void testErrorHandlingGlobal() {
- // TODO: currently this cannot work since some components for error
- // handling are still missing
- // Invocation invocation =
- // this.buildInvocation("error-handling/custom-error");
- // InvocationResult invocationResult = this.sitemap.invoke(invocation);
- // assertNotNull(invocationResult);
- // assertSame(InvocationResult.COMPLETED, invocationResult);
- //
- // // invocation should be marked as error-invocation
- // assertTrue(invocation.isErrorInvocation());
- // // the throwable should be our exception
- // assertTrue(invocation.getThrowable().toString(),
- // invocation.getThrowable() instanceof CustomException);
- }
-
public void testErrorHandlingPipeline() {
Invocation invocation = this.buildInvocation("error-handling/custom-error-per-pipeline-error-handling");
MockHttpServletResponse mockHttpServletResponse = new MockHttpServletResponse();
@@ -72,122 +52,6 @@
assertEquals(501, StatusCodeCollector.getStatusCode());
}
- public void testGenerator() {
- Invocation invocation = this.buildInvocation("sax-pipeline/unauthorized");
- MockHttpServletResponse mockHttpServletResponse = new MockHttpServletResponse();
- HttpContextHelper.storeResponse(mockHttpServletResponse, invocation.getParameters());
-
- InvocationResult invocationResult = this.sitemap.invoke(invocation);
- assertNotNull(invocationResult);
- assertSame(InvocationResult.COMPLETED, invocationResult);
-
- // invocation should not be marked as error-invocation
- assertFalse(invocation.isErrorInvocation());
- assertEquals(401, StatusCodeCollector.getStatusCode());
- }
-
- public void testNoMatchingPipeline() {
- Invocation invocation = this.buildInvocation("unknown");
- InvocationResult invocationResult = this.sitemap.invoke(invocation);
-
- assertNotNull(invocationResult);
- assertTrue(invocation.isErrorInvocation());
- assertTrue("Expected NoMatchingPipelineException but received " + invocation.getThrowable(), invocation
- .getThrowable() instanceof NoMatchingPipelineException);
- }
-
- public void testController() {
- Invocation invocation = this.buildInvocation("controller/invoke");
- InvocationResult invocationResult = this.sitemap.invoke(invocation);
- assertNotNull(invocationResult);
- assertTrue(invocationResult.isCompleted());
- }
-
- public void testXSLT() {
- Invocation invocation = this.buildInvocation("xslt/main");
- InvocationResult invocationResult = this.sitemap.invoke(invocation);
-
- assertNotNull(invocationResult);
- }
-
- public void testObjectModelPipeline() {
- Invocation invocation = this.buildInvocation("object-model/request-parameters");
- Map<String, String> requestParameters = new HashMap<String, String>();
- requestParameters.put("a", "1");
- requestParameters.put("b", "2");
- requestParameters.put("c", "3");
- HttpContextHelper.storeRequest(new MockHttpServletRequest(requestParameters), invocation.getParameters());
- this.sitemap.invoke(invocation);
- // invocation not should be marked as error-invocation
- assertFalse(invocation.isErrorInvocation());
- }
-
- public void testExpressionLanguage() {
- Invocation invocation = this.buildInvocation("expression-language/map/simple");
- this.sitemap.invoke(invocation);
- // invocation should not be marked as error-invocation
- assertFalse("InvocationImpl is marked as erroneous", invocation.isErrorInvocation());
- }
-
- public void testExpressionLanguage2() {
- Invocation invocation = this.buildInvocation("expression-language/nested/simple");
- this.sitemap.invoke(invocation);
- // invocation should not be marked as error-invocation
- assertFalse("InvocationImpl is marked as erroneous", invocation.isErrorInvocation());
- }
-
- // TODO: steven.dolg [2008-02-21]: cannot work until expression-language is
- // integrated correctly
- // public void testExpressionLanguage2() {
- // InvocationImpl invocation =
- // this.buildInvocation("expression-language/nested2/test");
- // this.sitemap.invoke(invocation);
- // // invocation should not be marked as error-invocation
- // assertFalse(invocation.isErrorInvocation());
- // }
-
- // TODO: steven.dolg [2008-02-21]: cannot work until expression-language is
- // integrated correctly
- // public void testExpressionLanguage3() {
- // InvocationImpl invocation =
- // this.buildInvocation("expression-language/nested3/test");
- // this.sitemap.invoke(invocation);
- // // invocation should not be marked as error-invocation
- // assertFalse(invocation.isErrorInvocation());
- // }
-
- public void testReadPipelineExplicit() {
- Invocation invocation = this.buildInvocation("read/javascript-resource-explicit");
- assertTrue(this.sitemap.invoke(invocation).isCompleted());
- // invocation should not be marked as error-invocation
- assertFalse(invocation.isErrorInvocation());
-
- invocation = this.buildInvocation("read/javascript-resource-explicit");
- assertTrue(this.sitemap.invoke(invocation).isCompleted());
- // invocation should not be marked as error-invocation
- assertFalse(invocation.isErrorInvocation());
- }
-
- public void testReadPipelineImplicit() {
- Invocation invocation = this.buildInvocation("read/javascript-resource-implicit.js");
- assertTrue(this.sitemap.invoke(invocation).isCompleted());
- // invocation should not be marked as error-invocation
- assertFalse(invocation.isErrorInvocation());
- }
-
- public void testRedirectPipeline() {
- Invocation invocation = this.buildInvocation("redirect/www.orf.at");
- MockHttpServletResponse response = new MockHttpServletResponse();
- Map<String, Object> parameters = new HashMap<String, Object>();
- parameters.put(HttpServletResponse.class.getName(), response);
- invocation.setParameters(parameters);
-
- assertTrue(this.sitemap.invoke(invocation).isCompleted());
- // invocation should not be marked as error-invocation
- assertFalse("InvocationImpl is marked as erroneous.", invocation.isErrorInvocation());
- assertTrue(response.hasRedirected());
- }
-
@Override
protected void setUp() throws Exception {
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] {
@@ -195,7 +59,7 @@
"META-INF/cocoon/spring/corona-pipeline-component.xml", "META-INF/cocoon/spring/corona-pipeline.xml",
"META-INF/cocoon/spring/corona-sitemap-node.xml",
"META-INF/cocoon/spring/corona-expression-language.xml",
- "META-INF/cocoon/spring/corona-servlet-node.xml",
+ "META-INF/cocoon/spring/corona-sample-action.xml", "META-INF/cocoon/spring/corona-servlet-node.xml",
"META-INF/cocoon/spring/corona-servlet-component.xml", "META-INF/cocoon/spring/corona-controller.xml" });
this.componentProvider = (ComponentProvider) applicationContext