From 46f26874831c5cbac93f1755b30450ec013969f1 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Wed, 27 Oct 2010 12:09:41 +0000 Subject: [PATCH] Tweak a very old unit test for ETHREEOH-220 as advised by Derek, by wrapping one part in a retrying helper git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@23299 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../repo/tagging/TaggingServiceImplTest.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/source/java/org/alfresco/repo/tagging/TaggingServiceImplTest.java b/source/java/org/alfresco/repo/tagging/TaggingServiceImplTest.java index 26c724714b..e6517e08c4 100644 --- a/source/java/org/alfresco/repo/tagging/TaggingServiceImplTest.java +++ b/source/java/org/alfresco/repo/tagging/TaggingServiceImplTest.java @@ -644,12 +644,22 @@ public class TaggingServiceImplTest extends TestCase */ public void testETHREEOH_220() throws Exception { - UserTransaction tx = this.transactionService.getUserTransaction(); - tx.begin(); + // Add tag scope to a folder, then add a non-ASCII (unicode) + // tag onto the folder + transactionService.getRetryingTransactionHelper().doInTransaction( + new RetryingTransactionCallback() + { + public Void execute() throws Throwable + { + taggingService.addTagScope(folder); + taggingService.addTag(folder, TAG_I18N); + return null; + } + }, false, true + ); - this.taggingService.addTagScope(this.folder); - this.taggingService.addTag(this.folder, TAG_I18N); - tx = asyncOccurs.awaitExecution(tx); + // Wait for the tagging service to process the tag change + UserTransaction tx = asyncOccurs.awaitExecution(null); // Get the tag from the node List tags = this.taggingService.getTags(this.folder); @@ -1336,7 +1346,8 @@ public class TaggingServiceImplTest extends TestCase { synchronized (waitForExecutionLock) { // Have things begin working - tx.commit(); + if(tx != null) + tx.commit(); // Always wait 25ms waitForExecutionLock.wait(25);