cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r509124 - in /cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src: main/java/org/apache/cocoon/portal/impl/ test/java/org/apache/cocoon/portal/
Date Mon, 19 Feb 2007 08:14:59 GMT
Author: cziegeler
Date: Mon Feb 19 00:14:58 2007
New Revision: 509124

URL: http://svn.apache.org/viewvc?view=rev&rev=509124
Log:
Fix test case

Added:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/MockProcessInfoProvider.java
Modified:
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
    cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java?view=diff&rev=509124&r1=509123&r2=509124
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/main/java/org/apache/cocoon/portal/impl/PortalServiceImpl.java
Mon Feb 19 00:14:58 2007
@@ -187,16 +187,24 @@
         this.portalName = portal.getAttribute("name");
         this.configuration = portal.getChild("configuration");
         this.configureSkins(this.getConfiguration(org.apache.cocoon.portal.Constants.CONFIGURATION_SKINS_PATH,
-                                                  org.apache.cocoon.portal.Constants.DEFAULT_CONFIGURATION_SKINS_PATH));
+                                                  org.apache.cocoon.portal.Constants.DEFAULT_CONFIGURATION_SKINS_PATH),
+                            this.getConfiguration(org.apache.cocoon.portal.Constants.CONFIGURATION_SKINS_PATH,
null) != null);
     }
 
-    protected void configureSkins(String directory)
+    protected void configureSkins(String directory, boolean check)
     throws ConfigurationException {
         SourceResolver resolver = null;
         Source dir = null;
         try {
             resolver = (SourceResolver)this.manager.lookup(SourceResolver.ROLE);
             dir = resolver.resolveURI(directory, null, CONTEXT_PARAMETERS);
+            if ( !dir.exists() ) {
+                if ( check ) {
+                    throw new ConfigurationException("Skin directory does not exist: '" +
directory + "'.");
+                }
+                this.getLogger().warn("No skin directory found at location '" + directory
+ "'.");
+                return;
+            }
             if ( dir instanceof TraversableSource ) {
                 final Iterator children = ((TraversableSource)dir).getChildren().iterator();
                 while ( children.hasNext() ) {
@@ -208,7 +216,7 @@
                     }
                 }
             } else {
-                throw new ConfigurationException("Include.dir must point to a directory,
'" + dir.getURI() + "' is not a directory.'");
+                throw new ConfigurationException("Skin configuration must point to a directory,
'" + dir.getURI() + "' is not a directory.'");
             }
         } catch (IOException ioe) {
             throw new ConfigurationException("Unable to read configurations from " + directory);

Modified: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java?view=diff&rev=509124&r1=509123&r2=509124
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java
(original)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/AbstractPortalTestCase.java
Mon Feb 19 00:14:58 2007
@@ -29,6 +29,7 @@
 import org.apache.cocoon.core.container.spring.avalon.ConfigurationInfo;
 import org.apache.cocoon.environment.mock.MockContext;
 import org.apache.cocoon.portal.impl.PortalServiceImpl;
+import org.apache.cocoon.processing.ProcessInfoProvider;
 
 /**
  * Abstract test case class that can be used as a base for own portal
@@ -75,6 +76,11 @@
      */
     protected void addComponents(ConfigurationInfo info) throws Exception {
         super.addComponents(info);
+        // ProcessInfoProvider
+        final ComponentInfo processInfoProvider = new ComponentInfo();
+        processInfoProvider.setComponentClassName(MockProcessInfoProvider.class.getName());
+        processInfoProvider.setRole(ProcessInfoProvider.ROLE);
+        info.addComponent(processInfoProvider);
         // Add portal service
         final ComponentInfo portalServiceInfo = new ComponentInfo();
         portalServiceInfo.setComponentClassName(PortalServiceImpl.class.getName());

Added: cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/MockProcessInfoProvider.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/MockProcessInfoProvider.java?view=auto&rev=509124
==============================================================================
--- cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/MockProcessInfoProvider.java
(added)
+++ cocoon/trunk/blocks/cocoon-portal/cocoon-portal-impl/src/test/java/org/apache/cocoon/portal/MockProcessInfoProvider.java
Mon Feb 19 00:14:58 2007
@@ -0,0 +1,44 @@
+package org.apache.cocoon.portal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.cocoon.processing.ProcessInfoProvider;
+
+public class MockProcessInfoProvider implements ProcessInfoProvider {
+
+    protected Map objectModel = new HashMap();
+
+    /**
+     * @see org.apache.cocoon.processing.ProcessInfoProvider#getObjectModel()
+     */
+    public Map getObjectModel() {
+        return this.objectModel;
+    }
+
+    /**
+     * @see org.apache.cocoon.processing.ProcessInfoProvider#getRequest()
+     */
+    public HttpServletRequest getRequest() {
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.processing.ProcessInfoProvider#getResponse()
+     */
+    public HttpServletResponse getResponse() {
+        return null;
+    }
+
+    /**
+     * @see org.apache.cocoon.processing.ProcessInfoProvider#getServletContext()
+     */
+    public ServletContext getServletContext() {
+        return null;
+    }
+
+}



Mime
View raw message