Improve how the Metadata and Content Transform tests request their contexts, to make it possible for them to run on the smaller context

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@18853 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2010-02-25 16:49:48 +00:00
parent 6e3f8b4925
commit 0919d25ce9
5 changed files with 121 additions and 10 deletions

View File

@@ -56,11 +56,11 @@ import org.springframework.context.ApplicationContext;
*/
public abstract class AbstractMetadataExtracterTest extends TestCase
{
static {
ApplicationContextHelper.setUseLazyLoading(false);
ApplicationContextHelper.setNoAutoStart(true);
}
protected static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
/**
* This context will be fetched each time, but almost always
* will have been cached by {@link ApplicationContextHelper}
*/
protected ApplicationContext ctx;
protected static final String QUICK_TITLE = "The quick brown fox jumps over the lazy dog";
protected static final String QUICK_DESCRIPTION = "Gym class featuring a brown fox and lazy dog";
@@ -79,6 +79,10 @@ public abstract class AbstractMetadataExtracterTest extends TestCase
@Override
public void setUp() throws Exception
{
// Grab the context, which will normally have been
// cached by the ApplicationContextHelper
ctx = MetadataTestSuite.getContext();
this.mimetypeMap = (MimetypeMap) ctx.getBean("mimetypeService");
this.dictionaryService = (DictionaryService) ctx.getBean("dictionaryService");
@@ -206,13 +210,13 @@ public abstract class AbstractMetadataExtracterTest extends TestCase
}
protected void assertContains(String message, String needle, String haystack) {
protected static void assertContains(String message, String needle, String haystack) {
if(haystack.indexOf(needle) > -1) {
return;
}
fail(message);
}
protected void assertContains(String needle, String haystack) {
protected static void assertContains(String needle, String haystack) {
assertContains("'" + needle + "' wasn't found in '" + haystack + "'", needle, haystack);
}
}