2013-05-06 17:39:33 -07:00
|
|
|
/*
|
|
|
|
using System;
|
2011-11-06 22:26:21 -08:00
|
|
|
using System.Linq;
|
|
|
|
using System.Threading;
|
2011-12-01 17:33:17 -08:00
|
|
|
using NzbDrone.Core.Jobs;
|
2011-11-06 22:26:21 -08:00
|
|
|
using NzbDrone.Core.Model.Notification;
|
|
|
|
|
2013-02-17 23:59:43 -08:00
|
|
|
namespace NzbDrone.Core.Test.JobTests
|
2011-11-06 22:26:21 -08:00
|
|
|
{
|
|
|
|
|
|
|
|
public class FakeJob : IJob
|
|
|
|
{
|
|
|
|
public string Name
|
|
|
|
{
|
|
|
|
get { return GetType().Name; }
|
|
|
|
}
|
|
|
|
|
2012-01-14 18:47:23 -08:00
|
|
|
public virtual TimeSpan DefaultInterval
|
2011-11-06 22:26:21 -08:00
|
|
|
{
|
2012-01-14 18:47:23 -08:00
|
|
|
get { return TimeSpan.FromMinutes(15); }
|
2011-11-06 22:26:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
public int ExecutionCount { get; private set; }
|
|
|
|
|
2012-09-10 12:04:17 -07:00
|
|
|
public void Start(ProgressNotification notification, dynamic options)
|
2011-11-06 22:26:21 -08:00
|
|
|
{
|
|
|
|
ExecutionCount++;
|
|
|
|
Console.WriteLine("Begin " + Name);
|
|
|
|
Start();
|
|
|
|
Console.WriteLine("End " + Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected virtual void Start()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class DisabledJob : FakeJob
|
|
|
|
{
|
2012-01-14 18:47:23 -08:00
|
|
|
public override TimeSpan DefaultInterval
|
2011-11-06 22:26:21 -08:00
|
|
|
{
|
2012-01-14 18:47:23 -08:00
|
|
|
get { return TimeSpan.FromTicks(0); }
|
2011-11-06 22:26:21 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class BrokenJob : FakeJob
|
|
|
|
{
|
|
|
|
protected override void Start()
|
|
|
|
{
|
|
|
|
throw new ApplicationException("Broken job is broken");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public class SlowJob : FakeJob
|
|
|
|
{
|
|
|
|
protected override void Start()
|
|
|
|
{
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
}
|
|
|
|
}
|
2013-03-04 17:48:20 -08:00
|
|
|
|
|
|
|
public class SlowJob2 : FakeJob
|
|
|
|
{
|
|
|
|
protected override void Start()
|
|
|
|
{
|
|
|
|
Thread.Sleep(1000);
|
|
|
|
}
|
|
|
|
}
|
2011-11-06 22:26:21 -08:00
|
|
|
}
|
2013-05-06 17:39:33 -07:00
|
|
|
*/
|