From 397fa8f6099ff21cd117e6267f120751d9898040 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 23 Nov 2010 11:32:19 +0000 Subject: [PATCH] Merged BRANCHES/V3.4 to HEAD: 23881: Hopefully avoid failures when run from a test suite, in the case of the previous test still having actions finishing up when we start git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@23885 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../action/RunningActionRestApiTest.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/source/java/org/alfresco/repo/web/scripts/action/RunningActionRestApiTest.java b/source/java/org/alfresco/repo/web/scripts/action/RunningActionRestApiTest.java index 97374bd5e0..ec4a6bbb37 100644 --- a/source/java/org/alfresco/repo/web/scripts/action/RunningActionRestApiTest.java +++ b/source/java/org/alfresco/repo/web/scripts/action/RunningActionRestApiTest.java @@ -18,6 +18,8 @@ */ package org.alfresco.repo.web.scripts.action; +import java.util.List; + import javax.transaction.UserTransaction; import org.alfresco.model.ContentModel; @@ -74,6 +76,32 @@ public class RunningActionRestApiTest extends BaseWebScriptTest private Repository repositoryHelper; private NodeRef dataDictionary; + /** + * When we're run from a suite, check the previous + * test's work has finished before we run. If other + * things end up on the work queue with us, we'll + * get confused... + */ + public void testEnsureAllQuiet() throws Exception + { + // Wait up to 2 seconds + for(int i=0; i<200; i++) + { + List actions = actionTrackingService.getAllExecutingActions(); + if(actions.size() == 0) + { + // Good, nothing running + break; + } + else + { + // Wait for the previous test's stuff to finish + System.out.println("Waiting on " + actions.size() + " actions to finish, top is " + actions.get(0)); + Thread.sleep(10); + } + } + } + public void testRunningActionsGet() throws Exception { Response response;