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 2011/05/26 19:37:27 UTC

svn commit: r1128000 - in /cocoon/cocoon3/trunk/cocoon-sample: ./ src/test/java/org/apache/cocoon/profiling/ src/test/java/org/apache/cocoon/sitemap/ src/test/resources/

Author: reinhard
Date: Thu May 26 17:37:26 2011
New Revision: 1128000

URL: http://svn.apache.org/viewvc?rev=1128000&view=rev
Log:
fix failing test cases

Added:
    cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/MockSettings.java   (with props)
    cocoon/cocoon3/trunk/cocoon-sample/src/test/resources/cocoon-sample-test-spring-configurator.xml   (with props)
Modified:
    cocoon/cocoon3/trunk/cocoon-sample/pom.xml
    cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/profiling/ProfilingIntegrationTest.java
    cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/SitemapBuilderTest.java

Modified: cocoon/cocoon3/trunk/cocoon-sample/pom.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/pom.xml?rev=1128000&r1=1127999&r2=1128000&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/pom.xml (original)
+++ cocoon/cocoon3/trunk/cocoon-sample/pom.xml Thu May 26 17:37:26 2011
@@ -33,7 +33,7 @@
   <groupId>org.apache.cocoon.sample</groupId>
   <artifactId>cocoon-sample</artifactId>
   <version>3.0.0-alpha-3-SNAPSHOT</version>
-  
+
   <name>Apache Cocoon 3: Sample</name>
   <description>Cocoon 3 samples.</description>
 
@@ -63,9 +63,13 @@
       <groupId>javax.servlet</groupId>
       <artifactId>servlet-api</artifactId>
       <scope>provided</scope>
-    </dependency>    
+    </dependency>
 
-    <!-- Optional libraries -->    
+    <!-- Optional libraries -->
+    <dependency>
+      <groupId>xalan</groupId>
+      <artifactId>xalan</artifactId>
+    </dependency>
     <dependency>
       <groupId>org.apache.cocoon.optional</groupId>
       <artifactId>cocoon-optional</artifactId>
@@ -73,11 +77,11 @@
     <dependency>
       <groupId>org.apache.xmlgraphics</groupId>
       <artifactId>fop</artifactId>
-    </dependency>      
+    </dependency>
     <dependency>
       <groupId>org.apache.cocoon</groupId>
       <artifactId>cocoon-serializers-charsets</artifactId>
-    </dependency> 
+    </dependency>
     <dependency>
       <groupId>com.sun.jersey</groupId>
       <artifactId>jersey-core</artifactId>
@@ -85,20 +89,20 @@
     <dependency>
       <groupId>com.sun.jersey</groupId>
       <artifactId>jersey-server</artifactId>
-    </dependency>              
-  
+    </dependency>
+
     <!--  Logging dependencies -->
     <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-log4j12</artifactId>
       <scope>runtime</scope>
-    </dependency>    
+    </dependency>
     <dependency>
       <groupId>log4j</groupId>
       <artifactId>log4j</artifactId>
       <scope>runtime</scope>
     </dependency>
-    
+
     <!--  Test dependencies -->
     <dependency>
       <groupId>junit</groupId>

