Tweak the minimal context to hopefully work on the build machine too, and then re-enable tests + combine one suite

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@19122 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2010-03-08 14:23:51 +00:00
parent ad11a47457
commit 21b6c8cf10
9 changed files with 125 additions and 168 deletions

View File

@@ -21,6 +21,7 @@
Import of the minimal extensions and bean overrides. Import of the minimal extensions and bean overrides.
--> -->
<import resource="classpath*:alfresco/extension/dev-context.xml" /> <import resource="classpath*:alfresco/extension/dev-context.xml" />
<import resource="classpath*:alfresco/extension/test-context.xml" />
</beans> </beans>

View File

@@ -54,30 +54,17 @@ public class RepositoryStartStopTest extends TestCase
private TransactionService transactionService; private TransactionService transactionService;
private boolean writeTestWorked; private boolean writeTestWorked;
//TODO Turn this back on again public void setUp() throws Exception
public void off_setUp() throws Exception
{ {
// Ensure there's nothing kicking about // Ensure there's nothing kicking about
ApplicationContextHelper.closeApplicationContext(); ApplicationContextHelper.closeApplicationContext();
} }
//TODO Turn this back on again public void tearDown() throws Exception
public void off_tearDown() throws Exception
{ {
AuthenticationUtil.clearCurrentSecurityContext(); AuthenticationUtil.clearCurrentSecurityContext();
} }
/**
* This is a dummy test as the other tests in this class have all been temporarily
* disabled.
*/
public void testDummyTest()
{
//TODO When the other tests are re-enabled, this test can be deleted.
// Intentionally empty
}
/** /**
* Checks that the ApplicationContext cache on the * Checks that the ApplicationContext cache on the
* ApplicationContextHelper is empty * ApplicationContextHelper is empty
@@ -110,8 +97,7 @@ public class RepositoryStartStopTest extends TestCase
* Tests that we can open a context, use * Tests that we can open a context, use
* it, and then close it again without error * it, and then close it again without error
*/ */
//TODO Turn this back on again public void testOpenClose() throws Exception
public void off_testOpenClose() throws Exception
{ {
assertNoCachedApplicationContext(); assertNoCachedApplicationContext();
@@ -131,8 +117,7 @@ public class RepositoryStartStopTest extends TestCase
* a context twice without error, using it * a context twice without error, using it
* when running. * when running.
*/ */
//TODO Turn this back on again public void testOpenCloseOpenCloseNoAutostart() throws Exception
public void off_testOpenCloseOpenCloseNoAutostart() throws Exception
{ {
assertNoCachedApplicationContext(); assertNoCachedApplicationContext();

View File

@@ -32,15 +32,19 @@ import org.alfresco.repo.content.replication.ReplicatingContentStoreTest;
/** /**
* Suite for content-related tests. * Suite for content-related tests.
* *
* This includes all the tests that need a full context, the
* rest are in {@link ContentMinimalContextTestSuite}
*
* @author Derek Hulley * @author Derek Hulley
*/ */
public class ContentTestSuite extends TestSuite public class ContentFullContextTestSuite extends TestSuite
{ {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Test suite() public static Test suite()
{ {
TestSuite suite = new TestSuite(); TestSuite suite = new TestSuite();
// These tests need a full context, at least for now
suite.addTestSuite(ContentStoreCleanerTest.class); suite.addTestSuite(ContentStoreCleanerTest.class);
suite.addTestSuite(CharsetFinderTest.class); suite.addTestSuite(CharsetFinderTest.class);
suite.addTestSuite(FileContentStoreTest.class); suite.addTestSuite(FileContentStoreTest.class);

View File

@@ -0,0 +1,109 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.content;
import org.alfresco.repo.content.metadata.HtmlMetadataExtracterTest;
import org.alfresco.repo.content.metadata.MP3MetadataExtracterTest;
import org.alfresco.repo.content.metadata.MailMetadataExtracterTest;
import org.alfresco.repo.content.metadata.OfficeMetadataExtracterTest;
import org.alfresco.repo.content.metadata.OpenDocumentMetadataExtracterTest;
import org.alfresco.repo.content.metadata.OpenOfficeMetadataExtracterTest;
import org.alfresco.repo.content.metadata.PdfBoxMetadataExtracterTest;
import org.alfresco.repo.content.metadata.RFC822MetadataExtracterTest;
import org.alfresco.repo.content.transform.BinaryPassThroughContentTransformerTest;
import org.alfresco.repo.content.transform.ComplexContentTransformerTest;
import org.alfresco.repo.content.transform.ContentTransformerRegistryTest;
import org.alfresco.repo.content.transform.HtmlParserContentTransformerTest;
import org.alfresco.repo.content.transform.MailContentTransformerTest;
import org.alfresco.repo.content.transform.MediaWikiContentTransformerTest;
import org.alfresco.repo.content.transform.OpenOfficeContentTransformerTest;
import org.alfresco.repo.content.transform.PdfBoxContentTransformerTest;
import org.alfresco.repo.content.transform.PoiHssfContentTransformerTest;
import org.alfresco.repo.content.transform.RuntimeExecutableContentTransformerTest;
import org.alfresco.repo.content.transform.StringExtractingContentTransformerTest;
import org.alfresco.repo.content.transform.TextMiningContentTransformerTest;
import org.alfresco.repo.content.transform.TextToPdfContentTransformerTest;
import org.alfresco.repo.content.transform.magick.ImageMagickContentTransformerTest;
import org.alfresco.util.ApplicationContextHelper;
import org.springframework.context.ApplicationContext;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Metadata Extractor and Transform test suite
*
* @author Nick Burch
*/
public class ContentMinimalContextTestSuite extends TestSuite
{
/**
* Asks {@link ApplicationContextHelper} to give us a
* suitable, perhaps cached context for use in our tests
*/
public static ApplicationContext getContext() {
ApplicationContextHelper.setUseLazyLoading(false);
ApplicationContextHelper.setNoAutoStart(true);
return ApplicationContextHelper.getApplicationContext(
new String[] { "classpath:alfresco/minimal-context.xml" }
);
}
/**
* Creates the test suite
*
* @return the test suite
*/
public static Test suite()
{
// Setup the context
getContext();
// Off we go
TestSuite suite = new TestSuite();
// Metadata tests
suite.addTestSuite( HtmlMetadataExtracterTest.class );
suite.addTestSuite( MailMetadataExtracterTest.class );
suite.addTestSuite( MP3MetadataExtracterTest.class );
suite.addTestSuite( OfficeMetadataExtracterTest.class );
suite.addTestSuite( OpenDocumentMetadataExtracterTest.class );
suite.addTestSuite( OpenOfficeMetadataExtracterTest.class );
suite.addTestSuite( PdfBoxMetadataExtracterTest.class );
suite.addTestSuite( RFC822MetadataExtracterTest.class );
// Transform tests
suite.addTestSuite(BinaryPassThroughContentTransformerTest.class);
suite.addTestSuite(ComplexContentTransformerTest.class);
suite.addTestSuite(ContentTransformerRegistryTest.class);
suite.addTestSuite(HtmlParserContentTransformerTest.class);
suite.addTestSuite(MailContentTransformerTest.class);
suite.addTestSuite(MediaWikiContentTransformerTest.class);
suite.addTestSuite(OpenOfficeContentTransformerTest.class);
suite.addTestSuite(PdfBoxContentTransformerTest.class);
suite.addTestSuite(PoiHssfContentTransformerTest.class);
suite.addTestSuite(RuntimeExecutableContentTransformerTest.class);
suite.addTestSuite(StringExtractingContentTransformerTest.class);
suite.addTestSuite(TextMiningContentTransformerTest.class);
suite.addTestSuite(TextToPdfContentTransformerTest.class);
suite.addTestSuite(ImageMagickContentTransformerTest.class);
return suite;
}
}

View File

@@ -28,6 +28,7 @@ import java.util.Map;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
import org.alfresco.repo.content.ContentMinimalContextTestSuite;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.filestore.FileContentReader; import org.alfresco.repo.content.filestore.FileContentReader;
import org.alfresco.repo.content.filestore.FileContentWriter; import org.alfresco.repo.content.filestore.FileContentWriter;
@@ -75,7 +76,7 @@ public abstract class AbstractMetadataExtracterTest extends TestCase
{ {
// Grab the context, which will normally have been // Grab the context, which will normally have been
// cached by the ApplicationContextHelper // cached by the ApplicationContextHelper
ctx = MetadataTestSuite.getContext(); ctx = ContentMinimalContextTestSuite.getContext();
this.mimetypeMap = (MimetypeMap) ctx.getBean("mimetypeService"); this.mimetypeMap = (MimetypeMap) ctx.getBean("mimetypeService");
this.dictionaryService = (DictionaryService) ctx.getBean("dictionaryService"); this.dictionaryService = (DictionaryService) ctx.getBean("dictionaryService");

View File

@@ -1,69 +0,0 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.content.metadata;
import org.alfresco.util.ApplicationContextHelper;
import org.springframework.context.ApplicationContext;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* Metadata extractor test suite
*
* @author Nick Burch
*/
public class MetadataTestSuite extends TestSuite
{
/**
* Asks {@link ApplicationContextHelper} to give us a
* suitable, perhaps cached context for use in our tests
*/
public static ApplicationContext getContext() {
ApplicationContextHelper.setUseLazyLoading(false);
ApplicationContextHelper.setNoAutoStart(true);
return ApplicationContextHelper.getApplicationContext(
new String[] { "classpath:alfresco/minimal-context.xml" }
);
}
/**
* Creates the test suite
*
* @return the test suite
*/
public static Test suite()
{
// Setup the context
getContext();
// Off we go
TestSuite suite = new TestSuite();
suite.addTestSuite( HtmlMetadataExtracterTest.class );
suite.addTestSuite( MailMetadataExtracterTest.class );
suite.addTestSuite( MP3MetadataExtracterTest.class );
suite.addTestSuite( OfficeMetadataExtracterTest.class );
suite.addTestSuite( OpenDocumentMetadataExtracterTest.class );
suite.addTestSuite( OpenOfficeMetadataExtracterTest.class );
suite.addTestSuite( PdfBoxMetadataExtracterTest.class );
suite.addTestSuite( RFC822MetadataExtracterTest.class );
return suite;
}
}

View File

@@ -28,6 +28,7 @@ import java.util.TreeSet;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.alfresco.repo.content.ContentMinimalContextTestSuite;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.filestore.FileContentReader; import org.alfresco.repo.content.filestore.FileContentReader;
import org.alfresco.repo.content.filestore.FileContentWriter; import org.alfresco.repo.content.filestore.FileContentWriter;
@@ -85,7 +86,7 @@ public abstract class AbstractContentTransformerTest extends TestCase
protected void setUp() throws Exception protected void setUp() throws Exception
{ {
// Grab a suitably configured context // Grab a suitably configured context
ctx = TransformTestSuite.getContext(); ctx = ContentMinimalContextTestSuite.getContext();
// Grab other useful beans // Grab other useful beans
serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY); serviceRegistry = (ServiceRegistry) ctx.getBean(ServiceRegistry.SERVICE_REGISTRY);

View File

@@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.alfresco.repo.content.ContentMinimalContextTestSuite;
import org.alfresco.repo.content.MimetypeMap; import org.alfresco.repo.content.MimetypeMap;
import org.alfresco.repo.content.filestore.FileContentWriter; import org.alfresco.repo.content.filestore.FileContentWriter;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
@@ -44,7 +45,7 @@ public class RuntimeExecutableContentTransformerTest extends BaseAlfrescoTestCas
@Override @Override
protected void setUpContext() { protected void setUpContext() {
// We use a smaller context // We use a smaller context
ctx = TransformTestSuite.getContext(); ctx = ContentMinimalContextTestSuite.getContext();
} }
@Override @Override

View File

@@ -1,76 +0,0 @@
/*
* Copyright (C) 2005-2010 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.content.transform;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.alfresco.repo.content.transform.magick.ImageMagickContentTransformerTest;
import org.alfresco.util.ApplicationContextHelper;
import org.springframework.context.ApplicationContext;
/**
* Content Transformation test suite
*
* @author Roy Wetherall
*/
public class TransformTestSuite extends TestSuite
{
/**
* Asks {@link ApplicationContextHelper} to give us a
* suitable, perhaps cached context for use in our tests
*/
public static ApplicationContext getContext() {
ApplicationContextHelper.setUseLazyLoading(false);
ApplicationContextHelper.setNoAutoStart(true);
return ApplicationContextHelper.getApplicationContext(
new String[] { "classpath:alfresco/minimal-context.xml" }
);
}
/**
* Creates the test suite
*
* @return the test suite
*/
public static Test suite()
{
// Setup the context
getContext();
// Off we go
TestSuite suite = new TestSuite();
suite.addTestSuite(BinaryPassThroughContentTransformerTest.class);
suite.addTestSuite(ComplexContentTransformerTest.class);
suite.addTestSuite(ContentTransformerRegistryTest.class);
suite.addTestSuite(HtmlParserContentTransformerTest.class);
suite.addTestSuite(MailContentTransformerTest.class);
suite.addTestSuite(MediaWikiContentTransformerTest.class);
suite.addTestSuite(OpenOfficeContentTransformerTest.class);
suite.addTestSuite(PdfBoxContentTransformerTest.class);
suite.addTestSuite(PoiHssfContentTransformerTest.class);
suite.addTestSuite(RuntimeExecutableContentTransformerTest.class);
suite.addTestSuite(StringExtractingContentTransformerTest.class);
suite.addTestSuite(TextMiningContentTransformerTest.class);
suite.addTestSuite(TextToPdfContentTransformerTest.class);
suite.addTestSuite(ImageMagickContentTransformerTest.class);
return suite;
}
}