From: <fg...@us...> - 2007-09-20 10:10:04
|
Revision: 443 http://openutils.svn.sourceforge.net/openutils/?rev=443&view=rev Author: fgiust Date: 2007-09-20 03:10:04 -0700 (Thu, 20 Sep 2007) Log Message: ----------- you can now setup a custom documentReaderClass for spring initialization (needed for mule 2.0) Modified Paths: -------------- trunk/openutils-testing-testng/src/main/java/it/openutils/testing/testng/SpringTestCase.java Modified: trunk/openutils-testing-testng/src/main/java/it/openutils/testing/testng/SpringTestCase.java =================================================================== --- trunk/openutils-testing-testng/src/main/java/it/openutils/testing/testng/SpringTestCase.java 2007-09-20 08:55:37 UTC (rev 442) +++ trunk/openutils-testing-testng/src/main/java/it/openutils/testing/testng/SpringTestCase.java 2007-09-20 10:10:04 UTC (rev 443) @@ -17,6 +17,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.testng.annotations.BeforeClass; @@ -35,7 +36,7 @@ /** * Default Spring context initilization file used for tests. */ - private static final String DEFAULT_TEST_CONTEXT_FILE = "/spring-tests.xml"; + public static final String DEFAULT_TEST_CONTEXT_FILE = "/spring-tests.xml"; /** * Spring application context. @@ -58,10 +59,30 @@ if (ctx == null) { // load Spring's BeanFactory - String[] paths = {DEFAULT_TEST_CONTEXT_FILE}; - ctx = new ClassPathXmlApplicationContext(paths); + String[] paths = {DEFAULT_TEST_CONTEXT_FILE }; + ctx = new ClassPathXmlApplicationContext(paths) + { + + /** + * {@inheritDoc} + */ + @Override + protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) + { + initAppContextBeanDefinitionReader(beanDefinitionReader); + } + }; } + } + /** + * You can override this method if you need to pass a custom documentReaderClass to the spring bean definition + * reader. + * @param beanDefinitionReader XmlBeanDefinitionReader instance + */ + protected void initAppContextBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) + { + // you can subclass this method if needed } } \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |