cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r441975 - /cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java
Date Sun, 10 Sep 2006 17:17:18 GMT
Author: cziegeler
Date: Sun Sep 10 10:17:17 2006
New Revision: 441975

URL: http://svn.apache.org/viewvc?view=rev&rev=441975
Log:
Fix setup of avalon components for testing

Modified:
    cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java

Modified: cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java?view=diff&rev=441975&r1=441974&r2=441975
==============================================================================
--- cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java
(original)
+++ cocoon/trunk/core/cocoon-core/src/test/java/org/apache/cocoon/core/container/ContainerTestCase.java
Sun Sep 10 10:17:17 2006
@@ -41,13 +41,16 @@
 import org.apache.cocoon.ProcessingUtil;
 import org.apache.cocoon.configuration.Settings;
 import org.apache.cocoon.configuration.impl.MutableSettings;
+import org.apache.cocoon.core.container.spring.avalon.AvalonBeanPostProcessor;
 import org.apache.cocoon.core.container.spring.avalon.AvalonElementParser;
+import org.apache.cocoon.core.container.spring.avalon.ComponentInfo;
 import org.apache.cocoon.core.container.spring.avalon.ConfigurationInfo;
 import org.apache.cocoon.core.container.spring.avalon.ConfigurationReader;
 import org.apache.cocoon.environment.mock.MockContext;
 import org.springframework.beans.factory.FactoryBean;
 import org.springframework.beans.factory.config.BeanDefinitionHolder;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
+import org.springframework.beans.factory.config.RuntimeBeanReference;
 import org.springframework.beans.factory.support.BeanDefinitionReaderUtils;
 import org.springframework.beans.factory.support.BeanDefinitionRegistry;
 import org.springframework.beans.factory.support.DefaultListableBeanFactory;
@@ -224,7 +227,13 @@
 
         // setup context
         this.contextProperties = this.setupContext( conf.getChild( "context" ) );
-
+        this.context = new DefaultContext();
+        final Iterator i = this.contextProperties.entrySet().iterator();
+        while ( i.hasNext() ) {
+            final Map.Entry current = (Map.Entry)i.next();
+            ((DefaultContext)this.context).put(current.getKey(), current.getValue());
+        }
+        ((DefaultContext)this.context).makeReadOnly();
         this.setupBeanFactory( conf.getChild( "components" ),  conf.getChild( "roles" ) );
     }
 
@@ -318,8 +327,16 @@
         this.beanFactory = new DefaultListableBeanFactory();
         this.addSettings((DefaultListableBeanFactory)this.beanFactory);
         
-        AvalonInstantiator aep = new AvalonInstantiator(this.contextProperties);
+        final AvalonInstantiator aep = new AvalonInstantiator(this.contextProperties);
         aep.createComponents(null, rolesInfo, (DefaultListableBeanFactory)this.beanFactory,
 null, new DefaultResourceLoader());
+        
+        AvalonBeanPostProcessor postProcessor = new AvalonBeanPostProcessor();
+        postProcessor.setLogger(new ConsoleLogger());
+        postProcessor.setContext(this.context);
+        postProcessor.setConfigurationInfo(rolesInfo);
+        postProcessor.setBeanFactory(this.beanFactory);
+        this.beanFactory.addBeanPostProcessor(postProcessor);
+
         ((DefaultListableBeanFactory)this.beanFactory).preInstantiateSingletons();
         this.manager = (ServiceManager)this.beanFactory.getBean(ServiceManager.class.getName());
         this.context = (Context)this.beanFactory.getBean(ProcessingUtil.CONTEXT_ROLE);



Mime
View raw message