You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2005/04/21 22:04:01 UTC

svn commit: r164112 - in /cocoon: blocks/core/forms/trunk/java/org/apache/cocoon/forms/binding/ blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/ trunk/ trunk/src/java/org/apache/cocoon/ trunk/src/java/org/apache/cocoon/bean/ trunk/src/java/org/apache/cocoon/core/ trunk/src/java/org/apache/cocoon/core/container/ trunk/src/java/org/apache/cocoon/serialization/ trunk/src/test/org/apache/cocoon/ trunk/src/test/org/apache/cocoon/core/container/

Author: cziegeler
Date: Thu Apr 21 13:04:01 2005
New Revision: 164112

URL: http://svn.apache.org/viewcvs?rev=164112&view=rev
Log:
Remove the need for context object (where possible)
Reduce default logging output during junit tests

Modified:
    cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java
    cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java
    cocoon/trunk/build.properties
    cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java
    cocoon/trunk/src/java/org/apache/cocoon/bean/CocoonWrapper.java
    cocoon/trunk/src/java/org/apache/cocoon/core/Core.java
    cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java
    cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentEnvironment.java
    cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentFactory.java
    cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java
    cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
    cocoon/trunk/src/test/org/apache/cocoon/CocoonTestCase.java
    cocoon/trunk/src/test/org/apache/cocoon/SitemapComponentTestCase.java
    cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java

Modified: cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java (original)
+++ cocoon/blocks/core/forms/trunk/java/org/apache/cocoon/forms/binding/MultiValueJXPathBinding.java Thu Apr 21 13:04:01 2005
@@ -15,7 +15,6 @@
  */
 package org.apache.cocoon.forms.binding;
 
-import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.Locale;
@@ -24,7 +23,6 @@
 import org.apache.cocoon.forms.datatype.convertor.Convertor;
 import org.apache.cocoon.forms.datatype.convertor.ConversionResult;
 import org.apache.cocoon.forms.formmodel.Widget;
-import org.apache.commons.jxpath.AbstractFactory;
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.Pointer;
 

Modified: cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java (original)
+++ cocoon/blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/CocoonPortlet.java Thu Apr 21 13:04:01 2005
@@ -35,8 +35,6 @@
 import org.apache.cocoon.components.notification.DefaultNotifyingBuilder;
 import org.apache.cocoon.components.notification.Notifier;
 import org.apache.cocoon.components.notification.Notifying;
-import org.apache.cocoon.configuration.Settings;
-import org.apache.cocoon.core.Core;
 import org.apache.cocoon.environment.Environment;
 import org.apache.cocoon.environment.portlet.PortletContext;
 import org.apache.cocoon.environment.portlet.PortletEnvironment;
@@ -293,8 +291,6 @@
 
         this.portletContext = conf.getPortletContext();
         this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, new PortletContext(this.portletContext));
-        // FIXME - add settings
-        appContext.put(Core.CONTEXT_SETTINGS, new Settings());
         this.portletContextPath = this.portletContext.getRealPath("/");
 
         // first init the work-directory for the logger.

Modified: cocoon/trunk/build.properties
URL: http://svn.apache.org/viewcvs/cocoon/trunk/build.properties?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/build.properties (original)
+++ cocoon/trunk/build.properties Thu Apr 21 13:04:01 2005
@@ -74,7 +74,7 @@
 
 junit.test.debugport=8000
 #junit.testcase=org.apache.cocoon.util.test.NetUtilsTestCase
-junit.test.loglevel=0
+junit.test.loglevel=1
 
 # ---- IDE ---------------------------------------------------------------------
 

Modified: cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/Cocoon.java Thu Apr 21 13:04:01 2005
@@ -116,6 +116,9 @@
     /** An optional Avalon Component that is called before and after processing all requests. */
     protected RequestListener requestListener;
 
