From 48c06de098a8be5d39b320ac9064adab1f1931b0 Mon Sep 17 00:00:00 2001 From: "kay.one" Date: Mon, 16 Sep 2013 21:52:02 -0700 Subject: [PATCH] updated CommandExecutedEvent to be handled sync. --- .../NzbDrone.Common.Test.csproj | 1 - .../Messaging/Events/EventAggregatorFixture.cs | 17 ++++++++--------- NzbDrone.Core.Test/NzbDrone.Core.Test.csproj | 1 + .../Instrumentation/SetLoggingLevel.cs | 1 - NzbDrone.Core/Jobs/Scheduler.cs | 1 - NzbDrone.Core/Jobs/TaskManager.cs | 7 +++---- 6 files changed, 12 insertions(+), 16 deletions(-) rename NzbDrone.Common.Test/MessagingTests/MessageAggregatorEventTests.cs => NzbDrone.Core.Test/Messaging/Events/EventAggregatorFixture.cs (91%) diff --git a/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj b/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj index 2347a37bf..1ec40855c 100644 --- a/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj +++ b/NzbDrone.Common.Test/NzbDrone.Common.Test.csproj @@ -67,7 +67,6 @@ - diff --git a/NzbDrone.Common.Test/MessagingTests/MessageAggregatorEventTests.cs b/NzbDrone.Core.Test/Messaging/Events/EventAggregatorFixture.cs similarity index 91% rename from NzbDrone.Common.Test/MessagingTests/MessageAggregatorEventTests.cs rename to NzbDrone.Core.Test/Messaging/Events/EventAggregatorFixture.cs index 30a177c81..f1fc6bee1 100644 --- a/NzbDrone.Common.Test/MessagingTests/MessageAggregatorEventTests.cs +++ b/NzbDrone.Core.Test/Messaging/Events/EventAggregatorFixture.cs @@ -4,15 +4,15 @@ using System.Threading; using FluentAssertions; using Moq; using NUnit.Framework; +using NzbDrone.Common; using NzbDrone.Common.Messaging; -using NzbDrone.Core.Messaging; using NzbDrone.Core.Messaging.Events; using NzbDrone.Test.Common; -namespace NzbDrone.Common.Test.MessagingTests +namespace NzbDrone.Core.Test.Messaging.Events { [TestFixture] - public class MessageAggregatorEventTests : TestBase + public class EventAggregatorFixture : TestBase { private Mock> HandlerA1; private Mock> HandlerA2; @@ -119,11 +119,11 @@ namespace NzbDrone.Common.Test.MessagingTests AsyncHandlerA1.Setup(c => c.HandleAsync(It.IsAny())) .Callback(c => - { - var id = counter.Start(); - Thread.Sleep(1000); - counter.Stop(id); - }); + { + var id = counter.Start(); + Thread.Sleep(1000); + counter.Stop(id); + }); Subject.PublishEvent(eventA); @@ -143,5 +143,4 @@ namespace NzbDrone.Common.Test.MessagingTests { } - } \ No newline at end of file diff --git a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj index 5035ea37e..c855d7ad9 100644 --- a/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj +++ b/NzbDrone.Core.Test/NzbDrone.Core.Test.csproj @@ -150,6 +150,7 @@ + diff --git a/NzbDrone.Core/Instrumentation/SetLoggingLevel.cs b/NzbDrone.Core/Instrumentation/SetLoggingLevel.cs index 61412e8fb..a436c0fc1 100644 --- a/NzbDrone.Core/Instrumentation/SetLoggingLevel.cs +++ b/NzbDrone.Core/Instrumentation/SetLoggingLevel.cs @@ -6,7 +6,6 @@ using NLog.Targets; using NzbDrone.Core.Configuration; using NzbDrone.Core.Configuration.Events; using NzbDrone.Core.Lifecycle; -using NzbDrone.Core.Messaging; using NzbDrone.Core.Messaging.Events; namespace NzbDrone.Core.Instrumentation diff --git a/NzbDrone.Core/Jobs/Scheduler.cs b/NzbDrone.Core/Jobs/Scheduler.cs index 2b8b42086..e0d6e8194 100644 --- a/NzbDrone.Core/Jobs/Scheduler.cs +++ b/NzbDrone.Core/Jobs/Scheduler.cs @@ -3,7 +3,6 @@ using System.Threading; using System.Threading.Tasks; using NLog; using NzbDrone.Core.Lifecycle; -using NzbDrone.Core.Messaging; using NzbDrone.Core.Messaging.Commands; using NzbDrone.Core.Messaging.Events; using Timer = System.Timers.Timer; diff --git a/NzbDrone.Core/Jobs/TaskManager.cs b/NzbDrone.Core/Jobs/TaskManager.cs index 9d1a316c5..a04931ac3 100644 --- a/NzbDrone.Core/Jobs/TaskManager.cs +++ b/NzbDrone.Core/Jobs/TaskManager.cs @@ -9,7 +9,6 @@ using NzbDrone.Core.Indexers; using NzbDrone.Core.Instrumentation.Commands; using NzbDrone.Core.Lifecycle; using NzbDrone.Core.MediaFiles.Commands; -using NzbDrone.Core.Messaging; using NzbDrone.Core.Messaging.Commands.Tracking; using NzbDrone.Core.Messaging.Events; using NzbDrone.Core.Providers; @@ -23,7 +22,7 @@ namespace NzbDrone.Core.Jobs IList GetPending(); } - public class TaskManager : ITaskManager, IHandle, IHandleAsync, IHandleAsync + public class TaskManager : ITaskManager, IHandle, IHandle, IHandleAsync { private readonly IScheduledTaskRepository _scheduledTaskRepository; private readonly IConfigService _configService; @@ -79,7 +78,7 @@ namespace NzbDrone.Core.Jobs } } - public void HandleAsync(CommandExecutedEvent message) + public void Handle(CommandExecutedEvent message) { var scheduledTask = _scheduledTaskRepository.All().SingleOrDefault(c => c.TypeName == message.Command.GetType().FullName); @@ -97,4 +96,4 @@ namespace NzbDrone.Core.Jobs _scheduledTaskRepository.Update(rss); } } -} \ No newline at end of file +}