From cd4983f8fa6c1e20bf23925ab8d28a7314d52e6f Mon Sep 17 00:00:00 2001 From: Samuel Langlois Date: Wed, 26 Sep 2012 17:30:57 +0000 Subject: [PATCH] JDK7: re-enable disabled test methods, and make sure JUnit executes them in the order of the source file git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@42061 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/audit/access/AccessAuditorTest.java | 41 +++++++------- .../dictionary/types/period/PeriodTest.java | 39 +++++++------ .../repo/i18n/MessageServiceImplTest.java | 21 ++++--- .../HomeFolderProviderSynchronizerTest.java | 55 ++++++++++--------- .../alfresco/repo/tenant/MultiTDemoTest.java | 47 ++++++++-------- .../repo/usage/RepoUsageComponentTest.java | 15 +++-- 6 files changed, 118 insertions(+), 100 deletions(-) diff --git a/source/java/org/alfresco/repo/audit/access/AccessAuditorTest.java b/source/java/org/alfresco/repo/audit/access/AccessAuditorTest.java index cd8135ef48..43566ad097 100644 --- a/source/java/org/alfresco/repo/audit/access/AccessAuditorTest.java +++ b/source/java/org/alfresco/repo/audit/access/AccessAuditorTest.java @@ -61,7 +61,9 @@ import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ComparisonFailure; +import org.junit.FixMethodOrder; import org.junit.Test; +import org.junit.runners.MethodSorters; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; import org.springframework.context.ApplicationContext; @@ -71,6 +73,7 @@ import org.springframework.context.ApplicationContext; * * @author Alan Davis */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class AccessAuditorTest { // Integration test environment @@ -274,7 +277,7 @@ public class AccessAuditorTest } @Test - public final void testOnCreateNodeAndOnUpdateProperties() throws Exception + public final void test01OnCreateNodeAndOnUpdateProperties() throws Exception { newContent(homeFolder, "content4"); @@ -291,7 +294,7 @@ public class AccessAuditorTest } @Test - public final void testOnCopyComplete() throws Exception + public final void test02OnCopyComplete() throws Exception { serviceRegistry.getFileFolderService().copy(content2, folder1, null); // keep leaf name @@ -313,7 +316,7 @@ public class AccessAuditorTest } @Test - public final void testOnCopyCompleteAndNewName() throws Exception + public final void test03OnCopyCompleteAndNewName() throws Exception { serviceRegistry.getFileFolderService().copy(content2, folder1, "newName1"); @@ -334,8 +337,8 @@ public class AccessAuditorTest assertEquals("cm:content", auditMap.get("type")); } - //@Test - public final void xtestOnMoveNode() throws Exception + @Test + public final void test04OnMoveNode() throws Exception { serviceRegistry.getNodeService().moveNode(content3, folder1, ContentModel.ASSOC_CONTAINS, null); // keep leaf name @@ -353,8 +356,8 @@ public class AccessAuditorTest assertEquals("cm:content", auditMap.get("type")); } - //@Test - public final void xtestOnMoveNodeAndNewName() throws Exception + @Test + public final void test05OnMoveNodeAndNewName() throws Exception { serviceRegistry.getNodeService().moveNode(content3, folder1, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "newName2")); @@ -371,7 +374,7 @@ public class AccessAuditorTest } @Test - public final void testBeforeDeleteNode() throws Exception + public final void test06BeforeDeleteNode() throws Exception { serviceRegistry.getNodeService().deleteNode(content0); @@ -387,7 +390,7 @@ public class AccessAuditorTest } @Test - public final void testOnAddAspect() throws Exception + public final void test07OnAddAspect() throws Exception { serviceRegistry.getNodeService().addAspect(content1, ContentModel.ASPECT_AUTHOR, null); serviceRegistry.getNodeService().addAspect(content1, ContentModel.ASPECT_OWNABLE, null); @@ -407,7 +410,7 @@ public class AccessAuditorTest } @Test - public final void testOnRemoveAspect() throws Exception + public final void test08OnRemoveAspect() throws Exception { serviceRegistry.getNodeService().removeAspect(content1, ContentModel.ASPECT_AUTHOR); @@ -424,8 +427,8 @@ public class AccessAuditorTest assertEquals("cm:content", auditMap.get("type")); } - //@Test - public final void xtestOnContentUpdate() throws Exception + @Test + public final void test09OnContentUpdate() throws Exception { ContentWriter writer = serviceRegistry.getContentService().getWriter(content1, ContentModel.TYPE_CONTENT, true); writer.putContent("The cow jumped over the moon."); @@ -443,7 +446,7 @@ public class AccessAuditorTest } @Test - public final void testOnContentRead() throws Exception + public final void test10OnContentRead() throws Exception { serviceRegistry.getContentService().getReader(content1, ContentModel.TYPE_CONTENT); @@ -459,7 +462,7 @@ public class AccessAuditorTest } @Test - public final void testOnCreateVersion() throws Exception + public final void test11OnCreateVersion() throws Exception { Map versionProperties = getVersionProperties(); serviceRegistry.getVersionService().createVersion(content1, versionProperties); @@ -479,7 +482,7 @@ public class AccessAuditorTest } @Test - public final void testOnCheckOut() throws Exception + public final void test12OnCheckOut() throws Exception { workingCopyNodeRef = serviceRegistry.getCheckOutCheckInService().checkout(content1); @@ -512,8 +515,8 @@ public class AccessAuditorTest assertEquals("cm:content", workMap.get("type")); } - //@Test - public final void xtestOnCheckIn() throws Exception + @Test + public final void test13OnCheckIn() throws Exception { Map checkinProperties = new HashMap(); checkinProperties.put(Version.PROP_DESCRIPTION, null); @@ -547,8 +550,8 @@ public class AccessAuditorTest assertEquals("cm:content", origMap.get("type")); } - //@Test - public final void xtestOnCancelCheckOut() throws Exception + @Test + public final void test14OnCancelCheckOut() throws Exception { workingCopyNodeRef = serviceRegistry.getCheckOutCheckInService().checkout(content1); txn.commit(); diff --git a/source/java/org/alfresco/repo/dictionary/types/period/PeriodTest.java b/source/java/org/alfresco/repo/dictionary/types/period/PeriodTest.java index e5fbf63b12..ec69fb84d0 100644 --- a/source/java/org/alfresco/repo/dictionary/types/period/PeriodTest.java +++ b/source/java/org/alfresco/repo/dictionary/types/period/PeriodTest.java @@ -30,12 +30,15 @@ import org.alfresco.service.cmr.repository.Period; import org.alfresco.service.cmr.repository.PeriodProvider; import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.CachingDateFormat; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; /** * Tests for period implementations - persistence and search is tested elsewhere * * @author andyh */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class PeriodTest extends TestCase { @@ -49,7 +52,7 @@ public class PeriodTest extends TestCase /** * "none" */ - public void testNoPeriod() + public void test01NoPeriod() { assertTrue(Period.getProviderNames().contains(NoPeriod.PERIOD_TYPE)); Period period = new Period(NoPeriod.PERIOD_TYPE); @@ -69,7 +72,7 @@ public class PeriodTest extends TestCase /** * Days */ - public void testDays() + public void test02Days() { assertTrue(Period.getProviderNames().contains(Days.PERIOD_TYPE)); Period period = new Period(Days.PERIOD_TYPE); @@ -112,7 +115,7 @@ public class PeriodTest extends TestCase /** * Weeks */ - public void testWeeks() + public void test03Weeks() { assertTrue(Period.getProviderNames().contains(Weeks.PERIOD_TYPE)); Period period = new Period(Weeks.PERIOD_TYPE); @@ -155,7 +158,7 @@ public class PeriodTest extends TestCase /** * Months */ - public void testMonths() + public void test04Months() { assertTrue(Period.getProviderNames().contains(Months.PERIOD_TYPE)); Period period = new Period(Months.PERIOD_TYPE); @@ -198,7 +201,7 @@ public class PeriodTest extends TestCase /** * Quarters */ - public void testQuarters() + public void test05Quarters() { assertTrue(Period.getProviderNames().contains(Quarters.PERIOD_TYPE)); Period period = new Period(Quarters.PERIOD_TYPE); @@ -241,7 +244,7 @@ public class PeriodTest extends TestCase /** * Years */ - public void testYears() + public void test06Years() { assertTrue(Period.getProviderNames().contains(Years.PERIOD_TYPE)); Period period = new Period(Years.PERIOD_TYPE); @@ -284,7 +287,7 @@ public class PeriodTest extends TestCase /** * EndOfMonth */ - public void testEndOfMonth() + public void test07EndOfMonth() { assertTrue(Period.getProviderNames().contains(EndOfMonth.PERIOD_TYPE)); Period period = new Period(EndOfMonth.PERIOD_TYPE); @@ -330,7 +333,7 @@ public class PeriodTest extends TestCase /** * EndOfYear */ - public void testEndOfYear() + public void test08EndOfYear() { assertTrue(Period.getProviderNames().contains(EndOfYear.PERIOD_TYPE)); Period period = new Period(EndOfYear.PERIOD_TYPE); @@ -378,7 +381,7 @@ public class PeriodTest extends TestCase * * @throws ParseException */ - public void testEndOfQuarter() throws ParseException + public void test09EndOfQuarter() throws ParseException { PeriodProvider provider = Period.getProvider(EndOfQuarter.PERIOD_TYPE); assertEquals(provider.getDefaultExpression(), "1"); @@ -495,7 +498,7 @@ public class PeriodTest extends TestCase /** * End of F Month For 1 Oct this is the same as month */ - public void xtestEndOfDefaultFinancialMonth() + public void test10EndOfDefaultFinancialMonth() { assertTrue(Period.getProviderNames().contains(EndOfFinancialMonth.PERIOD_TYPE)); Period period = new Period(EndOfFinancialMonth.PERIOD_TYPE); @@ -543,7 +546,7 @@ public class PeriodTest extends TestCase * * @throws ParseException */ - public void testEndOfDefaultFinancialYear() throws ParseException + public void test11EndOfDefaultFinancialYear() throws ParseException { PeriodProvider provider = Period.getProvider(EndOfFinancialYear.PERIOD_TYPE); assertEquals(provider.getDefaultExpression(), "1"); @@ -577,7 +580,7 @@ public class PeriodTest extends TestCase * * @throws ParseException */ - public void xtestEndOfDefaultFinancialQuarter() throws ParseException + public void test12EndOfDefaultFinancialQuarter() throws ParseException { PeriodProvider provider = Period.getProvider(EndOfFinancialQuarter.PERIOD_TYPE); assertEquals(provider.getDefaultExpression(), "1"); @@ -630,7 +633,7 @@ public class PeriodTest extends TestCase * * @throws ParseException */ - public void testEndOfUKTaxYear() throws ParseException + public void test13EndOfUKTaxYear() throws ParseException { PeriodProvider provider = Period.getProvider(EndOfFinancialYear.PERIOD_TYPE); assertEquals(provider.getDefaultExpression(), "1"); @@ -667,7 +670,7 @@ public class PeriodTest extends TestCase * * @throws ParseException */ - public void testEndOfUKTaxQuarter() throws ParseException + public void test14EndOfUKTaxQuarter() throws ParseException { PeriodProvider provider = Period.getProvider(EndOfFinancialQuarter.PERIOD_TYPE); assertEquals(provider.getDefaultExpression(), "1"); @@ -723,7 +726,7 @@ public class PeriodTest extends TestCase * * @throws ParseException */ - public void testEndOfUKTaxMonth() throws ParseException + public void test15EndOfUKTaxMonth() throws ParseException { PeriodProvider provider = Period.getProvider(EndOfFinancialMonth.PERIOD_TYPE); assertEquals(provider.getDefaultExpression(), "1"); @@ -834,7 +837,7 @@ public class PeriodTest extends TestCase * Cron * @throws ParseException */ - public void testCron() throws ParseException + public void test16Cron() throws ParseException { PeriodProvider provider = Period.getProvider(Cron.PERIOD_TYPE); assertEquals(provider.getDefaultExpression(), "59 59 23 * * ?"); @@ -857,7 +860,7 @@ public class PeriodTest extends TestCase * XMLDuration * @throws ParseException */ - public void testXMLDuration() throws ParseException + public void test17XMLDuration() throws ParseException { PeriodProvider provider = Period.getProvider(XMLDuration.PERIOD_TYPE); assertEquals(provider.getDefaultExpression(), "P1D"); @@ -879,7 +882,7 @@ public class PeriodTest extends TestCase /** * Test a missing expression, ensure 1 is used as the default */ - public void testMissingExpression() + public void test18MissingExpression() { assertTrue(Period.getProviderNames().contains(Days.PERIOD_TYPE)); Date now = new Date(); diff --git a/source/java/org/alfresco/repo/i18n/MessageServiceImplTest.java b/source/java/org/alfresco/repo/i18n/MessageServiceImplTest.java index e64e20a4c2..d92cfb1894 100644 --- a/source/java/org/alfresco/repo/i18n/MessageServiceImplTest.java +++ b/source/java/org/alfresco/repo/i18n/MessageServiceImplTest.java @@ -47,6 +47,8 @@ import org.alfresco.service.namespace.NamespaceService; import org.alfresco.service.namespace.QName; import org.alfresco.service.transaction.TransactionService; import org.alfresco.util.ApplicationContextHelper; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; import org.springframework.context.ApplicationContext; import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; @@ -55,6 +57,7 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver; * Message Service unit tests * */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class MessageServiceImplTest extends TestCase implements MessageDeployer { private static ApplicationContext applicationContext = ApplicationContextHelper.getApplicationContext(); @@ -198,7 +201,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer /** * Test the set and get methods */ - public void testSetAndGet() + public void test1SetAndGet() { // Check that the default locale is returned assertEquals(Locale.getDefault(), messageService.getLocale()); @@ -215,7 +218,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer /** * Test get message from repository */ - public void testGetMessagesLoadedFromRepo() throws Exception + public void test2GetMessagesLoadedFromRepo() throws Exception { setupRepo(); @@ -233,7 +236,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer /** * Test getting a parameterised message from repository */ - public void testGetMessagesWithParamsLoadedFromRepo() throws Exception + public void test3GetMessagesWithParamsLoadedFromRepo() throws Exception { setupRepo(); @@ -252,7 +255,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer /** * Test get message from classpath */ - public void testGetMessagesLoadedFromClasspath() throws Exception + public void test4GetMessagesLoadedFromClasspath() throws Exception { // Check with no bundles loaded assertNull(messageService.getMessage(MSG_NO)); @@ -268,7 +271,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer /** * Test getting a parameterised message from classpath */ - public void testGetMessagesWithParamsLoadedFromClasspath() throws Exception + public void test5GetMessagesWithParamsLoadedFromClasspath() throws Exception { // Check with no bundles loaded assertNull(messageService.getMessage(MSG_PARAMS, new Object[]{PARAM_VALUE})); @@ -284,7 +287,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer /** * Test register bundle (using a repository location) with uninitialised cache */ - public void testRegisterBundleFromRepo() throws Exception + public void test6RegisterBundleFromRepo() throws Exception { setupRepo(); @@ -300,7 +303,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer /** * Test register bundle (using a classpath location) with uninitialised cache */ - public void testRegisterBundleFromClasspath() throws Exception + public void test7RegisterBundleFromClasspath() throws Exception { // Register the bundle messageService.registerResourceBundle(BASE_RESOURCE_CLASSPATH + BASE_BUNDLE_NAME); @@ -314,7 +317,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer /** * Test forced reset */ - public void xtestReset() throws Exception + public void test8Reset() throws Exception { // Check with no bundles loaded assertNull(messageService.getMessage(MSG_YES)); @@ -339,7 +342,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer messageService.registerResourceBundle(BASE_RESOURCE_CLASSPATH + BASE_BUNDLE_NAME); } - public void testLocaleMatching() + public void test9LocaleMatching() { Set options = new HashSet(13); options.add(Locale.FRENCH); // fr diff --git a/source/java/org/alfresco/repo/security/person/HomeFolderProviderSynchronizerTest.java b/source/java/org/alfresco/repo/security/person/HomeFolderProviderSynchronizerTest.java index a9131de788..0e3c6f3a26 100644 --- a/source/java/org/alfresco/repo/security/person/HomeFolderProviderSynchronizerTest.java +++ b/source/java/org/alfresco/repo/security/person/HomeFolderProviderSynchronizerTest.java @@ -60,7 +60,9 @@ import org.junit.After; import org.junit.Before; import org.junit.BeforeClass; import org.junit.ComparisonFailure; +import org.junit.FixMethodOrder; import org.junit.Test; +import org.junit.runners.MethodSorters; import org.springframework.context.ApplicationContext; /** @@ -68,6 +70,7 @@ import org.springframework.context.ApplicationContext; * * @author Alan Davis */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class HomeFolderProviderSynchronizerTest { private static final QName PROP_PARENT_PATH = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "parentPath"); @@ -601,7 +604,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testCorrectLocation() throws Exception + public void test01CorrectLocation() throws Exception { createUser("te", "tess"); @@ -611,7 +614,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testCreateParentFolder() throws Exception + public void test02CreateParentFolder() throws Exception { createUser("", "fred"); @@ -621,7 +624,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testNotEnabled() throws Exception + public void test03NotEnabled() throws Exception { createUser("", "fred"); homeFolderProviderSynchronizer.setEnabled("false"); @@ -636,7 +639,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testHomeFolderNotYetCreated() throws Exception + public void test04HomeFolderNotYetCreated() throws Exception { NodeRef person = createUser("", "fred", largeHomeFolderProviderName, false); @@ -653,7 +656,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testCreateMultipleParentFolders() throws Exception + public void test05CreateMultipleParentFolders() throws Exception { largeHomeFolderProvider.setPattern("^(.?)(.?)(.?)(.?)(.?)"); @@ -669,7 +672,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testMoveToRoot() throws Exception + public void test06MoveToRoot() throws Exception { // i.e. there are no parent folders after the sync largeHomeFolderProvider.setPattern(""); @@ -682,7 +685,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testRemoveEmptyParents() throws Exception + public void test07RemoveEmptyParents() throws Exception { createUser("a/bb/ccc", "peter"); @@ -693,7 +696,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testKeepEmptyParents() throws Exception + public void test08KeepEmptyParents() throws Exception { createUser("a/bb/ccc", "peter"); homeFolderProviderSynchronizer.setKeepEmptyParents("true"); @@ -706,7 +709,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testKeepNonEmptyParents() throws Exception + public void test09KeepNonEmptyParents() throws Exception { createUser("a/bb/ccc", "peter"); createFolder("a/bb/ddd"); @@ -719,7 +722,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testPathAlreadyInUseByFolder() throws Exception + public void test10PathAlreadyInUseByFolder() throws Exception { createUser("", "fred"); createFolder("fr"); @@ -730,7 +733,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testPathAlreadyInUseByContent() throws Exception + public void test11PathAlreadyInUseByContent() throws Exception { System.out.println("testPathAlreadyInUseByContent: EXPECT TO SEE AN EXCEPTION IN THE LOG ======================== "); @@ -745,7 +748,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testPathInUseByUser() throws Exception + public void test12PathInUseByUser() throws Exception { // i.e. test clash between home folder names and parent folders // which requires a temporary folder to be created @@ -765,7 +768,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testUseFirstAvailableTemporaryFolder() throws Exception + public void test13UseFirstAvailableTemporaryFolder() throws Exception { createUser("", "fr"); createUser("", "fred"); @@ -785,7 +788,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testException() throws Exception + public void test14Exception() throws Exception { System.out.println("testException: EXPECT TO SEE AN EXCEPTION IN THE LOG ======================== "); @@ -806,7 +809,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testMultipleRoots() throws Exception + public void test15MultipleRoots() throws Exception { createFolder("root"); String rootPath = origRootPath + "/cm:root"; @@ -822,7 +825,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testPathNotUnderRoot() throws Exception + public void test16PathNotUnderRoot() throws Exception { System.out.println("-------------- testPathNotUnderRoot --------------"); @@ -840,7 +843,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testPathIsRoot() throws Exception + public void test17PathIsRoot() throws Exception { System.out.println("-------------- testPathIsRoot --------------"); @@ -858,7 +861,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testPathIsAboveRoot() throws Exception + public void test18PathIsAboveRoot() throws Exception { System.out.println("-------------- testPathIsAboveRoot --------------"); @@ -880,7 +883,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testMultipleUsers() throws Exception + public void test19MultipleUsers() throws Exception { // Tried 2000 users and the HomeFolderProviderSynchronizer.onBootstrap(null) // took 33 seconds. The setup and tear down takes a while too. @@ -903,7 +906,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testOverrideProvider() throws Exception + public void test20OverrideProvider() throws Exception { NodeRef person = createUser("a/b/c", "fred"); moveUserHomeFolders(); @@ -920,7 +923,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testNoOriginalProvider() throws Exception + public void test21NoOriginalProvider() throws Exception { createUser("a/b/c", "fred", null, true); homeFolderProviderSynchronizer.setOverrideHomeFolderProviderName( @@ -936,7 +939,7 @@ public class HomeFolderProviderSynchronizerTest //@Test @SuppressWarnings("deprecation") - public void xtestVersion1HomeFolderProvider() throws Exception + public void test22Version1HomeFolderProvider() throws Exception { // Should just log a message to say it can't do anything final String name = "v1Provider"; @@ -965,7 +968,7 @@ public class HomeFolderProviderSynchronizerTest @Test @SuppressWarnings("deprecation") - public void testExtendsAbstractHomeFolderProvider() throws Exception + public void test23ExtendsAbstractHomeFolderProvider() throws Exception { // Should work through the V2Adaptor final String name = "v1Provider"; @@ -989,7 +992,7 @@ public class HomeFolderProviderSynchronizerTest } @Test - public void testTenantService() throws Exception + public void test24TenantService() throws Exception { // Only test if running multi-tenant if (tenantAdminService.isEnabled()) @@ -1015,7 +1018,7 @@ public class HomeFolderProviderSynchronizerTest // ALF-11535 @Test - public void testChangeParentFolderCase() throws Exception + public void test25ChangeParentFolderCase() throws Exception { // By default, user names are case sensitive createUser("fr", "FRED"); @@ -1026,7 +1029,7 @@ public class HomeFolderProviderSynchronizerTest // ALF-11535 @Test - public void testCaseSensitiveUsers() throws Exception + public void test26CaseSensitiveUsers() throws Exception { userNameMatcher.setUserNamesAreCaseSensitive(true); diff --git a/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java b/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java index 8e69e38f74..f1299d974c 100644 --- a/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java +++ b/source/java/org/alfresco/repo/tenant/MultiTDemoTest.java @@ -77,6 +77,8 @@ import org.alfresco.service.transaction.TransactionService; import org.alfresco.util.ApplicationContextHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -84,6 +86,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext; * @author janv * since 3.0 */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class MultiTDemoTest extends TestCase { private static Log logger = LogFactory.getLog(MultiTDemoTest.class); @@ -200,7 +203,7 @@ public class MultiTDemoTest extends TestCase } } - public void testCreateTenants() throws Throwable + public void test01CreateTenants() throws Throwable { AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); // authenticate as super-admin @@ -295,7 +298,7 @@ public class MultiTDemoTest extends TestCase }, tenantName); } - public void testNonSharedGroupDeletion() + public void test02NonSharedGroupDeletion() { final String tenantDomain1 = TEST_RUN+".groupdel1"; final String tenantDomain2 = TEST_RUN+".groupdel2"; @@ -362,7 +365,7 @@ public class MultiTDemoTest extends TestCase } } - public void testSharedGroupDeletion() + public void test03SharedGroupDeletion() { final String tenantDomain1 = TEST_RUN+".groupdel3"; final String tenantDomain2 = TEST_RUN+".groupdel4"; @@ -499,7 +502,7 @@ public class MultiTDemoTest extends TestCase }); } - public void test_ETHREEOH_2015() + public void test04_ETHREEOH_2015() { final String tenantDomain1 = TEST_RUN+".one.ethreeoh2015"; final String tenantDomain2 = TEST_RUN+".two.ethreeoh2015"; @@ -534,7 +537,7 @@ public class MultiTDemoTest extends TestCase } - public void xtestCreateUsers() throws Throwable + public void test05CreateUsers() throws Throwable { logger.info("Create demo users"); @@ -618,7 +621,7 @@ public class MultiTDemoTest extends TestCase } } - public void xtestLoginTenantUsers() throws Throwable + public void test06LoginTenantUsers() throws Throwable { logger.info("Login tenant users"); @@ -647,7 +650,7 @@ public class MultiTDemoTest extends TestCase } } - public void testLoginTenantGuests() throws Throwable + public void test07LoginTenantGuests() throws Throwable { logger.info("Login tenant guests"); @@ -669,7 +672,7 @@ public class MultiTDemoTest extends TestCase } } - public void testLoginTenantAdmin() throws Throwable + public void test08LoginTenantAdmin() throws Throwable { logger.info("Login tenant admins"); @@ -691,7 +694,7 @@ public class MultiTDemoTest extends TestCase } } - public void testCreateGroups() + public void test09CreateGroups() { logger.info("Create demo groups"); @@ -772,7 +775,7 @@ public class MultiTDemoTest extends TestCase } } - public void xtestCreateCategories() + public void test10CreateCategories() { logger.info("Create demo categories"); @@ -883,7 +886,7 @@ public class MultiTDemoTest extends TestCase resultSet.close(); } - public void testCreateFolders() + public void test11CreateFolders() { logger.info("Create demo folders"); @@ -926,7 +929,7 @@ public class MultiTDemoTest extends TestCase } } - public void testCreateVersionableUserContent() + public void test12CreateVersionableUserContent() { logger.info("Create demo content"); @@ -966,7 +969,7 @@ public class MultiTDemoTest extends TestCase } } - public void testGetStores() + public void test13GetStores() { logger.info("Get tenant stores"); @@ -1012,7 +1015,7 @@ public class MultiTDemoTest extends TestCase } } - public void testGetProperty() + public void test14GetProperty() { logger.info("Test get property"); @@ -1045,7 +1048,7 @@ public class MultiTDemoTest extends TestCase } } - public void testCOCIandSearch() + public void test15COCIandSearch() { logger.info("Test checkout/checkin and search"); @@ -1096,7 +1099,7 @@ public class MultiTDemoTest extends TestCase } } - public void testDeleteArchiveAndRestoreContent() + public void test16DeleteArchiveAndRestoreContent() { logger.info("test delete/archive & restore content"); @@ -1127,7 +1130,7 @@ public class MultiTDemoTest extends TestCase } } - public void testCustomModels() + public void test17CustomModels() { logger.info("test custom models"); @@ -1180,7 +1183,7 @@ public class MultiTDemoTest extends TestCase } } - public void testAddCustomWebClient() + public void test18AddCustomWebClient() { // note: add as demo files - need to re-start Alfresco to see custom web client config / messages logger.info("test add custom web client config"); @@ -1207,7 +1210,7 @@ public class MultiTDemoTest extends TestCase } } - public void testFileFolder() + public void test19FileFolder() { logger.info("test file/folder list"); @@ -1237,7 +1240,7 @@ public class MultiTDemoTest extends TestCase } // pseudo cleanup - if this test runs last - public void testDeleteAllTenants() + public void test20DeleteAllTenants() { logger.info("test delete tenants"); @@ -1250,7 +1253,7 @@ public class MultiTDemoTest extends TestCase } } - public void test_ALF_12732() + public void test21_ALF_12732() { final String tenantDomain1 = TEST_RUN+".one.alf12732"; @@ -1290,7 +1293,7 @@ public class MultiTDemoTest extends TestCase } } - public void test_ALF_14354() + public void test22_ALF_14354() { final String tenantDomain1 = TEST_RUN+".one.alf14354"; final String tenantDomain2 = TEST_RUN+".two.alf14354"; diff --git a/source/java/org/alfresco/repo/usage/RepoUsageComponentTest.java b/source/java/org/alfresco/repo/usage/RepoUsageComponentTest.java index f8a0977a80..59e6bb4ed2 100644 --- a/source/java/org/alfresco/repo/usage/RepoUsageComponentTest.java +++ b/source/java/org/alfresco/repo/usage/RepoUsageComponentTest.java @@ -33,6 +33,8 @@ import org.alfresco.service.transaction.TransactionService; import org.alfresco.util.ApplicationContextHelper; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.junit.FixMethodOrder; +import org.junit.runners.MethodSorters; import org.springframework.context.ApplicationContext; /** @@ -41,6 +43,7 @@ import org.springframework.context.ApplicationContext; * @author Derek Hulley * @since 3.5 */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class RepoUsageComponentTest extends TestCase { private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(); @@ -88,7 +91,7 @@ public class RepoUsageComponentTest extends TestCase } } - public void testSetup() + public void test1Setup() { } @@ -124,7 +127,7 @@ public class RepoUsageComponentTest extends TestCase return transactionService.getRetryingTransactionHelper().doInTransaction(getCallback, false); } - public void testNoTxn() throws Throwable + public void test2NoTxn() throws Throwable { txn.commit(); try @@ -138,12 +141,12 @@ public class RepoUsageComponentTest extends TestCase } } - public void testGetUsage() + public void test3GetUsage() { getUsage(); } - public void testFullUse() throws Exception + public void test4FullUse() throws Exception { // Set the restrictions RepoUsage restrictions = new RepoUsage( @@ -178,7 +181,7 @@ public class RepoUsageComponentTest extends TestCase /** * Tests license code interaction. This interaction would be done using runAs 'System'. */ - public void testLicenseUse() throws Exception + public void test5LicenseUse() throws Exception { Long licenseUserLimit = 5L; Long licenseDocumentLimit = 100000L; @@ -205,7 +208,7 @@ public class RepoUsageComponentTest extends TestCase /** * Check that concurrent updates are prevented */ - public void testConcurrentUpdates() throws Exception + public void test6ConcurrentUpdates() throws Exception { // Firstly check that we can get an update assertTrue("Failed to update all usages", updateUsage(UsageType.USAGE_ALL));