public void Activate() { _logger.Info(() => "Activating all scheduled jobs"); _timer.ClearAll(); _statusMonitor.Persist(schedule => { _jobs.DetermineSchedule(_timer.Now(), this, schedule); schedule.Active().Each(status => { var job = _jobs.FindJob(status.JobType); job.Initialize(_timer.Now(), this, schedule); }); }); _active = true; }
public void FixtureSetUp() { FubuTransport.AllQueuesInMemory = true; runtime = FubuTransport.For <TestingJobRegistry>().StructureMap().Bootstrap(); history = runtime.Factory.Get <JobHistory>(); clock = runtime.Factory.Get <ISystemTime>().As <RewindableClock>(); theController = runtime.Factory.Get <IScheduledJobController>(); thePersistence = runtime.Factory.Get <ISchedulePersistence>(); theTimer = runtime.Factory.Get <IJobTimer>(); theController.Deactivate(); theTimer.ClearAll(); history.ClearAll(); theStartingTime = (DateTimeOffset)DateTime.Today.AddHours(8).ToUniversalTime(); theEndingTime = theStartingTime.AddSeconds(30); addTimes <Job1>(3); addTimes <Job2>(10); addTimes <Job3>(15); clock.Reset(theStartingTime.DateTime); theController.Activate(); theController.IsActive().ShouldBeTrue(); Thread.Sleep(32.Seconds()); theController.Deactivate(); }