From d0fa96a05e7be842c0ed1856baee54f18efbf240 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Tue, 31 Aug 2010 15:56:53 +0000 Subject: [PATCH] Tweak scheduling tests - only have quartz firing for the tests that need it, avoid it for the others so as not to confuse things (ALF-4505) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@22095 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../ScheduledPersistedActionServiceTest.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/source/java/org/alfresco/repo/action/scheduled/ScheduledPersistedActionServiceTest.java b/source/java/org/alfresco/repo/action/scheduled/ScheduledPersistedActionServiceTest.java index df36689763..00b7dd63d6 100644 --- a/source/java/org/alfresco/repo/action/scheduled/ScheduledPersistedActionServiceTest.java +++ b/source/java/org/alfresco/repo/action/scheduled/ScheduledPersistedActionServiceTest.java @@ -120,6 +120,10 @@ public class ScheduledPersistedActionServiceTest extends TestCase // Finish setup txn.commit(); + + // By default, we don't want the scheduler to fire while the tests run + // Certain tests will enable it as required + scheduler.standby(); } @Override @@ -135,6 +139,9 @@ public class ScheduledPersistedActionServiceTest extends TestCase service.deleteSchedule(schedule); } txn.commit(); + + // Re-enable the scheduler again + scheduler.start(); } /** @@ -669,6 +676,9 @@ public class ScheduledPersistedActionServiceTest extends TestCase */ public void testJobBeanInjection() throws Exception { + // This test needs the scheduler running properly + scheduler.start(); + // The job should run almost immediately Job job = new TestJob(); JobDetail details = new JobDetail("ThisIsATest", null, job.getClass()); @@ -701,6 +711,9 @@ public class ScheduledPersistedActionServiceTest extends TestCase ScheduledPersistedAction schedule; + // This test needs the scheduler running properly + scheduler.start(); + // Until the schedule is persisted, nothing will happen schedule = service.createSchedule(testAction); assertEquals(0, scheduler.getJobNames(ScheduledPersistedActionServiceImpl.SCHEDULER_GROUP).length); @@ -754,7 +767,7 @@ public class ScheduledPersistedActionServiceTest extends TestCase System.out.println("Job starts now, repeats twice @ 2s"); service.saveSchedule(schedule); - Thread.sleep(4000); + Thread.sleep(4200); // Ensure it did properly run two times // (Depending on timing of tests, might actually slip in 3 runs) @@ -809,6 +822,9 @@ public class ScheduledPersistedActionServiceTest extends TestCase */ public void DISABLEDtestMultipleExecutions() throws Exception { + // This test needs the scheduler running properly + scheduler.start(); + // Create one that starts running in 2 seconds, runs every 2 seconds // until 9 seconds are up (will run 4 times) // TODO