Modified: cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/profiling/ProfilingIntegrationTest.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/profiling/ProfilingIntegrationTest.java?rev=1128000&r1=1127999&r2=1128000&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/profiling/ProfilingIntegrationTest.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/profiling/ProfilingIntegrationTest.java Thu May 26 17:37:26 2011
@@ -85,6 +85,8 @@ public class ProfilingIntegrationTest {
 
         "cocoon-profiling-test-component.xml",
 
+        "cocoon-sample-test-spring-configurator.xml",
+
         "META-INF/cocoon/spring/cocoon-sitemap.xml",
 
         "META-INF/cocoon/spring/cocoon-pipeline-action.xml",

Added: cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/MockSettings.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/MockSettings.java?rev=1128000&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/MockSettings.java (added)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/MockSettings.java Thu May 26 17:37:26 2011
@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+package org.apache.cocoon.sitemap;
+
+import java.util.List;
+
+import org.apache.cocoon.configuration.Settings;
+
+public class MockSettings implements Settings {
+
+    public String getCacheDirectory() {
+        return null;
+    }
+
+    public String getContainerEncoding() {
+        return null;
+    }
+
+    public long getCreationTime() {
+        return 0;
+    }
+
+    public String getFormEncoding() {
+        return null;
+    }
+
+    public List<?> getLoadClasses() {
+        return null;
+    }
+
+    public String getProperty(String key) {
+        return null;
+    }
+
+    public String getProperty(String key, String defaultValue) {
+        return null;
+    }
+
+    public List<?> getPropertyNames() {
+        return null;
+    }
+
+    public List<?> getPropertyNames(String keyPrefix) {
+        return null;
+    }
+
+    public long getReloadDelay(String type) {
+        return 0;
+    }
+
+    public String getRunningMode() {
+        return null;
+    }
+
+    public String getWorkDirectory() {
+        return null;
+    }
+
+    public boolean isReloadingEnabled(String type) {
+        return false;
+    }
+}

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/MockSettings.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/MockSettings.java
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/MockSettings.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/SitemapBuilderTest.java
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/SitemapBuilderTest.java?rev=1128000&r1=1127999&r2=1128000&view=diff
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/SitemapBuilderTest.java (original)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/test/java/org/apache/cocoon/sitemap/SitemapBuilderTest.java Thu May 26 17:37:26 2011
@@ -42,6 +42,13 @@ public class SitemapBuilderTest extends 
     private SitemapBuilder sitemapBuilder;
     private ComponentProvider componentProvider;
 
+    public void testController() throws Exception {
+        Invocation invocation = this.buildInvocation("controller/invoke");
+        InvocationResult invocationResult = this.sitemap.invoke(invocation);
+        assertNotNull(invocationResult);
+        assertTrue(invocationResult.isCompleted());
+    }
+
     public void testErrorHandlingPipeline() throws Exception {
         Invocation invocation = this.buildInvocation("error-handling/custom-error-per-pipeline-error-handling");
         MockHttpServletResponse mockHttpServletResponse = new MockHttpServletResponse();
@@ -59,6 +66,20 @@ public class SitemapBuilderTest extends 
         assertEquals(501, ResponseHeaderCollector.getStatusCode());
     }
 
+    public void testExpressionLanguage() {
+        Invocation invocation = this.buildInvocation("expression-language/map-numbers/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());
+    }
+
     public void testGenerator() throws Exception {
         Invocation invocation = this.buildInvocation("sax-pipeline/unauthorized");
         MockHttpServletResponse mockHttpServletResponse = new MockHttpServletResponse();
@@ -83,19 +104,6 @@ public class SitemapBuilderTest extends 
                 .getThrowable() instanceof NoMatchingPipelineException);
     }
 
-    public void testController() throws Exception {
-        Invocation invocation = this.buildInvocation("controller/invoke");
-        InvocationResult invocationResult = this.sitemap.invoke(invocation);
-        assertNotNull(invocationResult);
-        assertTrue(invocationResult.isCompleted());
-    }
-
-    public void testXSLT() throws Exception {
-        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>();
@@ -109,20 +117,6 @@ public class SitemapBuilderTest extends 
         assertFalse(invocation.isErrorInvocation());
     }
 
-    public void testExpressionLanguage() {
-        Invocation invocation = this.buildInvocation("expression-language/map-numbers/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());
-    }
-
     public void testReadPipelineExplicit() {
         Invocation invocation = this.buildInvocation("read/javascript-resource-explicit");
         assertTrue(this.sitemap.invoke(invocation).isCompleted());
@@ -159,6 +153,12 @@ public class SitemapBuilderTest extends 
         assertTrue(response.hasRedirected());
     }
 
+    public void testXSLT() throws Exception {
+        Invocation invocation = this.buildInvocation("xslt/main");
+        InvocationResult invocationResult = this.sitemap.invoke(invocation);
+        assertNotNull(invocationResult);
+    }
+
     @Override
     protected void setUp() throws Exception {
         super.setUp();
@@ -166,6 +166,8 @@ public class SitemapBuilderTest extends 
         ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] {
                 "cocoon-sample-test-collector.xml",
 
+                "cocoon-sample-test-spring-configurator.xml",
+
                 "META-INF/cocoon/spring/cocoon-pipeline.xml",
 
                 "META-INF/cocoon/spring/cocoon-pipeline-action.xml",
@@ -184,10 +186,10 @@ public class SitemapBuilderTest extends 
 
                 "META-INF/cocoon/spring/cocoon-controller.xml"
 
-                 });
+        });
 
         this.componentProvider = (ComponentProvider) applicationContext
-                .getBean("org.apache.cocoon.sitemap.ComponentProvider");
+        .getBean("org.apache.cocoon.sitemap.ComponentProvider");
 
         URL sitemapURL = this.getClass().getResource("/COB-INF/sitemap.xmap");
         this.sitemapBuilder = (SitemapBuilder) applicationContext.getBean("org.apache.cocoon.sitemap.SitemapBuilder");

Added: cocoon/cocoon3/trunk/cocoon-sample/src/test/resources/cocoon-sample-test-spring-configurator.xml
URL: http://svn.apache.org/viewvc/cocoon/cocoon3/trunk/cocoon-sample/src/test/resources/cocoon-sample-test-spring-configurator.xml?rev=1128000&view=auto
==============================================================================
--- cocoon/cocoon3/trunk/cocoon-sample/src/test/resources/cocoon-sample-test-spring-configurator.xml (added)
+++ cocoon/cocoon3/trunk/cocoon-sample/src/test/resources/cocoon-sample-test-spring-configurator.xml Thu May 26 17:37:26 2011
@@ -0,0 +1,25 @@
+<?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.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xmlns:aop="http://www.springframework.org/schema/aop" xmlns:configurator="http://cocoon.apache.org/schema/configurator"
+  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+                      http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
+                     http://cocoon.apache.org/schema/configurator http://cocoon.apache.org/schema/configurator/cocoon-configurator-1.0.1.xsd
+  ">
+
+  <bean name="org.apache.cocoon.Settings" class="org.apache.cocoon.sitemap.MockSettings" />
+
+</beans>

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/test/resources/cocoon-sample-test-spring-configurator.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/test/resources/cocoon-sample-test-spring-configurator.xml
------------------------------------------------------------------------------
    svn:keywords = Id

Propchange: cocoon/cocoon3/trunk/cocoon-sample/src/test/resources/cocoon-sample-test-spring-configurator.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml