diff --git a/src/test/java/org/alfresco/AllRepositoryTestsCatalogue.java b/src/test/java/org/alfresco/AllRepositoryTestsCatalogue.java index f5672d4b1d..b46801e676 100644 --- a/src/test/java/org/alfresco/AllRepositoryTestsCatalogue.java +++ b/src/test/java/org/alfresco/AllRepositoryTestsCatalogue.java @@ -350,8 +350,8 @@ public class AllRepositoryTestsCatalogue // [classpath:alfresco/application-context.xml] - part 2 static void applicationContext_02(TestSuite suite) { - suite.addTestSuite(org.alfresco.repo.attributes.AttributeServiceTest.class); // there is a test that runs for 40s and one - // 184s + // there is a test that runs for 40s and one for 184s + suite.addTestSuite(org.alfresco.repo.attributes.AttributeServiceTest.class); // was 11 (part) suite.addTestSuite(AuditableAspectTest.class); @@ -377,13 +377,11 @@ public class AllRepositoryTestsCatalogue // was 15 (part) suite.addTestSuite(GuessMimetypeTest.class); - // suite.addTestSuite(CharsetFinderTest.class); suite.addTest(new JUnit4TestAdapter(FileContentStoreTest.class)); suite.addTest(new JUnit4TestAdapter(NoRandomAccessFileContentStoreTest.class)); suite.addTest(new JUnit4TestAdapter(ReadOnlyFileContentStoreTest.class)); - // suite.addTestSuite(MimetypeMapTest.class); suite.addTest(new JUnit4TestAdapter(RoutingContentStoreTest.class)); - + // TODO see if we can move this try { @SuppressWarnings("rawtypes") @@ -394,7 +392,6 @@ public class AllRepositoryTestsCatalogue { // Ignore } - } // [classpath:alfresco/application-context.xml] - part 3 @@ -697,55 +694,53 @@ public class AllRepositoryTestsCatalogue suite.addTestSuite(org.alfresco.repo.rendition.RenditionServiceIntegrationTest.class); } - static void applicationContext_globalIntegrationTestContext_01(TestSuite suite) + // [classpath:alfresco/application-context.xml, classpath:alfresco/test/global-integration-test-context.xml] + static void applicationContext_globalIntegrationTestContext(TestSuite suite) { - { - // [classpath:alfresco/application-context.xml, classpath:alfresco/test/global-integration-test-context.xml] + // was 09 (part) + suite.addTest(new JUnit4TestAdapter(MailActionExecuterTest.class)); + suite.addTest(new JUnit4TestAdapter(ActionServiceImpl2Test.class)); + suite.addTest(new JUnit4TestAdapter(ImporterActionExecuterTest.class)); + // was 21 (part) + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.dictionary.CustomModelServiceImplTest.class)); + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.dictionary.ValueDataTypeValidatorImplTest.class)); - // was 09 (part) - suite.addTest(new JUnit4TestAdapter(MailActionExecuterTest.class)); - suite.addTest(new JUnit4TestAdapter(ActionServiceImpl2Test.class)); - suite.addTest(new JUnit4TestAdapter(ImporterActionExecuterTest.class)); - // was 21 (part) - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.dictionary.CustomModelServiceImplTest.class)); - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.dictionary.ValueDataTypeValidatorImplTest.class)); + // was 23 (part) + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.download.DownloadServiceIntegrationTest.class)); + // was 27 + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.forum.CommentsTest.class)); + // was 29 (part) + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.jscript.ScriptNodeTest.class)); + // was 38 (part) + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.preference.PreferenceServiceImplTest.class)); - // was 23 (part) - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.download.DownloadServiceIntegrationTest.class)); - // was 27 - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.forum.CommentsTest.class)); - // was 29 (part) - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.jscript.ScriptNodeTest.class)); - // was 38 (part) - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.preference.PreferenceServiceImplTest.class)); + // was 42 (part) + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.rule.MiscellaneousRulesTest.class)); + // was 44 + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.rule.RuleServiceIntegrationTest.class)); - // was 42 (part) - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.rule.MiscellaneousRulesTest.class)); - // was 44 - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.rule.RuleServiceIntegrationTest.class)); // fails locally even - // on - // its own - // was 47 (part) - suite.addTest(new JUnit4TestAdapter(ResetPasswordServiceImplTest.class)); - // was 51 - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.subscriptions.SubscriptionServiceActivitiesTest.class)); - // was 63 (part) - suite.addTest(new JUnit4TestAdapter(org.alfresco.util.test.junitrules.AlfrescoPersonTest.class)); - // the following test only passes on a clean DB - suite.addTest(new JUnit4TestAdapter(org.alfresco.util.test.junitrules.TemporaryNodesTest.class)); + // was 47 (part) + suite.addTest(new JUnit4TestAdapter(ResetPasswordServiceImplTest.class)); + // was 51 + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.subscriptions.SubscriptionServiceActivitiesTest.class)); + // was 63 (part) + suite.addTest(new JUnit4TestAdapter(org.alfresco.util.test.junitrules.AlfrescoPersonTest.class)); + // the following test only passes on a clean DB + suite.addTest(new JUnit4TestAdapter(org.alfresco.util.test.junitrules.TemporaryNodesTest.class)); - // was 66 (part) - suite.addTest( - new JUnit4TestAdapter(org.alfresco.repo.search.impl.solr.facet.SolrFacetQueriesDisplayHandlersTest.class)); - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.search.impl.solr.facet.SolrFacetServiceImplTest.class)); + // was 66 (part) + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.search.impl.solr.facet.SolrFacetQueriesDisplayHandlersTest.class)); + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.search.impl.solr.facet.SolrFacetServiceImplTest.class)); - // was 28 (part) - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.invitation.InvitationCleanupTest.class)); - // was 40 (part) - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.quickshare.QuickShareServiceIntegrationTest.class)); - suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.remotecredentials.RemoteCredentialsServicesTest.class)); - } + // was 28 (part) + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.invitation.InvitationCleanupTest.class)); + // was 40 (part) + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.quickshare.QuickShareServiceIntegrationTest.class)); + suite.addTest(new JUnit4TestAdapter(org.alfresco.repo.remotecredentials.RemoteCredentialsServicesTest.class)); + } + static void applicationContext_Combinations1(TestSuite suite) + { // [classpath:alfresco/application-context.xml, classpath:org/alfresco/repo/site/site-custom-context.xml] { // pass - slow 54s - site-custom-context.xml overrides siteService_permissionBootstrap - @@ -853,7 +848,20 @@ public class AllRepositoryTestsCatalogue suite.addTest(new JUnit4TestAdapter(org.alfresco.util.test.junitrules.TemporarySitesTest.class)); } } -//TODO + + // [classpath:alfresco/application-context.xml, classpath:tenant/mt-*context.xml] + static void applicationContext_mtAllContext_56(TestSuite suite) + { + // pass - slow 182s - + // not sure what to say about the context files mt-*-context.xml + // it may be safe - at the end of + // was 56 (part) + suite.addTestSuite(org.alfresco.repo.tenant.MultiTDemoTest.class); + + // was 61 (part) + suite.addTestSuite(ActivitiMultitenantWorkflowTest.class); + } + // [classpath:alfresco/application-context.xml, classpath:cache-test/cache-test-context.xml] static void applicationContext_cacheTestContext_14(TestSuite suite) { @@ -885,29 +893,18 @@ public class AllRepositoryTestsCatalogue suite.addTestSuite(org.alfresco.repo.subscriptions.SubscriptionServiceImplTest.class); } - // [classpath:alfresco/application-context.xml, classpath:tenant/mt-*context.xml] - static void applicationContext_mtAllContext_56(TestSuite suite) - { - // pass - slow 182s - - // not sure what to say about the context files mt-*-context.xml - // it may be safe - at the end of - // was 56 (part) - suite.addTestSuite(org.alfresco.repo.tenant.MultiTDemoTest.class); - - // was 61 (part) - suite.addTestSuite(ActivitiMultitenantWorkflowTest.class); - } - // [classpath:**/virtualization-test-context.xml, classpath:alfresco/application-context.xml] static void virtualizationTestContext_applicationContext_70(TestSuite suite) { + // pass - 16s - safe for merge // virtualization-test-context.xml two beans defined that only seem to be used in tests suite.addTest(org.alfresco.repo.virtual.VirtualizationIntegrationTestSuite.suite()); + } -// TODO until here + // TODO until here // ------------------------------------application context until here ------------------- - + /** * * various tests that do use context files but do not fit into other main context files patterns diff --git a/src/test/java/org/alfresco/Repository100TestSuite_ApplicationContext_GlobalIntegrationTestContext.java b/src/test/java/org/alfresco/Repository100TestSuite_ApplicationContext_Combinations1.java similarity index 87% rename from src/test/java/org/alfresco/Repository100TestSuite_ApplicationContext_GlobalIntegrationTestContext.java rename to src/test/java/org/alfresco/Repository100TestSuite_ApplicationContext_Combinations1.java index 5a72547ec4..0c87540563 100644 --- a/src/test/java/org/alfresco/Repository100TestSuite_ApplicationContext_GlobalIntegrationTestContext.java +++ b/src/test/java/org/alfresco/Repository100TestSuite_ApplicationContext_Combinations1.java @@ -28,12 +28,13 @@ package org.alfresco; import junit.framework.Test; import junit.framework.TestSuite; -public class Repository100TestSuite_ApplicationContext_GlobalIntegrationTestContext extends TestSuite +public class Repository100TestSuite_ApplicationContext_Combinations1 extends TestSuite { public static Test suite() { TestSuite suite = new TestSuite(); - AllRepositoryTestsCatalogue.applicationContext_globalIntegrationTestContext_01(suite); + AllRepositoryTestsCatalogue.applicationContext_globalIntegrationTestContext(suite); + AllRepositoryTestsCatalogue.applicationContext_Combinations1(suite); return suite; } } diff --git a/src/test/java/org/alfresco/Repository101TestSuite_ApplicationContext_Combinations2.java b/src/test/java/org/alfresco/Repository101TestSuite_ApplicationContext_Combinations2.java new file mode 100644 index 0000000000..0ac75c8125 --- /dev/null +++ b/src/test/java/org/alfresco/Repository101TestSuite_ApplicationContext_Combinations2.java @@ -0,0 +1,46 @@ +/* + * #%L + * Alfresco Repository + * %% + * Copyright (C) 2005 - 2017 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * + * 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 . + * #L% + */ +package org.alfresco; + +import junit.framework.Test; +import junit.framework.TestSuite; + +public class Repository101TestSuite_ApplicationContext_Combinations2 extends TestSuite +{ + public static Test suite() + { + TestSuite suite = new TestSuite(); + + //any other order may lead to failing tests + AllRepositoryTestsCatalogue.virtualizationTestContext_applicationContext_70(suite); + AllRepositoryTestsCatalogue.applicationContext_testSubscriptionsContext_52(suite); + AllRepositoryTestsCatalogue.applicationContext_openCmisContext_07(suite); + AllRepositoryTestsCatalogue.applicationContext_cacheTestContext_14(suite); + AllRepositoryTestsCatalogue.applicationContext_mtAllContext_56(suite); + + return suite; + } +} diff --git a/src/test/java/org/alfresco/opencmis/OpenCmisLocalTest.java b/src/test/java/org/alfresco/opencmis/OpenCmisLocalTest.java index 0d26bf4ace..a8e2617192 100644 --- a/src/test/java/org/alfresco/opencmis/OpenCmisLocalTest.java +++ b/src/test/java/org/alfresco/opencmis/OpenCmisLocalTest.java @@ -99,7 +99,7 @@ public class OpenCmisLocalTest extends TestCase public static final String[] CONFIG_LOCATIONS = new String[] { "classpath:alfresco/application-context.xml", "classpath:opencmis/opencmistest-context.xml" }; - private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS); + private static ApplicationContext ctx; private static final String BEAN_NAME_AUTHENTICATION_COMPONENT = "authenticationComponent"; private static final String MIME_PLAIN_TEXT = "text/plain"; private TempStoreOutputStreamFactory streamFactory; @@ -113,11 +113,12 @@ public class OpenCmisLocalTest extends TestCase */ public static class TestCmisServiceFactory extends AbstractServiceFactory { - private static AlfrescoCmisServiceFactory serviceFactory = (AlfrescoCmisServiceFactory) ctx.getBean("CMISServiceFactory"); + private static AlfrescoCmisServiceFactory serviceFactory; @Override public void init(Map parameters) - { - serviceFactory.init(parameters); + { + serviceFactory = (AlfrescoCmisServiceFactory) ctx.getBean("CMISServiceFactory"); + serviceFactory.init(parameters); } @Override @@ -153,7 +154,8 @@ public class OpenCmisLocalTest extends TestCase } public void setUp() throws Exception - { + { + ctx = ApplicationContextHelper.getApplicationContext(CONFIG_LOCATIONS); File tempDir = new File(TempFileProvider.getTempDir(), GUID.generate()); this.streamFactory = TempStoreOutputStreamFactory.newInstance(tempDir, 1024, 1024, false); this.eventPublisher = (EventPublisherForTestingOnly) ctx.getBean("eventPublisher"); diff --git a/src/test/java/org/alfresco/repo/cache/CacheTest.java b/src/test/java/org/alfresco/repo/cache/CacheTest.java index cdc22f54e5..92b6c5e14c 100644 --- a/src/test/java/org/alfresco/repo/cache/CacheTest.java +++ b/src/test/java/org/alfresco/repo/cache/CacheTest.java @@ -56,10 +56,7 @@ import org.springframework.context.ApplicationContext; @Category(OwnJVMTestsCategory.class) public class CacheTest extends TestCase { - private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext( - new String[] { - "classpath:cache-test/cache-test-context.xml", - ApplicationContextHelper.CONFIG_LOCATIONS[0]}); + private ApplicationContext ctx; private ServiceRegistry serviceRegistry; private SimpleCache objectCache; @@ -72,7 +69,9 @@ public class CacheTest extends TestCase @SuppressWarnings("unchecked") @Override public void setUp() throws Exception - { + { + ctx = ApplicationContextHelper.getApplicationContext( + new String[] { "classpath:cache-test/cache-test-context.xml", ApplicationContextHelper.CONFIG_LOCATIONS[0] }); if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE) { fail("A transaction is still running"); diff --git a/src/test/java/org/alfresco/repo/subscriptions/SubscriptionServiceImplTest.java b/src/test/java/org/alfresco/repo/subscriptions/SubscriptionServiceImplTest.java index 100346589e..1beb950c36 100644 --- a/src/test/java/org/alfresco/repo/subscriptions/SubscriptionServiceImplTest.java +++ b/src/test/java/org/alfresco/repo/subscriptions/SubscriptionServiceImplTest.java @@ -69,7 +69,7 @@ public class SubscriptionServiceImplTest extends TestCase private UserTransaction txn; - protected ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(CONTEXTS); + protected ApplicationContext ctx; protected TransactionService transactionService; protected SubscriptionService subscriptionService; protected PersonService personService; @@ -78,7 +78,8 @@ public class SubscriptionServiceImplTest extends TestCase @Override public void setUp() throws Exception - { + { + ctx = ApplicationContextHelper.getApplicationContext(CONTEXTS); // Get the required services transactionService = (TransactionService) ctx.getBean("TransactionService"); subscriptionService = (SubscriptionService) ctx.getBean("SubscriptionService"); diff --git a/src/test/java/org/alfresco/repo/tenant/MultiTDemoTest.java b/src/test/java/org/alfresco/repo/tenant/MultiTDemoTest.java index 9bee532d27..4bd11b5ad9 100644 --- a/src/test/java/org/alfresco/repo/tenant/MultiTDemoTest.java +++ b/src/test/java/org/alfresco/repo/tenant/MultiTDemoTest.java @@ -107,9 +107,7 @@ public class MultiTDemoTest extends TestCase { private static Log logger = LogFactory.getLog(MultiTDemoTest.class); - private static ApplicationContext ctx = new ClassPathXmlApplicationContext( - new String[] {ApplicationContextHelper.CONFIG_LOCATIONS[0], "classpath:tenant/mt-*context.xml"} - ); + private ApplicationContext ctx; private NodeService nodeService; private NodeArchiveService nodeArchiveService; @@ -184,7 +182,9 @@ public class MultiTDemoTest extends TestCase protected void setUp() throws Exception { super.setUp(); - + ctx = new ClassPathXmlApplicationContext( + new String[] { ApplicationContextHelper.CONFIG_LOCATIONS[0], "classpath:tenant/mt-*context.xml" }); + nodeService = (NodeService) ctx.getBean("NodeService"); nodeArchiveService = (NodeArchiveService) ctx.getBean("nodeArchiveService"); namespaceService = (NamespaceService) ctx.getBean("NamespaceService");