From 698e6b1533b843e4e717b8fe9c55dbdc5dff7be9 Mon Sep 17 00:00:00 2001 From: Bjarke Berg Date: Fri, 29 Oct 2021 10:55:47 +0200 Subject: [PATCH] Renamed interface to prepare for adding GetPagedRollbackVersions --- .../Composing/CompositionExtensions/Services.cs | 2 +- ...sionCleanupService.cs => IContentVersionService.cs} | 2 +- src/Umbraco.Core/Services/Implement/ContentService.cs | 2 +- src/Umbraco.Core/Umbraco.Core.csproj | 2 +- .../ContentVersionCleanup_Tests_UnitTests.cs | 10 +++++----- .../ContentVersionCleanupService_Tests_Integration.cs | 2 +- src/Umbraco.Web/Scheduling/ContentVersionCleanup.cs | 8 ++++---- src/Umbraco.Web/Scheduling/SchedulerComponent.cs | 8 ++++---- 8 files changed, 18 insertions(+), 18 deletions(-) rename src/Umbraco.Core/Services/{IContentVersionCleanupService.cs => IContentVersionService.cs} (87%) diff --git a/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs b/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs index 56a9b2f8aede..4f9a9532123e 100644 --- a/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs +++ b/src/Umbraco.Core/Composing/CompositionExtensions/Services.cs @@ -34,7 +34,7 @@ public static Composition ComposeServices(this Composition composition) composition.RegisterUnique(); composition.RegisterUnique(factory => factory.GetInstance()); - composition.RegisterUnique(factory => factory.GetInstance()); + composition.RegisterUnique(factory => factory.GetInstance()); composition.RegisterUnique(); composition.RegisterUnique(); diff --git a/src/Umbraco.Core/Services/IContentVersionCleanupService.cs b/src/Umbraco.Core/Services/IContentVersionService.cs similarity index 87% rename from src/Umbraco.Core/Services/IContentVersionCleanupService.cs rename to src/Umbraco.Core/Services/IContentVersionService.cs index 8b7e826f55f4..8c6cf0bd914d 100644 --- a/src/Umbraco.Core/Services/IContentVersionCleanupService.cs +++ b/src/Umbraco.Core/Services/IContentVersionService.cs @@ -4,7 +4,7 @@ namespace Umbraco.Core.Services { - public interface IContentVersionCleanupService + public interface IContentVersionService { /// /// Removes historic content versions according to a policy. diff --git a/src/Umbraco.Core/Services/Implement/ContentService.cs b/src/Umbraco.Core/Services/Implement/ContentService.cs index 5f6782e0b477..ec381923a557 100644 --- a/src/Umbraco.Core/Services/Implement/ContentService.cs +++ b/src/Umbraco.Core/Services/Implement/ContentService.cs @@ -19,7 +19,7 @@ namespace Umbraco.Core.Services.Implement /// /// Implements the content service. /// - public class ContentService : RepositoryService, IContentService, IContentVersionCleanupService + public class ContentService : RepositoryService, IContentService, IContentVersionService { private readonly IDocumentRepository _documentRepository; private readonly IEntityRepository _entityRepository; diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 3bc7aea782d8..cf5ffc9d0ca7 100755 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -199,7 +199,7 @@ - + diff --git a/src/Umbraco.Tests/Scheduling/ContentVersionCleanup_Tests_UnitTests.cs b/src/Umbraco.Tests/Scheduling/ContentVersionCleanup_Tests_UnitTests.cs index 82c5c0077ecc..e185f2524c90 100644 --- a/src/Umbraco.Tests/Scheduling/ContentVersionCleanup_Tests_UnitTests.cs +++ b/src/Umbraco.Tests/Scheduling/ContentVersionCleanup_Tests_UnitTests.cs @@ -18,7 +18,7 @@ class ContentVersionCleanup_Tests_UnitTests public void ContentVersionCleanup_WhenNotEnabled_DoesNotCleanupWillRepeat( [Frozen] Mock settings, [Frozen] Mock state, - [Frozen] Mock cleanupService, + [Frozen] Mock cleanupService, ContentVersionCleanup sut) { settings.Setup(x => x.EnableCleanup).Returns(false); @@ -40,7 +40,7 @@ public void ContentVersionCleanup_WhenNotEnabled_DoesNotCleanupWillRepeat( public void ContentVersionCleanup_RuntimeLevelNotRun_DoesNotCleanupWillRepeat( [Frozen] Mock settings, [Frozen] Mock state, - [Frozen] Mock cleanupService, + [Frozen] Mock cleanupService, ContentVersionCleanup sut) { settings.Setup(x => x.EnableCleanup).Returns(true); @@ -62,7 +62,7 @@ public void ContentVersionCleanup_RuntimeLevelNotRun_DoesNotCleanupWillRepeat( public void ContentVersionCleanup_ServerRoleUnknown_DoesNotCleanupWillRepeat( [Frozen] Mock settings, [Frozen] Mock state, - [Frozen] Mock cleanupService, + [Frozen] Mock cleanupService, ContentVersionCleanup sut) { settings.Setup(x => x.EnableCleanup).Returns(true); @@ -84,7 +84,7 @@ public void ContentVersionCleanup_ServerRoleUnknown_DoesNotCleanupWillRepeat( public void ContentVersionCleanup_NotMainDom_DoesNotCleanupWillNotRepeat( [Frozen] Mock settings, [Frozen] Mock state, - [Frozen] Mock cleanupService, + [Frozen] Mock cleanupService, ContentVersionCleanup sut) { settings.Setup(x => x.EnableCleanup).Returns(true); @@ -106,7 +106,7 @@ public void ContentVersionCleanup_NotMainDom_DoesNotCleanupWillNotRepeat( public void ContentVersionCleanup_Enabled_DelegatesToCleanupService( [Frozen] Mock settings, [Frozen] Mock state, - [Frozen] Mock cleanupService, + [Frozen] Mock cleanupService, ContentVersionCleanup sut) { settings.Setup(x => x.EnableCleanup).Returns(true); diff --git a/src/Umbraco.Tests/Services/ContentVersionCleanupService_Tests_Integration.cs b/src/Umbraco.Tests/Services/ContentVersionCleanupService_Tests_Integration.cs index 3e6fe63e13f1..ed177d35c31b 100644 --- a/src/Umbraco.Tests/Services/ContentVersionCleanupService_Tests_Integration.cs +++ b/src/Umbraco.Tests/Services/ContentVersionCleanupService_Tests_Integration.cs @@ -47,7 +47,7 @@ public void PerformContentVersionCleanup_WithNoKeepPeriods_DeletesEverythingExce // Kill all historic InsertCleanupPolicy(contentTypeA, 0, 0); - ((IContentVersionCleanupService)ServiceContext.ContentService).PerformContentVersionCleanup(DateTime.Now.AddHours(1)); + ((IContentVersionService)ServiceContext.ContentService).PerformContentVersionCleanup(DateTime.Now.AddHours(1)); var after = GetReport(); diff --git a/src/Umbraco.Web/Scheduling/ContentVersionCleanup.cs b/src/Umbraco.Web/Scheduling/ContentVersionCleanup.cs index 41971a652486..9a75b9be3cc0 100644 --- a/src/Umbraco.Web/Scheduling/ContentVersionCleanup.cs +++ b/src/Umbraco.Web/Scheduling/ContentVersionCleanup.cs @@ -12,7 +12,7 @@ internal class ContentVersionCleanup : RecurringTaskBase private readonly IRuntimeState _runtimeState; private readonly IProfilingLogger _logger; private readonly IContentVersionCleanupPolicyGlobalSettings _settings; - private readonly IContentVersionCleanupService _cleanupService; + private readonly IContentVersionService _service; public ContentVersionCleanup( IBackgroundTaskRunner runner, @@ -21,13 +21,13 @@ public ContentVersionCleanup( IRuntimeState runtimeState, IProfilingLogger logger, IContentVersionCleanupPolicyGlobalSettings settings, - IContentVersionCleanupService cleanupService) + IContentVersionService service) : base(runner, delayMilliseconds, periodMilliseconds) { _runtimeState = runtimeState ?? throw new ArgumentNullException(nameof(runtimeState)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _settings = settings ?? throw new ArgumentNullException(nameof(settings)); - _cleanupService = cleanupService ?? throw new ArgumentNullException(nameof(cleanupService)); + _service = service ?? throw new ArgumentNullException(nameof(service)); } public override bool PerformRun() @@ -65,7 +65,7 @@ public override bool PerformRun() return false; // do NOT repeat, going down } - var count = _cleanupService.PerformContentVersionCleanup(DateTime.Now).Count; + var count = _service.PerformContentVersionCleanup(DateTime.Now).Count; if (count > 0) { diff --git a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs index a8f4cc1e767d..02204667b388 100644 --- a/src/Umbraco.Web/Scheduling/SchedulerComponent.cs +++ b/src/Umbraco.Web/Scheduling/SchedulerComponent.cs @@ -25,7 +25,7 @@ public sealed class SchedulerComponent : IComponent private readonly IRuntimeState _runtime; private readonly IContentService _contentService; - private readonly IContentVersionCleanupService _cleanupService; + private readonly IContentVersionService _service; private readonly IAuditService _auditService; private readonly IProfilingLogger _logger; private readonly IScopeProvider _scopeProvider; @@ -48,7 +48,7 @@ public sealed class SchedulerComponent : IComponent public SchedulerComponent( IRuntimeState runtime, IContentService contentService, - IContentVersionCleanupService cleanupService, + IContentVersionService service, IAuditService auditService, HealthCheckCollection healthChecks, HealthCheckNotificationMethodCollection notifications, @@ -58,7 +58,7 @@ public SchedulerComponent( { _runtime = runtime; _contentService = contentService; - _cleanupService = cleanupService; + _service = service; _auditService = auditService; _scopeProvider = scopeProvider; _logger = logger; @@ -203,7 +203,7 @@ private IBackgroundTask RegisterContentVersionCleanup(IUmbracoSettingsSection se _runtime, _logger, settings.Content.ContentVersionCleanupPolicyGlobalSettings, - _cleanupService); + _service); _contentVersionCleanupRunner.TryAdd(task);