public ConfirmShutdownDialog() { ListView.Model = new ListStore (typeof (string), typeof (Job)); ListView.AppendColumn ("Error", new CellRendererText (), "text", 0); ListView.HeadersVisible = false; Header = Catalog.GetString ("Important tasks are running"); Title = ""; Message = Catalog.GetString ( "Closing Banshee now will cancel any currently running tasks. They cannot " + "be resumed automatically the next time Banshee is run."); DialogIconNameStock = Stock.DialogWarning; DefaultResponse = ResponseType.Cancel; AddButton (Catalog.GetString ("Quit Anyway"), ResponseType.Ok, false); AddButton (Catalog.GetString ("Continue Running"), ResponseType.Cancel, true); scheduler = ServiceManager.JobScheduler; foreach (Job job in scheduler.Jobs) { AddJob (job); } scheduler.JobAdded += AddJob; scheduler.JobRemoved += RemoveJob; }
public void TestOneNonSpeedJobPerResource () { // Test that two SpeedSensitive jobs with the same Resources will run simultaneously scheduler = new Scheduler (); scheduler.Add (new TestJob (200, PriorityHints.None, Resource.Cpu, Resource.Disk)); scheduler.Add (new TestJob (200, PriorityHints.None, Resource.Cpu, Resource.Disk)); AssertJobsRunning (1); }
public void TestSimultaneousSpeedJobs () { scheduler = new Scheduler (); scheduler.Add (new TestJob (200, PriorityHints.SpeedSensitive, Resource.Cpu, Resource.Disk)); scheduler.Add (new TestJob (200, PriorityHints.SpeedSensitive, Resource.Cpu, Resource.Disk)); scheduler.Add (new TestJob (200, PriorityHints.None, Resource.Cpu, Resource.Disk)); // Test that two SpeedSensitive jobs with the same Resources will run simultaneously AssertJobsRunning (2); // but that the third that isn't SpeedSensitive won't run until they are both done while (scheduler.JobCount > 1); Assert.AreEqual (PriorityHints.None, scheduler.Jobs.First ().PriorityHints); }
public void TestSpeedJobPreemptsNonSpeedJobs () { scheduler = new Scheduler (); TestJob a = new TestJob (200, PriorityHints.None, Resource.Cpu); TestJob b = new TestJob (200, PriorityHints.None, Resource.Disk); TestJob c = new TestJob (200, PriorityHints.LongRunning, Resource.Database); scheduler.Add (a); scheduler.Add (b); scheduler.Add (c); // Test that three jobs got started AssertJobsRunning (3); scheduler.Add (new TestJob (200, PriorityHints.SpeedSensitive, Resource.Cpu, Resource.Disk)); // Make sure the SpeedSensitive jobs has caused the Cpu and Disk jobs to be paused AssertJobsRunning (2); Assert.AreEqual (true, a.IsScheduled); Assert.AreEqual (true, b.IsScheduled); Assert.AreEqual (true, c.IsRunning); }