BaseSpringTest uses ApplicationContextHelper, which now ensures that the context is only started once.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@5727 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2007-05-19 05:42:57 +00:00
parent d1a5583b38
commit d69da227ca

View File

@@ -26,6 +26,7 @@ package org.alfresco.util;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.SessionFactory; import org.hibernate.SessionFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.orm.hibernate3.SessionFactoryUtils; import org.springframework.orm.hibernate3.SessionFactoryUtils;
import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests; import org.springframework.test.AbstractTransactionalDataSourceSpringContextTests;
@@ -86,6 +87,7 @@ public abstract class BaseSpringTest extends AbstractTransactionalDataSourceSpri
* *
* @return an array containing the config locations * @return an array containing the config locations
*/ */
@Override
protected String[] getConfigLocations() protected String[] getConfigLocations()
{ {
if (logger.isDebugEnabled()) if (logger.isDebugEnabled())
@@ -94,4 +96,13 @@ public abstract class BaseSpringTest extends AbstractTransactionalDataSourceSpri
} }
return ApplicationContextHelper.CONFIG_LOCATIONS; return ApplicationContextHelper.CONFIG_LOCATIONS;
} }
/**
* Ignores the key and loads the {@link ApplicationContextHelper application context}.
*/
@Override
protected ConfigurableApplicationContext loadContext(Object key) throws Exception
{
return (ConfigurableApplicationContext) ApplicationContextHelper.getApplicationContext();
}
} }