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
This commit is contained in:
Samuel Langlois
2012-09-26 17:30:57 +00:00
parent b4ff211666
commit cd4983f8fa
6 changed files with 118 additions and 100 deletions

View File

@@ -61,7 +61,9 @@ import org.junit.AfterClass;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.ComparisonFailure; import org.junit.ComparisonFailure;
import org.junit.FixMethodOrder;
import org.junit.Test; import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.mockito.invocation.InvocationOnMock; import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer; import org.mockito.stubbing.Answer;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
@@ -71,6 +73,7 @@ import org.springframework.context.ApplicationContext;
* *
* @author Alan Davis * @author Alan Davis
*/ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class AccessAuditorTest public class AccessAuditorTest
{ {
// Integration test environment // Integration test environment
@@ -274,7 +277,7 @@ public class AccessAuditorTest
} }
@Test @Test
public final void testOnCreateNodeAndOnUpdateProperties() throws Exception public final void test01OnCreateNodeAndOnUpdateProperties() throws Exception
{ {
newContent(homeFolder, "content4"); newContent(homeFolder, "content4");
@@ -291,7 +294,7 @@ public class AccessAuditorTest
} }
@Test @Test
public final void testOnCopyComplete() throws Exception public final void test02OnCopyComplete() throws Exception
{ {
serviceRegistry.getFileFolderService().copy(content2, folder1, null); // keep leaf name serviceRegistry.getFileFolderService().copy(content2, folder1, null); // keep leaf name
@@ -313,7 +316,7 @@ public class AccessAuditorTest
} }
@Test @Test
public final void testOnCopyCompleteAndNewName() throws Exception public final void test03OnCopyCompleteAndNewName() throws Exception
{ {
serviceRegistry.getFileFolderService().copy(content2, folder1, "newName1"); serviceRegistry.getFileFolderService().copy(content2, folder1, "newName1");
@@ -334,8 +337,8 @@ public class AccessAuditorTest
assertEquals("cm:content", auditMap.get("type")); assertEquals("cm:content", auditMap.get("type"));
} }
//@Test @Test
public final void xtestOnMoveNode() throws Exception public final void test04OnMoveNode() throws Exception
{ {
serviceRegistry.getNodeService().moveNode(content3, folder1, ContentModel.ASSOC_CONTAINS, null); // keep leaf name 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")); assertEquals("cm:content", auditMap.get("type"));
} }
//@Test @Test
public final void xtestOnMoveNodeAndNewName() throws Exception public final void test05OnMoveNodeAndNewName() throws Exception
{ {
serviceRegistry.getNodeService().moveNode(content3, folder1, ContentModel.ASSOC_CONTAINS, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "newName2")); 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 @Test
public final void testBeforeDeleteNode() throws Exception public final void test06BeforeDeleteNode() throws Exception
{ {
serviceRegistry.getNodeService().deleteNode(content0); serviceRegistry.getNodeService().deleteNode(content0);
@@ -387,7 +390,7 @@ public class AccessAuditorTest
} }
@Test @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_AUTHOR, null);
serviceRegistry.getNodeService().addAspect(content1, ContentModel.ASPECT_OWNABLE, null); serviceRegistry.getNodeService().addAspect(content1, ContentModel.ASPECT_OWNABLE, null);
@@ -407,7 +410,7 @@ public class AccessAuditorTest
} }
@Test @Test
public final void testOnRemoveAspect() throws Exception public final void test08OnRemoveAspect() throws Exception
{ {
serviceRegistry.getNodeService().removeAspect(content1, ContentModel.ASPECT_AUTHOR); serviceRegistry.getNodeService().removeAspect(content1, ContentModel.ASPECT_AUTHOR);
@@ -424,8 +427,8 @@ public class AccessAuditorTest
assertEquals("cm:content", auditMap.get("type")); assertEquals("cm:content", auditMap.get("type"));
} }
//@Test @Test
public final void xtestOnContentUpdate() throws Exception public final void test09OnContentUpdate() throws Exception
{ {
ContentWriter writer = serviceRegistry.getContentService().getWriter(content1, ContentModel.TYPE_CONTENT, true); ContentWriter writer = serviceRegistry.getContentService().getWriter(content1, ContentModel.TYPE_CONTENT, true);
writer.putContent("The cow jumped over the moon."); writer.putContent("The cow jumped over the moon.");
@@ -443,7 +446,7 @@ public class AccessAuditorTest
} }
@Test @Test
public final void testOnContentRead() throws Exception public final void test10OnContentRead() throws Exception
{ {
serviceRegistry.getContentService().getReader(content1, ContentModel.TYPE_CONTENT); serviceRegistry.getContentService().getReader(content1, ContentModel.TYPE_CONTENT);
@@ -459,7 +462,7 @@ public class AccessAuditorTest
} }
@Test @Test
public final void testOnCreateVersion() throws Exception public final void test11OnCreateVersion() throws Exception
{ {
Map<String, Serializable> versionProperties = getVersionProperties(); Map<String, Serializable> versionProperties = getVersionProperties();
serviceRegistry.getVersionService().createVersion(content1, versionProperties); serviceRegistry.getVersionService().createVersion(content1, versionProperties);
@@ -479,7 +482,7 @@ public class AccessAuditorTest
} }
@Test @Test
public final void testOnCheckOut() throws Exception public final void test12OnCheckOut() throws Exception
{ {
workingCopyNodeRef = serviceRegistry.getCheckOutCheckInService().checkout(content1); workingCopyNodeRef = serviceRegistry.getCheckOutCheckInService().checkout(content1);
@@ -512,8 +515,8 @@ public class AccessAuditorTest
assertEquals("cm:content", workMap.get("type")); assertEquals("cm:content", workMap.get("type"));
} }
//@Test @Test
public final void xtestOnCheckIn() throws Exception public final void test13OnCheckIn() throws Exception
{ {
Map<String, Serializable> checkinProperties = new HashMap<String, Serializable>(); Map<String, Serializable> checkinProperties = new HashMap<String, Serializable>();
checkinProperties.put(Version.PROP_DESCRIPTION, null); checkinProperties.put(Version.PROP_DESCRIPTION, null);
@@ -547,8 +550,8 @@ public class AccessAuditorTest
assertEquals("cm:content", origMap.get("type")); assertEquals("cm:content", origMap.get("type"));
} }
//@Test @Test
public final void xtestOnCancelCheckOut() throws Exception public final void test14OnCancelCheckOut() throws Exception
{ {
workingCopyNodeRef = serviceRegistry.getCheckOutCheckInService().checkout(content1); workingCopyNodeRef = serviceRegistry.getCheckOutCheckInService().checkout(content1);
txn.commit(); txn.commit();

View File

@@ -30,12 +30,15 @@ import org.alfresco.service.cmr.repository.Period;
import org.alfresco.service.cmr.repository.PeriodProvider; import org.alfresco.service.cmr.repository.PeriodProvider;
import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.ApplicationContextHelper;
import org.alfresco.util.CachingDateFormat; import org.alfresco.util.CachingDateFormat;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
/** /**
* Tests for period implementations - persistence and search is tested elsewhere * Tests for period implementations - persistence and search is tested elsewhere
* *
* @author andyh * @author andyh
*/ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class PeriodTest extends TestCase public class PeriodTest extends TestCase
{ {
@@ -49,7 +52,7 @@ public class PeriodTest extends TestCase
/** /**
* "none" * "none"
*/ */
public void testNoPeriod() public void test01NoPeriod()
{ {
assertTrue(Period.getProviderNames().contains(NoPeriod.PERIOD_TYPE)); assertTrue(Period.getProviderNames().contains(NoPeriod.PERIOD_TYPE));
Period period = new Period(NoPeriod.PERIOD_TYPE); Period period = new Period(NoPeriod.PERIOD_TYPE);
@@ -69,7 +72,7 @@ public class PeriodTest extends TestCase
/** /**
* Days * Days
*/ */
public void testDays() public void test02Days()
{ {
assertTrue(Period.getProviderNames().contains(Days.PERIOD_TYPE)); assertTrue(Period.getProviderNames().contains(Days.PERIOD_TYPE));
Period period = new Period(Days.PERIOD_TYPE); Period period = new Period(Days.PERIOD_TYPE);
@@ -112,7 +115,7 @@ public class PeriodTest extends TestCase
/** /**
* Weeks * Weeks
*/ */
public void testWeeks() public void test03Weeks()
{ {
assertTrue(Period.getProviderNames().contains(Weeks.PERIOD_TYPE)); assertTrue(Period.getProviderNames().contains(Weeks.PERIOD_TYPE));
Period period = new Period(Weeks.PERIOD_TYPE); Period period = new Period(Weeks.PERIOD_TYPE);
@@ -155,7 +158,7 @@ public class PeriodTest extends TestCase
/** /**
* Months * Months
*/ */
public void testMonths() public void test04Months()
{ {
assertTrue(Period.getProviderNames().contains(Months.PERIOD_TYPE)); assertTrue(Period.getProviderNames().contains(Months.PERIOD_TYPE));
Period period = new Period(Months.PERIOD_TYPE); Period period = new Period(Months.PERIOD_TYPE);
@@ -198,7 +201,7 @@ public class PeriodTest extends TestCase
/** /**
* Quarters * Quarters
*/ */
public void testQuarters() public void test05Quarters()
{ {
assertTrue(Period.getProviderNames().contains(Quarters.PERIOD_TYPE)); assertTrue(Period.getProviderNames().contains(Quarters.PERIOD_TYPE));
Period period = new Period(Quarters.PERIOD_TYPE); Period period = new Period(Quarters.PERIOD_TYPE);
@@ -241,7 +244,7 @@ public class PeriodTest extends TestCase
/** /**
* Years * Years
*/ */
public void testYears() public void test06Years()
{ {
assertTrue(Period.getProviderNames().contains(Years.PERIOD_TYPE)); assertTrue(Period.getProviderNames().contains(Years.PERIOD_TYPE));
Period period = new Period(Years.PERIOD_TYPE); Period period = new Period(Years.PERIOD_TYPE);
@@ -284,7 +287,7 @@ public class PeriodTest extends TestCase
/** /**
* EndOfMonth * EndOfMonth
*/ */
public void testEndOfMonth() public void test07EndOfMonth()
{ {
assertTrue(Period.getProviderNames().contains(EndOfMonth.PERIOD_TYPE)); assertTrue(Period.getProviderNames().contains(EndOfMonth.PERIOD_TYPE));
Period period = new Period(EndOfMonth.PERIOD_TYPE); Period period = new Period(EndOfMonth.PERIOD_TYPE);
@@ -330,7 +333,7 @@ public class PeriodTest extends TestCase
/** /**
* EndOfYear * EndOfYear
*/ */
public void testEndOfYear() public void test08EndOfYear()
{ {
assertTrue(Period.getProviderNames().contains(EndOfYear.PERIOD_TYPE)); assertTrue(Period.getProviderNames().contains(EndOfYear.PERIOD_TYPE));
Period period = new Period(EndOfYear.PERIOD_TYPE); Period period = new Period(EndOfYear.PERIOD_TYPE);
@@ -378,7 +381,7 @@ public class PeriodTest extends TestCase
* *
* @throws ParseException * @throws ParseException
*/ */
public void testEndOfQuarter() throws ParseException public void test09EndOfQuarter() throws ParseException
{ {
PeriodProvider provider = Period.getProvider(EndOfQuarter.PERIOD_TYPE); PeriodProvider provider = Period.getProvider(EndOfQuarter.PERIOD_TYPE);
assertEquals(provider.getDefaultExpression(), "1"); 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 * 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)); assertTrue(Period.getProviderNames().contains(EndOfFinancialMonth.PERIOD_TYPE));
Period period = new Period(EndOfFinancialMonth.PERIOD_TYPE); Period period = new Period(EndOfFinancialMonth.PERIOD_TYPE);
@@ -543,7 +546,7 @@ public class PeriodTest extends TestCase
* *
* @throws ParseException * @throws ParseException
*/ */
public void testEndOfDefaultFinancialYear() throws ParseException public void test11EndOfDefaultFinancialYear() throws ParseException
{ {
PeriodProvider provider = Period.getProvider(EndOfFinancialYear.PERIOD_TYPE); PeriodProvider provider = Period.getProvider(EndOfFinancialYear.PERIOD_TYPE);
assertEquals(provider.getDefaultExpression(), "1"); assertEquals(provider.getDefaultExpression(), "1");
@@ -577,7 +580,7 @@ public class PeriodTest extends TestCase
* *
* @throws ParseException * @throws ParseException
*/ */
public void xtestEndOfDefaultFinancialQuarter() throws ParseException public void test12EndOfDefaultFinancialQuarter() throws ParseException
{ {
PeriodProvider provider = Period.getProvider(EndOfFinancialQuarter.PERIOD_TYPE); PeriodProvider provider = Period.getProvider(EndOfFinancialQuarter.PERIOD_TYPE);
assertEquals(provider.getDefaultExpression(), "1"); assertEquals(provider.getDefaultExpression(), "1");
@@ -630,7 +633,7 @@ public class PeriodTest extends TestCase
* *
* @throws ParseException * @throws ParseException
*/ */
public void testEndOfUKTaxYear() throws ParseException public void test13EndOfUKTaxYear() throws ParseException
{ {
PeriodProvider provider = Period.getProvider(EndOfFinancialYear.PERIOD_TYPE); PeriodProvider provider = Period.getProvider(EndOfFinancialYear.PERIOD_TYPE);
assertEquals(provider.getDefaultExpression(), "1"); assertEquals(provider.getDefaultExpression(), "1");
@@ -667,7 +670,7 @@ public class PeriodTest extends TestCase
* *
* @throws ParseException * @throws ParseException
*/ */
public void testEndOfUKTaxQuarter() throws ParseException public void test14EndOfUKTaxQuarter() throws ParseException
{ {
PeriodProvider provider = Period.getProvider(EndOfFinancialQuarter.PERIOD_TYPE); PeriodProvider provider = Period.getProvider(EndOfFinancialQuarter.PERIOD_TYPE);
assertEquals(provider.getDefaultExpression(), "1"); assertEquals(provider.getDefaultExpression(), "1");
@@ -723,7 +726,7 @@ public class PeriodTest extends TestCase
* *
* @throws ParseException * @throws ParseException
*/ */
public void testEndOfUKTaxMonth() throws ParseException public void test15EndOfUKTaxMonth() throws ParseException
{ {
PeriodProvider provider = Period.getProvider(EndOfFinancialMonth.PERIOD_TYPE); PeriodProvider provider = Period.getProvider(EndOfFinancialMonth.PERIOD_TYPE);
assertEquals(provider.getDefaultExpression(), "1"); assertEquals(provider.getDefaultExpression(), "1");
@@ -834,7 +837,7 @@ public class PeriodTest extends TestCase
* Cron * Cron
* @throws ParseException * @throws ParseException
*/ */
public void testCron() throws ParseException public void test16Cron() throws ParseException
{ {
PeriodProvider provider = Period.getProvider(Cron.PERIOD_TYPE); PeriodProvider provider = Period.getProvider(Cron.PERIOD_TYPE);
assertEquals(provider.getDefaultExpression(), "59 59 23 * * ?"); assertEquals(provider.getDefaultExpression(), "59 59 23 * * ?");
@@ -857,7 +860,7 @@ public class PeriodTest extends TestCase
* XMLDuration * XMLDuration
* @throws ParseException * @throws ParseException
*/ */
public void testXMLDuration() throws ParseException public void test17XMLDuration() throws ParseException
{ {
PeriodProvider provider = Period.getProvider(XMLDuration.PERIOD_TYPE); PeriodProvider provider = Period.getProvider(XMLDuration.PERIOD_TYPE);
assertEquals(provider.getDefaultExpression(), "P1D"); assertEquals(provider.getDefaultExpression(), "P1D");
@@ -879,7 +882,7 @@ public class PeriodTest extends TestCase
/** /**
* Test a missing expression, ensure 1 is used as the default * Test a missing expression, ensure 1 is used as the default
*/ */
public void testMissingExpression() public void test18MissingExpression()
{ {
assertTrue(Period.getProviderNames().contains(Days.PERIOD_TYPE)); assertTrue(Period.getProviderNames().contains(Days.PERIOD_TYPE));
Date now = new Date(); Date now = new Date();

View File

@@ -47,6 +47,8 @@ import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.service.transaction.TransactionService; import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.ApplicationContextHelper;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.core.io.Resource; import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
@@ -55,6 +57,7 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
* Message Service unit tests * Message Service unit tests
* *
*/ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MessageServiceImplTest extends TestCase implements MessageDeployer public class MessageServiceImplTest extends TestCase implements MessageDeployer
{ {
private static ApplicationContext applicationContext = ApplicationContextHelper.getApplicationContext(); private static ApplicationContext applicationContext = ApplicationContextHelper.getApplicationContext();
@@ -198,7 +201,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer
/** /**
* Test the set and get methods * Test the set and get methods
*/ */
public void testSetAndGet() public void test1SetAndGet()
{ {
// Check that the default locale is returned // Check that the default locale is returned
assertEquals(Locale.getDefault(), messageService.getLocale()); assertEquals(Locale.getDefault(), messageService.getLocale());
@@ -215,7 +218,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer
/** /**
* Test get message from repository * Test get message from repository
*/ */
public void testGetMessagesLoadedFromRepo() throws Exception public void test2GetMessagesLoadedFromRepo() throws Exception
{ {
setupRepo(); setupRepo();
@@ -233,7 +236,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer
/** /**
* Test getting a parameterised message from repository * Test getting a parameterised message from repository
*/ */
public void testGetMessagesWithParamsLoadedFromRepo() throws Exception public void test3GetMessagesWithParamsLoadedFromRepo() throws Exception
{ {
setupRepo(); setupRepo();
@@ -252,7 +255,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer
/** /**
* Test get message from classpath * Test get message from classpath
*/ */
public void testGetMessagesLoadedFromClasspath() throws Exception public void test4GetMessagesLoadedFromClasspath() throws Exception
{ {
// Check with no bundles loaded // Check with no bundles loaded
assertNull(messageService.getMessage(MSG_NO)); assertNull(messageService.getMessage(MSG_NO));
@@ -268,7 +271,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer
/** /**
* Test getting a parameterised message from classpath * Test getting a parameterised message from classpath
*/ */
public void testGetMessagesWithParamsLoadedFromClasspath() throws Exception public void test5GetMessagesWithParamsLoadedFromClasspath() throws Exception
{ {
// Check with no bundles loaded // Check with no bundles loaded
assertNull(messageService.getMessage(MSG_PARAMS, new Object[]{PARAM_VALUE})); 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 * Test register bundle (using a repository location) with uninitialised cache
*/ */
public void testRegisterBundleFromRepo() throws Exception public void test6RegisterBundleFromRepo() throws Exception
{ {
setupRepo(); setupRepo();
@@ -300,7 +303,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer
/** /**
* Test register bundle (using a classpath location) with uninitialised cache * Test register bundle (using a classpath location) with uninitialised cache
*/ */
public void testRegisterBundleFromClasspath() throws Exception public void test7RegisterBundleFromClasspath() throws Exception
{ {
// Register the bundle // Register the bundle
messageService.registerResourceBundle(BASE_RESOURCE_CLASSPATH + BASE_BUNDLE_NAME); messageService.registerResourceBundle(BASE_RESOURCE_CLASSPATH + BASE_BUNDLE_NAME);
@@ -314,7 +317,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer
/** /**
* Test forced reset * Test forced reset
*/ */
public void xtestReset() throws Exception public void test8Reset() throws Exception
{ {
// Check with no bundles loaded // Check with no bundles loaded
assertNull(messageService.getMessage(MSG_YES)); assertNull(messageService.getMessage(MSG_YES));
@@ -339,7 +342,7 @@ public class MessageServiceImplTest extends TestCase implements MessageDeployer
messageService.registerResourceBundle(BASE_RESOURCE_CLASSPATH + BASE_BUNDLE_NAME); messageService.registerResourceBundle(BASE_RESOURCE_CLASSPATH + BASE_BUNDLE_NAME);
} }
public void testLocaleMatching() public void test9LocaleMatching()
{ {
Set<Locale> options = new HashSet<Locale>(13); Set<Locale> options = new HashSet<Locale>(13);
options.add(Locale.FRENCH); // fr options.add(Locale.FRENCH); // fr

View File

@@ -60,7 +60,9 @@ import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.ComparisonFailure; import org.junit.ComparisonFailure;
import org.junit.FixMethodOrder;
import org.junit.Test; import org.junit.Test;
import org.junit.runners.MethodSorters;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
/** /**
@@ -68,6 +70,7 @@ import org.springframework.context.ApplicationContext;
* *
* @author Alan Davis * @author Alan Davis
*/ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class HomeFolderProviderSynchronizerTest public class HomeFolderProviderSynchronizerTest
{ {
private static final QName PROP_PARENT_PATH = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "parentPath"); private static final QName PROP_PARENT_PATH = QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "parentPath");
@@ -601,7 +604,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testCorrectLocation() throws Exception public void test01CorrectLocation() throws Exception
{ {
createUser("te", "tess"); createUser("te", "tess");
@@ -611,7 +614,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testCreateParentFolder() throws Exception public void test02CreateParentFolder() throws Exception
{ {
createUser("", "fred"); createUser("", "fred");
@@ -621,7 +624,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testNotEnabled() throws Exception public void test03NotEnabled() throws Exception
{ {
createUser("", "fred"); createUser("", "fred");
homeFolderProviderSynchronizer.setEnabled("false"); homeFolderProviderSynchronizer.setEnabled("false");
@@ -636,7 +639,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testHomeFolderNotYetCreated() throws Exception public void test04HomeFolderNotYetCreated() throws Exception
{ {
NodeRef person = createUser("", "fred", largeHomeFolderProviderName, false); NodeRef person = createUser("", "fred", largeHomeFolderProviderName, false);
@@ -653,7 +656,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testCreateMultipleParentFolders() throws Exception public void test05CreateMultipleParentFolders() throws Exception
{ {
largeHomeFolderProvider.setPattern("^(.?)(.?)(.?)(.?)(.?)"); largeHomeFolderProvider.setPattern("^(.?)(.?)(.?)(.?)(.?)");
@@ -669,7 +672,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testMoveToRoot() throws Exception public void test06MoveToRoot() throws Exception
{ {
// i.e. there are no parent folders after the sync // i.e. there are no parent folders after the sync
largeHomeFolderProvider.setPattern(""); largeHomeFolderProvider.setPattern("");
@@ -682,7 +685,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testRemoveEmptyParents() throws Exception public void test07RemoveEmptyParents() throws Exception
{ {
createUser("a/bb/ccc", "peter"); createUser("a/bb/ccc", "peter");
@@ -693,7 +696,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testKeepEmptyParents() throws Exception public void test08KeepEmptyParents() throws Exception
{ {
createUser("a/bb/ccc", "peter"); createUser("a/bb/ccc", "peter");
homeFolderProviderSynchronizer.setKeepEmptyParents("true"); homeFolderProviderSynchronizer.setKeepEmptyParents("true");
@@ -706,7 +709,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testKeepNonEmptyParents() throws Exception public void test09KeepNonEmptyParents() throws Exception
{ {
createUser("a/bb/ccc", "peter"); createUser("a/bb/ccc", "peter");
createFolder("a/bb/ddd"); createFolder("a/bb/ddd");
@@ -719,7 +722,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testPathAlreadyInUseByFolder() throws Exception public void test10PathAlreadyInUseByFolder() throws Exception
{ {
createUser("", "fred"); createUser("", "fred");
createFolder("fr"); createFolder("fr");
@@ -730,7 +733,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testPathAlreadyInUseByContent() throws Exception public void test11PathAlreadyInUseByContent() throws Exception
{ {
System.out.println("testPathAlreadyInUseByContent: EXPECT TO SEE AN EXCEPTION IN THE LOG ======================== "); System.out.println("testPathAlreadyInUseByContent: EXPECT TO SEE AN EXCEPTION IN THE LOG ======================== ");
@@ -745,7 +748,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testPathInUseByUser() throws Exception public void test12PathInUseByUser() throws Exception
{ {
// i.e. test clash between home folder names and parent folders // i.e. test clash between home folder names and parent folders
// which requires a temporary folder to be created // which requires a temporary folder to be created
@@ -765,7 +768,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testUseFirstAvailableTemporaryFolder() throws Exception public void test13UseFirstAvailableTemporaryFolder() throws Exception
{ {
createUser("", "fr"); createUser("", "fr");
createUser("", "fred"); createUser("", "fred");
@@ -785,7 +788,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testException() throws Exception public void test14Exception() throws Exception
{ {
System.out.println("testException: EXPECT TO SEE AN EXCEPTION IN THE LOG ======================== "); System.out.println("testException: EXPECT TO SEE AN EXCEPTION IN THE LOG ======================== ");
@@ -806,7 +809,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testMultipleRoots() throws Exception public void test15MultipleRoots() throws Exception
{ {
createFolder("root"); createFolder("root");
String rootPath = origRootPath + "/cm:root"; String rootPath = origRootPath + "/cm:root";
@@ -822,7 +825,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testPathNotUnderRoot() throws Exception public void test16PathNotUnderRoot() throws Exception
{ {
System.out.println("-------------- testPathNotUnderRoot --------------"); System.out.println("-------------- testPathNotUnderRoot --------------");
@@ -840,7 +843,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testPathIsRoot() throws Exception public void test17PathIsRoot() throws Exception
{ {
System.out.println("-------------- testPathIsRoot --------------"); System.out.println("-------------- testPathIsRoot --------------");
@@ -858,7 +861,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testPathIsAboveRoot() throws Exception public void test18PathIsAboveRoot() throws Exception
{ {
System.out.println("-------------- testPathIsAboveRoot --------------"); System.out.println("-------------- testPathIsAboveRoot --------------");
@@ -880,7 +883,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testMultipleUsers() throws Exception public void test19MultipleUsers() throws Exception
{ {
// Tried 2000 users and the HomeFolderProviderSynchronizer.onBootstrap(null) // Tried 2000 users and the HomeFolderProviderSynchronizer.onBootstrap(null)
// took 33 seconds. The setup and tear down takes a while too. // took 33 seconds. The setup and tear down takes a while too.
@@ -903,7 +906,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testOverrideProvider() throws Exception public void test20OverrideProvider() throws Exception
{ {
NodeRef person = createUser("a/b/c", "fred"); NodeRef person = createUser("a/b/c", "fred");
moveUserHomeFolders(); moveUserHomeFolders();
@@ -920,7 +923,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testNoOriginalProvider() throws Exception public void test21NoOriginalProvider() throws Exception
{ {
createUser("a/b/c", "fred", null, true); createUser("a/b/c", "fred", null, true);
homeFolderProviderSynchronizer.setOverrideHomeFolderProviderName( homeFolderProviderSynchronizer.setOverrideHomeFolderProviderName(
@@ -936,7 +939,7 @@ public class HomeFolderProviderSynchronizerTest
//@Test //@Test
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void xtestVersion1HomeFolderProvider() throws Exception public void test22Version1HomeFolderProvider() throws Exception
{ {
// Should just log a message to say it can't do anything // Should just log a message to say it can't do anything
final String name = "v1Provider"; final String name = "v1Provider";
@@ -965,7 +968,7 @@ public class HomeFolderProviderSynchronizerTest
@Test @Test
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void testExtendsAbstractHomeFolderProvider() throws Exception public void test23ExtendsAbstractHomeFolderProvider() throws Exception
{ {
// Should work through the V2Adaptor // Should work through the V2Adaptor
final String name = "v1Provider"; final String name = "v1Provider";
@@ -989,7 +992,7 @@ public class HomeFolderProviderSynchronizerTest
} }
@Test @Test
public void testTenantService() throws Exception public void test24TenantService() throws Exception
{ {
// Only test if running multi-tenant // Only test if running multi-tenant
if (tenantAdminService.isEnabled()) if (tenantAdminService.isEnabled())
@@ -1015,7 +1018,7 @@ public class HomeFolderProviderSynchronizerTest
// ALF-11535 // ALF-11535
@Test @Test
public void testChangeParentFolderCase() throws Exception public void test25ChangeParentFolderCase() throws Exception
{ {
// By default, user names are case sensitive // By default, user names are case sensitive
createUser("fr", "FRED"); createUser("fr", "FRED");
@@ -1026,7 +1029,7 @@ public class HomeFolderProviderSynchronizerTest
// ALF-11535 // ALF-11535
@Test @Test
public void testCaseSensitiveUsers() throws Exception public void test26CaseSensitiveUsers() throws Exception
{ {
userNameMatcher.setUserNamesAreCaseSensitive(true); userNameMatcher.setUserNamesAreCaseSensitive(true);

View File

@@ -77,6 +77,8 @@ import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.ApplicationContextHelper;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -84,6 +86,7 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
* @author janv * @author janv
* since 3.0 * since 3.0
*/ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class MultiTDemoTest extends TestCase public class MultiTDemoTest extends TestCase
{ {
private static Log logger = LogFactory.getLog(MultiTDemoTest.class); 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 AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getAdminUserName()); // authenticate as super-admin
@@ -295,7 +298,7 @@ public class MultiTDemoTest extends TestCase
}, tenantName); }, tenantName);
} }
public void testNonSharedGroupDeletion() public void test02NonSharedGroupDeletion()
{ {
final String tenantDomain1 = TEST_RUN+".groupdel1"; final String tenantDomain1 = TEST_RUN+".groupdel1";
final String tenantDomain2 = TEST_RUN+".groupdel2"; 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 tenantDomain1 = TEST_RUN+".groupdel3";
final String tenantDomain2 = TEST_RUN+".groupdel4"; 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 tenantDomain1 = TEST_RUN+".one.ethreeoh2015";
final String tenantDomain2 = TEST_RUN+".two.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"); 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"); 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"); 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"); 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"); 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"); logger.info("Create demo categories");
@@ -883,7 +886,7 @@ public class MultiTDemoTest extends TestCase
resultSet.close(); resultSet.close();
} }
public void testCreateFolders() public void test11CreateFolders()
{ {
logger.info("Create demo folders"); 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"); 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"); 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"); 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"); 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"); 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"); 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 // 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"); 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"); logger.info("test file/folder list");
@@ -1237,7 +1240,7 @@ public class MultiTDemoTest extends TestCase
} }
// pseudo cleanup - if this test runs last // pseudo cleanup - if this test runs last
public void testDeleteAllTenants() public void test20DeleteAllTenants()
{ {
logger.info("test delete tenants"); 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"; 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 tenantDomain1 = TEST_RUN+".one.alf14354";
final String tenantDomain2 = TEST_RUN+".two.alf14354"; final String tenantDomain2 = TEST_RUN+".two.alf14354";

View File

@@ -33,6 +33,8 @@ import org.alfresco.service.transaction.TransactionService;
import org.alfresco.util.ApplicationContextHelper; import org.alfresco.util.ApplicationContextHelper;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.junit.FixMethodOrder;
import org.junit.runners.MethodSorters;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
/** /**
@@ -41,6 +43,7 @@ import org.springframework.context.ApplicationContext;
* @author Derek Hulley * @author Derek Hulley
* @since 3.5 * @since 3.5
*/ */
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class RepoUsageComponentTest extends TestCase public class RepoUsageComponentTest extends TestCase
{ {
private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext(); 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); return transactionService.getRetryingTransactionHelper().doInTransaction(getCallback, false);
} }
public void testNoTxn() throws Throwable public void test2NoTxn() throws Throwable
{ {
txn.commit(); txn.commit();
try try
@@ -138,12 +141,12 @@ public class RepoUsageComponentTest extends TestCase
} }
} }
public void testGetUsage() public void test3GetUsage()
{ {
getUsage(); getUsage();
} }
public void testFullUse() throws Exception public void test4FullUse() throws Exception
{ {
// Set the restrictions // Set the restrictions
RepoUsage restrictions = new RepoUsage( 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'. * 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 licenseUserLimit = 5L;
Long licenseDocumentLimit = 100000L; Long licenseDocumentLimit = 100000L;
@@ -205,7 +208,7 @@ public class RepoUsageComponentTest extends TestCase
/** /**
* Check that concurrent updates are prevented * Check that concurrent updates are prevented
*/ */
public void testConcurrentUpdates() throws Exception public void test6ConcurrentUpdates() throws Exception
{ {
// Firstly check that we can get an update // Firstly check that we can get an update
assertTrue("Failed to update all usages", updateUsage(UsageType.USAGE_ALL)); assertTrue("Failed to update all usages", updateUsage(UsageType.USAGE_ALL));