Scheduled action executor - Unit tests for most execution cases, persistance still TODO (ALF-4346)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@21846 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Nick Burch
2010-08-17 16:53:57 +00:00
parent 177d2f46da
commit f4d3f870f5
6 changed files with 226 additions and 23 deletions

View File

@@ -1265,11 +1265,13 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
public static final String NAME = "sleep-action";
public static final String GO_BANG = "GoBang";
private int sleepMs;
private Thread executingThread;
private int timesExecuted = 0;
private void incrementTimesExecutedCount() {timesExecuted++;}
public int getTimesExecuted() {return timesExecuted;}
private Thread executingThread;
public void resetTimesExecuted() {timesExecuted=0;}
private ActionTrackingService actionTrackingService;
@@ -1341,11 +1343,12 @@ public class ActionServiceImplTest extends BaseAlfrescoSpringTest
throw new RuntimeException("Bang!");
}
CancellableSleepAction ca = (CancellableSleepAction)action;
boolean cancelled = actionTrackingService.isCancellationRequested(ca);
if(cancelled)
if(action instanceof CancellableSleepAction)
{
throw new ActionCancelledException(ca);
CancellableSleepAction ca = (CancellableSleepAction)action;
boolean cancelled = actionTrackingService.isCancellationRequested(ca);
if(cancelled)
throw new ActionCancelledException(ca);
}
}
}