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
This commit is contained in:
Nick Burch
2010-11-23 11:32:19 +00:00
parent 90da842035
commit 397fa8f609

View File

@@ -18,6 +18,8 @@
*/ */
package org.alfresco.repo.web.scripts.action; package org.alfresco.repo.web.scripts.action;
import java.util.List;
import javax.transaction.UserTransaction; import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel; import org.alfresco.model.ContentModel;
@@ -74,6 +76,32 @@ public class RunningActionRestApiTest extends BaseWebScriptTest
private Repository repositoryHelper; private Repository repositoryHelper;
private NodeRef dataDictionary; 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<ExecutionSummary> 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 public void testRunningActionsGet() throws Exception
{ {
Response response; Response response;