You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Reinhard Poetz <re...@apache.org> on 2007/03/28 16:02:38 UTC
ContainerTestCase: How to add custom bean definitions?
Does ContainerTestCase provide some facility to add custom bean definitions
similar to the *.xtest mechanism?
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------
Re: ContainerTestCase: How to add custom bean definitions?
Posted by Reinhard Poetz <re...@apache.org>.
Reinhard Poetz wrote:
>
> Does ContainerTestCase provide some facility to add custom bean
> definitions similar to the *.xtest mechanism?
After studying the code and not finding any hint of some already existing
machanism, I added these lines to the AbstractTestCase:
+ ClassPathResource cpr = new
ClassPathResource(getClass().getName().replace('.', '/') + ".spring.xml");
+ if(cpr.exists()) {
+ this.beanFactory = new XmlBeanFactory(cpr);
+ } else {
+ this.beanFactory = new DefaultListableBeanFactory();
--
Reinhard Pötz Independent Consultant, Trainer & (IT)-Coach
{Software Engineering, Open Source, Web Applications, Apache Cocoon}
web(log): http://www.poetz.cc
--------------------------------------------------------------------