+    /** The Cocoon Core */
+    protected Core core;
+
     /**
      * Creates a new <code>Cocoon</code> instance.
      *
@@ -144,6 +147,7 @@
     public void service(ServiceManager manager)
     throws ServiceException {
         this.parentServiceManager = manager;
+        this.core = (Core)this.parentServiceManager.lookup(Core.ROLE);
     }
 
     /* (non-Javadoc)
@@ -152,17 +156,6 @@
     public void contextualize(Context context) throws ContextException {
         this.context = new ComponentContext(context);
         ((DefaultContext)this.context).makeReadOnly();
-
-        final Settings settings = Core.getSettings(this.context);
-        try {
-            URLSource urlSource = new URLSource();
-            urlSource.init(new URL(settings.getConfiguration()), null);
-            this.configurationFile = new DelayedRefreshSourceWrapper(urlSource,
-                                                                     settings.getConfigurationReloadDelay());
-
-        } catch (IOException e) {
-            throw new ContextException("Could not open configuration file: " + settings.getConfiguration(), e);
-        }
     }
 
     /**
@@ -180,15 +173,27 @@
      * @see org.apache.avalon.framework.activity.Initializable#initialize()
      */
     public void initialize() throws Exception {
+        getLogger().debug("Initializing new Cocoon object.");
+        final Settings settings = this.core.getSettings();
+        try {
+            URLSource urlSource = new URLSource();
+            urlSource.init(new URL(settings.getConfiguration()), null);
+            this.configurationFile = new DelayedRefreshSourceWrapper(urlSource,
+                                                                     settings.getConfigurationReloadDelay());
+
+        } catch (IOException e) {
+            throw new ConfigurationException(
+                    "Could not open configuration file: " + settings.getConfiguration(), e);
+        }
+
         this.serviceManager = new CocoonServiceManager(this.parentServiceManager);
         ContainerUtil.enableLogging(this.serviceManager, this.rootLogger.getChildLogger("manager"));
         ContainerUtil.contextualize(this.serviceManager, this.context);
-        getLogger().debug("Initializing new Cocoon object.");
 
         // Log the System Properties.
         dumpSystemProperties();
 
-        configure();
+        this.configure();
 
         // add the logger manager to the component locator
 
@@ -236,7 +241,7 @@
     private void configure() throws Exception {
         InputSource is = SourceUtil.getInputSource(this.configurationFile);
 
-        final Settings settings = Core.getSettings(context);
+        final Settings settings = this.core.getSettings();
         ConfigurationBuilder builder = new ConfigurationBuilder(settings);
         Configuration conf = builder.build(is);
 

Modified: cocoon/trunk/src/java/org/apache/cocoon/bean/CocoonWrapper.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/bean/CocoonWrapper.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/bean/CocoonWrapper.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/bean/CocoonWrapper.java Thu Apr 21 13:04:01 2005
@@ -165,8 +165,6 @@
             appContext.put(Constants.CONTEXT_CONFIG_URL, conf.toURL());
             appContext.put(Constants.CONTEXT_DEFAULT_ENCODING, "ISO-8859-1");
             appContext.put(ContextHelper.CONTEXT_ROOT_URL, this.context.toURL());
-            // FIXME - add settings
-            appContext.put(Core.CONTEXT_SETTINGS, new Settings());
 
             loadClasses(classList);
 

Modified: cocoon/trunk/src/java/org/apache/cocoon/core/Core.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/Core.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/Core.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/Core.java Thu Apr 21 13:04:01 2005
@@ -25,7 +25,6 @@
 import org.apache.avalon.framework.CascadingRuntimeException;
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.components.ContextHelper;
 import org.apache.cocoon.configuration.Settings;
@@ -40,17 +39,11 @@
  * @version SVN $Id$
  * @since 2.2
  */
-public class Core
-    implements Contextualizable {
+public class Core {
 
     /** The key to lookup the component. */
     public static String ROLE = Core.class.getName();
 
-    /** Application <code>Context</code> Key for the settings. Please don't
-     * use this constant to lookup the settings object. Lookup the core
-     * component and use {@link #getSettings()} instead. */
-    public static final String CONTEXT_SETTINGS = "settings";
-
     /**
      * The cleanup threads that are invoked after the processing of a
      * request is finished.
@@ -58,7 +51,7 @@
     private static final ThreadLocal cleanup = new ThreadLocal();
 
     /** The component context. */
-    private Context context;
+    private final Context context;
 
     private final Settings settings;
     
@@ -67,13 +60,6 @@
         this.context = c;
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.avalon.framework.context.Contextualizable#contextualize(org.apache.avalon.framework.context.Context)
-     */
-    public void contextualize(Context context) throws ContextException {
-        this.context = context;
-    }
-
     public static void addCleanupTask(CleanupTask task) {
         List l = (List)cleanup.get();
         if ( l == null ) {
@@ -160,22 +146,4 @@
             throw new CascadingRuntimeException("Unable to get the cache directory from the context.", ce);
         }        
     }
-
-    /**
-     * Return the current settings.
-     * Please don't use this method directly, look up the Core component
-     * and use {@link #getSettings()} instead.
-     * @param context The component context.
-     * @return The settings.
-     * FIXME - will be removed before the release
-     */
-    public static final Settings getSettings(Context context) {
-        // the settings object is always present
-        try {
-            return (Settings)context.get(CONTEXT_SETTINGS);
-        } catch (ContextException ce) {
-            throw new CascadingRuntimeException("Unable to get the settings object from the context.", ce);
-        }
-    }
-    
 }

Modified: cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/CoreUtil.java Thu Apr 21 13:04:01 2005
@@ -107,7 +107,6 @@
 
         // create settings
         this.settings = this.createSettings();
-        this.appContext.put(Core.CONTEXT_SETTINGS, this.settings);
 
         if (this.settings.isInitClassloader()) {
             // Force context classloader so that JAXP can work correctly

Modified: cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentEnvironment.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentEnvironment.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentEnvironment.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentEnvironment.java Thu Apr 21 13:04:01 2005
@@ -22,6 +22,7 @@
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.context.Context;
 import org.apache.avalon.framework.logger.Logger;
+import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.components.ComponentInfo;
 import org.apache.cocoon.configuration.ConfigurationBuilder;
@@ -42,7 +43,8 @@
     public final RoleManager roleManager;
     public final LoggerManager loggerManager;
     private final ClassLoader classLoader;
-    
+    private Core core;
+
     public ComponentEnvironment(ClassLoader classLoader, Logger logger, RoleManager roleManager, LoggerManager loggerManager,
             Context context, ServiceManager serviceManager) {
 
@@ -60,6 +62,11 @@
         this.loggerManager = loggerManager;
         this.context = context;
         this.serviceManager = serviceManager;
+        try {
+            this.core = (Core)this.serviceManager.lookup(Core.ROLE);
+        } catch (ServiceException ignore) {
+            // this can never happen
+        }
     }
 
     public Class loadClass(String name) throws ClassNotFoundException {
@@ -73,7 +80,7 @@
         ComponentInfo ci = null;
         final InputStream is = this.classLoader.getResourceAsStream(bu.toString());
         if ( is != null ) {
-            final Settings settings = Core.getSettings(this.context);
+            final Settings settings = this.core.getSettings();
             final ConfigurationBuilder cb = new ConfigurationBuilder(settings);
             final Configuration conf = cb.build(is);
             ci = new ComponentInfo();

Modified: cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentFactory.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentFactory.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentFactory.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/container/ComponentFactory.java Thu Apr 21 13:04:01 2005
@@ -23,7 +23,10 @@
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.avalon.framework.parameters.Parameterizable;
 import org.apache.avalon.framework.parameters.Parameters;
+import org.apache.avalon.framework.service.ServiceException;
 import org.apache.cocoon.components.ComponentInfo;
+import org.apache.cocoon.configuration.Settings;
+import org.apache.cocoon.core.Core;
 
 /**
  * Factory for Avalon based components.
@@ -50,6 +53,8 @@
     protected final Method destroyMethod;
     protected final Method poolInMethod;
     protected final Method poolOutMethod;
+    protected Method configureSettingsMethod;
+    protected Core core;
 
     /**
      * Construct a new component factory for the specified component.
@@ -61,6 +66,11 @@
     public ComponentFactory( final ComponentEnvironment environment,
                              final ComponentInfo info) 
     throws Exception {
+        try {
+            this.core = (Core)environment.serviceManager.lookup(Core.ROLE);
+        } catch (ServiceException ignore) {
+            // this can never happen
+        }
         this.environment = environment;
         this.serviceInfo = info;
         
@@ -108,6 +118,11 @@
         } else {
             this.poolOutMethod = null;
         }
+        try {
+            this.configureSettingsMethod = this.serviceClass.getMethod("configure", new Class[] {Settings.class});
+        } catch (NoSuchMethodException ignore) {
+            this.configureSettingsMethod = null;
+        }
     }
     
     /**
@@ -135,6 +150,9 @@
         ContainerUtil.enableLogging(component, this.componentLogger);
         ContainerUtil.contextualize( component, this.environment.context );
         ContainerUtil.service( component, this.environment.serviceManager );
+        if ( this.configureSettingsMethod != null ) {
+            this.configureSettingsMethod.invoke( component, new Object[] {this.core.getSettings()});
+        }
         ContainerUtil.configure( component, this.serviceInfo.getConfiguration() );
 
         if( component instanceof Parameterizable ) {

Modified: cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/core/container/CoreServiceManager.java Thu Apr 21 13:04:01 2005
@@ -133,6 +133,13 @@
         // Always create a role manager, it can be filled several times either through
         // the root "roles" attribute or through loading of includes
         this.roleManager = new RoleManager(parentRoleManager);
+        
+        // get settings
+        try {
+            this.settings = ((Core)parent.lookup(Core.ROLE)).getSettings();
+        } catch (ServiceException ignore) {
+            // this can never happen!
+        }
     }
 
     //=============================================================================================
@@ -152,7 +159,6 @@
      */
     public void contextualize( final Context context ) {
         this.context = context;
-        this.settings = Core.getSettings(context);
     }
 
     /**
@@ -735,8 +741,7 @@
                 // load it and store it in the read set
                 Configuration includeConfig = null;
                 try {
-                    final Settings settings = Core.getSettings(context);
-                    ConfigurationBuilder builder = new ConfigurationBuilder(settings);
+                    ConfigurationBuilder builder = new ConfigurationBuilder(this.settings);
                     includeConfig = builder.build(src.getInputStream(), uri);
                 } catch (ConfigurationException ce) {
                     throw ce;

Modified: cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java (original)
+++ cocoon/trunk/src/java/org/apache/cocoon/serialization/AbstractTextSerializer.java Thu Apr 21 13:04:01 2005
@@ -18,13 +18,9 @@
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
-import org.apache.avalon.framework.context.Context;
-import org.apache.avalon.framework.context.ContextException;
-import org.apache.avalon.framework.context.Contextualizable;
 import org.apache.cocoon.Constants;
 import org.apache.cocoon.caching.CacheableProcessingComponent;
 import org.apache.cocoon.configuration.Settings;
-import org.apache.cocoon.core.Core;
 import org.apache.cocoon.util.ClassUtils;
 import org.apache.cocoon.util.TraxErrorHandler;
 import org.apache.cocoon.xml.AbstractXMLPipe;
@@ -60,7 +56,7 @@
  * @version CVS $Id$
  */
 public abstract class AbstractTextSerializer extends AbstractSerializer
-        implements Configurable, CacheableProcessingComponent, Contextualizable {
+        implements Configurable, CacheableProcessingComponent {
 
     /**
      * The trax <code>TransformerFactory</code> used by this serializer.
@@ -166,15 +162,11 @@
         //  }
     }
 
-    /**
-     * Uses the context to retrieve a default encoding for the serializers.
-     */
-    public void contextualize(Context context) throws ContextException {
-        final Settings s = Core.getSettings(context);
-        String defaultEncoding  = s.getFormEncoding();
+    public void configure(Settings settings) {
+        String defaultEncoding  = settings.getFormEncoding();
         if (defaultEncoding != null) {
             this.format.setProperty(OutputKeys.ENCODING, defaultEncoding);
-        }
+        }        
     }
 
     /**

Modified: cocoon/trunk/src/test/org/apache/cocoon/CocoonTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/CocoonTestCase.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/CocoonTestCase.java (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/CocoonTestCase.java Thu Apr 21 13:04:01 2005
@@ -20,8 +20,6 @@
 import org.apache.avalon.framework.configuration.DefaultConfiguration;
 import org.apache.avalon.framework.context.DefaultContext;
 import org.apache.avalon.framework.service.ServiceException;
-import org.apache.cocoon.configuration.Settings;
-import org.apache.cocoon.core.Core;
 import org.apache.cocoon.core.container.CoreServiceManager;
 import org.apache.cocoon.core.container.StandaloneServiceSelector;
 import org.apache.cocoon.core.container.ContainerTestCase;
@@ -36,10 +34,6 @@
  * @version CVS $Id: SitemapComponentTestCase.java 55427 2004-10-24 11:38:37Z cziegeler $
  */
 public abstract class CocoonTestCase extends ContainerTestCase {
-
-    protected void addContext(DefaultContext context) {
-        context.put(Core.CONTEXT_SETTINGS, new Settings());
-    }
 
     /* (non-Javadoc)
      * @see org.apache.cocoon.core.container.ContainerTestCase#addComponents(org.apache.cocoon.core.container.CocoonServiceManager)

Modified: cocoon/trunk/src/test/org/apache/cocoon/SitemapComponentTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/SitemapComponentTestCase.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/SitemapComponentTestCase.java (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/SitemapComponentTestCase.java Thu Apr 21 13:04:01 2005
@@ -40,8 +40,6 @@
 import org.apache.cocoon.components.flow.FlowHelper;
 import org.apache.cocoon.components.flow.Interpreter;
 import org.apache.cocoon.components.source.SourceResolverAdapter;
-import org.apache.cocoon.configuration.Settings;
-import org.apache.cocoon.core.Core;
 import org.apache.cocoon.core.container.CoreServiceManager;
 import org.apache.cocoon.core.container.StandaloneServiceSelector;
 import org.apache.cocoon.environment.ObjectModelHelper;
@@ -108,7 +106,6 @@
         context.put(ContextHelper.CONTEXT_REQUEST_OBJECT, request);
         context.put(ContextHelper.CONTEXT_RESPONSE_OBJECT, response);
         context.put(ContextHelper.CONTEXT_OBJECT_MODEL, objectmodel);
-        context.put(Core.CONTEXT_SETTINGS, new Settings());
     }
 
     /* (non-Javadoc)

Modified: cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java
URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java?rev=164112&r1=164111&r2=164112&view=diff
==============================================================================
--- cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java (original)
+++ cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java Thu Apr 21 13:04:01 2005
@@ -36,6 +36,9 @@
 import org.apache.avalon.framework.parameters.Parameters;
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.cocoon.configuration.Settings;
+import org.apache.cocoon.core.Core;
+import org.apache.cocoon.core.CoreUtil;
 import org.apache.cocoon.util.log.DeprecationLogger;
 
 /**
@@ -296,8 +299,12 @@
         roleManager.enableLogging( this.getLogger() );
         roleManager.configure( confRM );
 
+        // Set up root manager for Core
+        Core core = new Core(new Settings(), this.context);
+        CoreUtil.RootServiceManager rsm = new CoreUtil.RootServiceManager(null, core);
+ 
         // Set up the ComponentLocator
-        CoreServiceManager ecManager = new CoreServiceManager(null);
+        CoreServiceManager ecManager = new CoreServiceManager(rsm);
         ecManager.enableLogging( this.getLogger() );
         ecManager.contextualize( this.context );
         ecManager.setRoleManager( roleManager );



Re: svn commit: r164112 - in /cocoon: blocks/core/forms/trunk/java/org/apache/cocoon/forms/binding/ blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/ trunk/ trunk/src/java/org/apache/cocoon/ trunk/src/java/org/apache/cocoon/bean/ trunk/src/java/org/apache/cocoon/core/ trunk/src/java/org/apache/cocoon/core/container/ trunk/src/java/org/apache/cocoon/serialization/ trunk/src/test/org/apache/cocoon/ trunk/src/test/org/apache/cocoon/core/container/

Posted by Carsten Ziegeler <cz...@apache.org>.
Daniel Fagerstrom wrote:
> 
> Not that I know, but I havn't checked. I did a quick fix that helped the 
> test cases I need right now.
> 
Great, yes, this fix is the right way for now. Thanks.

Carsten
-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Re: svn commit: r164112 - in /cocoon: blocks/core/forms/trunk/java/org/apache/cocoon/forms/binding/ blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/ trunk/ trunk/src/java/org/apache/cocoon/ trunk/src/java/org/apache/cocoon/bean/ trunk/src/java/org/apache/cocoon/core/ trunk/src/java/org/apache/cocoon/core/container/ trunk/src/java/org/apache/cocoon/serialization/ trunk/src/test/org/apache/cocoon/ trunk/src/test/org/apache/cocoon/core/container/

Posted by Daniel Fagerstrom <da...@nada.kth.se>.
Carsten Ziegeler wrote:
> Sorry, that I broke something - I will look into it asap, but the
> current code of the core is not test-friendly. So I think it's better to
> refactor the code until it is more test-friendly than to make the tests
> run. And I fear this will take some time; as soon as the tests are
> running again, we see that we are finished. Apart from the tests is
> anything else broken?

Not that I know, but I havn't checked. I did a quick fix that helped the 
test cases I need right now.

I'm also refactoring the SitemapTestCase that I use for fuctional test 
to use Core and CoreUtil.

> Currently, I don't have a real roadmap I'm folling. When I have time,
> I'm just trying to clean up the core. The vision I have is to make it
> very easy to create new environments and remove all duplicate code,
> followed by making it easier to write own components and followed by
> enabling monitoring and runtime administration of the core. So if you
> want a roadmap this is all I can give you right now :)

Seem like a good plan.

> Again, sorry for breaking something.
No problem, just got a little bit irritated when I had to dive into your 
code changes instead of doing what I planned to do. OTH I learned a 
little bit more about the core and started some test case refactoring 
that I need to do sooner or later anyway.

/Daniel

Re: svn commit: r164112 - in /cocoon: blocks/core/forms/trunk/java/org/apache/cocoon/forms/binding/ blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/ trunk/ trunk/src/java/org/apache/cocoon/ trunk/src/java/org/apache/cocoon/bean/ trunk/src/java/org/apache/cocoon/core/ trunk/src/java/org/apache/cocoon/core/container/ trunk/src/java/org/apache/cocoon/serialization/ trunk/src/test/org/apache/cocoon/ trunk/src/test/org/apache/cocoon/core/container/

Posted by Carsten Ziegeler <cz...@apache.org>.
Sorry, that I broke something - I will look into it asap, but the
current code of the core is not test-friendly. So I think it's better to
refactor the code until it is more test-friendly than to make the tests
run. And I fear this will take some time; as soon as the tests are
running again, we see that we are finished. Apart from the tests is
anything else broken?

Currently, I don't have a real roadmap I'm folling. When I have time,
I'm just trying to clean up the core. The vision I have is to make it
very easy to create new environments and remove all duplicate code,
followed by making it easier to write own components and followed by
enabling monitoring and runtime administration of the core. So if you
want a roadmap this is all I can give you right now :)

Again, sorry for breaking something.

Carsten
-- 
Carsten Ziegeler - Open Source Group, S&N AG
http://www.s-und-n.de
http://www.osoco.org/weblogs/rael/

Re: svn commit: r164112 - in /cocoon: blocks/core/forms/trunk/java/org/apache/cocoon/forms/binding/ blocks/supported/portal/trunk/java/org/apache/cocoon/portlet/ trunk/ trunk/src/java/org/apache/cocoon/ trunk/src/java/org/apache/cocoon/bean/ trunk/src/java/org/apache/cocoon/core/ trunk/src/java/org/apache/cocoon/core/container/ trunk/src/java/org/apache/cocoon/serialization/ trunk/src/test/org/apache/cocoon/ trunk/src/test/org/apache/cocoon/core/container/

Posted by Daniel Fagerstrom <da...@nada.kth.se>.
cziegeler@apache.org wrote:
> Author: cziegeler
> Date: Thu Apr 21 13:04:01 2005
> New Revision: 164112
> 
> URL: http://svn.apache.org/viewcvs?rev=164112&view=rev
> Log:
> Remove the need for context object (where possible)
> Reduce default logging output during junit tests
> 
> Modified:
<snip/>
> Modified: cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java
> URL: http://svn.apache.org/viewcvs/cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java?rev=164112&r1=164111&r2=164112&view=diff
> ==============================================================================
> --- cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java (original)
> +++ cocoon/trunk/src/test/org/apache/cocoon/core/container/ContainerTestCase.java Thu Apr 21 13:04:01 2005
> @@ -36,6 +36,9 @@
>  import org.apache.avalon.framework.parameters.Parameters;
>  import org.apache.avalon.framework.service.ServiceException;
>  import org.apache.avalon.framework.service.ServiceManager;
> +import org.apache.cocoon.configuration.Settings;
> +import org.apache.cocoon.core.Core;
> +import org.apache.cocoon.core.CoreUtil;
>  import org.apache.cocoon.util.log.DeprecationLogger;
>  
>  /**
> @@ -296,8 +299,12 @@
>          roleManager.enableLogging( this.getLogger() );
>          roleManager.configure( confRM );
>  
> +        // Set up root manager for Core
> +        Core core = new Core(new Settings(), this.context);
> +        CoreUtil.RootServiceManager rsm = new CoreUtil.RootServiceManager(null, core);
> + 
>          // Set up the ComponentLocator
> -        CoreServiceManager ecManager = new CoreServiceManager(null);
> +        CoreServiceManager ecManager = new CoreServiceManager(rsm);
>          ecManager.enableLogging( this.getLogger() );
>          ecManager.contextualize( this.context );
>          ecManager.setRoleManager( roleManager );

Carsten, this brook all my the test cases for the VPCs and the block 
stuff, and probably all other test cases. Could you please run the tests 
while refactoring the Core. It is the second or third time your 
refactoring breakes my tests in the last few weeks, so it start to get 
annoying.

                              --- o0o ---

What happens is that I get this exception:

org.apache.avalon.framework.context.ContextException: Unable to resolve 
context key: org.apache.cocoon.core.Core

AFAIU there is a need to create a BootstrapEnvironment for the tests and 
  call the CoreUtil constructor with that as argument, or should it be 
done in some other way?

                              --- o0o ---

I think that the work you have done on the Core this far is very 
important and good stuff, but as Sylvain has written before, the Cocoon 
core isn't your private business, as it affects everything else. Could 
you please write a roadmap about where you are heading with your 
refactoring. The blocks stuff that I try to write, need to set up an own 
component manager and an own processor so I am dependent of core stuff. 
But it is quite hard to develop it, if the core is a moving target and I 
have no idea about where it is moving.

/Daniel