diff --git a/COLID.SchedulerService.sln b/COLID.SchedulerService.sln index 6af4b60..7410401 100644 --- a/COLID.SchedulerService.sln +++ b/COLID.SchedulerService.sln @@ -21,6 +21,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IntegrationTests", "tests\I EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTests", "tests\FunctionalTests\FunctionalTests.csproj", "{6F3C5E00-AD14-40BD-8884-E7BF340A4B91}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F98DCEA5-1D81-4416-AAFA-8D8968F2C267}" + ProjectSection(SolutionItems) = preProject + .editorconfig = .editorconfig + coding.ruleset = coding.ruleset + Directory.Build.props = Directory.Build.props + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/Directory.Build.props b/Directory.Build.props index 6dbe9b0..f6da872 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,15 +1,14 @@ - - + + false + false + $(SolutionDir)coding.ruleset + COLID team Bayer AG - + + + \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 0a9e997..d369619 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,6 +12,13 @@ RUN dotnet publish -c release -o /app --no-restore # final stage/image FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-alpine + +ARG BUILD_CIPIPELINEID +ENV Build__CiPipelineId=${BUILD_CIPIPELINEID} + +ARG BUILD_CICOMMITSHA +ENV Build__CiCommitSha=${BUILD_CICOMMITSHA} + ENV PORT=8080 ENV ASPNETCORE_URLS=http://*:${PORT} EXPOSE $PORT diff --git a/coding.ruleset b/coding.ruleset index 6dc0bd0..717b345 100644 --- a/coding.ruleset +++ b/coding.ruleset @@ -28,7 +28,7 @@ - + @@ -47,7 +47,7 @@ - + @@ -64,7 +64,7 @@ - + @@ -104,7 +104,7 @@ - + @@ -115,7 +115,7 @@ - + @@ -672,6 +672,13 @@ + + + + + + + diff --git a/src/COLID.Scheduler.Common/Constants/Metadata.cs b/src/COLID.Scheduler.Common/Constants/Metadata.cs index 1e811d2..14c101d 100644 --- a/src/COLID.Scheduler.Common/Constants/Metadata.cs +++ b/src/COLID.Scheduler.Common/Constants/Metadata.cs @@ -11,7 +11,7 @@ public static class Metadata .SetBasePath(_filePath) .AddJsonFile("appsettings.json") .Build(); - public static readonly string _serviceUrl = _configuration.GetValue("ServiceUrl"); + private static readonly string _serviceUrl = _configuration.GetValue("ServiceUrl"); public static readonly string Author = _serviceUrl + "kos/19050/author"; diff --git a/src/COLID.Scheduler.Common/DataModels/ColidEntryContactInvalidUsersDto.cs b/src/COLID.Scheduler.Common/DataModels/ColidEntryContactInvalidUsersDto.cs index 30751e1..264b2dd 100644 --- a/src/COLID.Scheduler.Common/DataModels/ColidEntryContactInvalidUsersDto.cs +++ b/src/COLID.Scheduler.Common/DataModels/ColidEntryContactInvalidUsersDto.cs @@ -9,7 +9,7 @@ public class ColidEntryContactInvalidUsersDto { public string ContactMail { get; set; } - public List ColidEntries { get; set; } + public IList ColidEntries { get; set; } public ColidEntryContactInvalidUsersDto() { diff --git a/src/COLID.Scheduler.Common/RegexUtilities.cs b/src/COLID.Scheduler.Common/RegexUtilities.cs index 28f5ff8..77f70fa 100644 --- a/src/COLID.Scheduler.Common/RegexUtilities.cs +++ b/src/COLID.Scheduler.Common/RegexUtilities.cs @@ -5,7 +5,7 @@ namespace COLID.Scheduler.Common { // Original from https://docs.microsoft.com/de-de/dotnet/standard/base-types/how-to-verify-that-strings-are-in-valid-email-format - public class RegexUtilities + public static class RegexUtilities { public static bool IsValidEmail(string email) { diff --git a/src/COLID.Scheduler.Jobs/COLID.Scheduler.Jobs.csproj b/src/COLID.Scheduler.Jobs/COLID.Scheduler.Jobs.csproj index 30044b1..9300a57 100644 --- a/src/COLID.Scheduler.Jobs/COLID.Scheduler.Jobs.csproj +++ b/src/COLID.Scheduler.Jobs/COLID.Scheduler.Jobs.csproj @@ -19,4 +19,8 @@ + + + + diff --git a/src/COLID.Scheduler.Jobs/HangfireModules.cs b/src/COLID.Scheduler.Jobs/HangfireModules.cs index 6c44ed4..47f4285 100644 --- a/src/COLID.Scheduler.Jobs/HangfireModules.cs +++ b/src/COLID.Scheduler.Jobs/HangfireModules.cs @@ -1,10 +1,11 @@ -using System; +using System; using System.Threading; using COLID.Scheduler.Common.Constants; using COLID.Scheduler.Jobs.Filter; -using COLID.Scheduler.Jobs.Interface; +using COLID.Scheduler.Jobs.Implementation; +using COLID.Scheduler.Jobs.Interfaces; using COLID.SchedulerService.Jobs.Implementation; -using COLID.SchedulerService.Jobs.Interface; +using COLID.SchedulerService.Jobs.Interfaces; using Hangfire; using Hangfire.MemoryStorage; using Hangfire.MySql; @@ -36,7 +37,9 @@ public static IServiceCollection RegisterJobs(this IServiceCollection services) services.AddTransient(); services.AddTransient(); services.AddTransient(); - services.AddTransient(); + services.AddTransient(); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); services.AddTransient(); @@ -76,8 +79,8 @@ public static IServiceCollection RegisterHangfire(this IServiceCollection servic .UseSimpleAssemblyNameTypeSerializer() .UseRecommendedSerializerSettings() .UseStorage(new MySqlStorage(config.GetConnectionString("MySQLConnection"). - Replace("{DB_USER}", config.GetValue("Database:User")). - Replace("{DB_PASSWORD}", config.GetValue("Database:Password")), + Replace("{DB_USER}", config.GetValue("Database:User"), StringComparison.Ordinal). + Replace("{DB_PASSWORD}", config.GetValue("Database:Password"), StringComparison.Ordinal), new MySqlStorageOptions { TransactionIsolationLevel = System.Transactions.IsolationLevel.ReadCommitted, @@ -112,7 +115,7 @@ public static IApplicationBuilder SetupHangfireServer(this IApplicationBuilder a DashboardOptions dOptions = new DashboardOptions(); dOptions.Authorization = new[] { new DashboardAuthorizationFilter() }; - if (config.GetValue("EnvironmentLabel").Equals("Production")) + if (config.GetValue("EnvironmentLabel").Equals("Production", StringComparison.Ordinal)) { dOptions.IsReadOnlyFunc = context => true; } @@ -187,11 +190,27 @@ public static IApplicationBuilder SetupHangfireJobs(this IApplicationBuilder app TimeZoneInfo.Local, Queue.Alpha); - var InvalidDitributionEndpointNotificationJob = config.GetValue("CronJobConfig:InvalidDitributionEndpointNotificationJob"); - logger.LogInformation("CronJob config for InvalidDitributionEndpointNotificationJob: {InvalidDitributionEndpointNotificationJob}", InvalidDitributionEndpointNotificationJob); - RecurringJob.AddOrUpdate(nameof(InvalidDitributionEndpointNotificationJob), + var BrokenEndpointNotificationJob = config.GetValue("CronJobConfig:BrokenEndpointNotificationJob"); + logger.LogInformation("CronJob config for BrokenEndpointNotificationJob: {BrokenEndpointNotificationJob}", BrokenEndpointNotificationJob); + RecurringJob.AddOrUpdate(nameof(BrokenEndpointNotificationJob), job => job.ExecuteAsync(CancellationToken.None), - config.GetValue("CronJobConfig:InvalidDitributionEndpointNotificationJob"), + config.GetValue("CronJobConfig:BrokenEndpointNotificationJob"), + TimeZoneInfo.Local, + Queue.Alpha); + + var BrokenContactsNotificationJob = config.GetValue("CronJobConfig:BrokenContactsNotificationJob"); + logger.LogInformation("CronJob config for BrokenContactsNotificationJob: {BrokenContactsNotificationJob}", BrokenContactsNotificationJob); + RecurringJob.AddOrUpdate(nameof(BrokenContactsNotificationJob), + job => job.ExecuteAsync(CancellationToken.None), + config.GetValue("CronJobConfig:BrokenContactsNotificationJob"), + TimeZoneInfo.Local, + Queue.Alpha); + + var SetBrokenFlagsInElasticJob = config.GetValue("CronJobConfig:SetBrokenFlagsInElastic"); + logger.LogInformation("CronJob config for SetBrokenFlagsInElasticJob: {SetBrokenFlagsInElasticJob}", SetBrokenFlagsInElasticJob); + RecurringJob.AddOrUpdate(nameof(SetBrokenFlagsInElasticJob), + job => job.ExecuteAsync(CancellationToken.None), + config.GetValue("CronJobConfig:SetBrokenFlagsInElastic"), TimeZoneInfo.Local, Queue.Alpha); diff --git a/src/COLID.Scheduler.Jobs/Implementation/BrokenContactNotificationJob.cs b/src/COLID.Scheduler.Jobs/Implementation/BrokenContactNotificationJob.cs new file mode 100644 index 0000000..26828a3 --- /dev/null +++ b/src/COLID.Scheduler.Jobs/Implementation/BrokenContactNotificationJob.cs @@ -0,0 +1,36 @@ +using System.Threading; +using System.Threading.Tasks; +using COLID.Scheduler.Services.Interfaces; +using Hangfire; +using Microsoft.Extensions.Logging; +using COLID.Scheduler.Common.Constants; +using COLID.Scheduler.Jobs.Interfaces; + +namespace COLID.Scheduler.Jobs.Implementation +{ + public class BrokenContactNotificationJob : IBrokenContactNotificationJob + { + private readonly IBackgroundJobClient _backgroundJobClient; + private readonly ILogger _logger; + private readonly IRemoteRegistrationService _registrationService; + + public BrokenContactNotificationJob(IBackgroundJobClient backgroundJobClient, ILogger logger, IRemoteRegistrationService registrationService) + { + _backgroundJobClient = backgroundJobClient; + _logger = logger; + _registrationService = registrationService; + } + + [Queue(Queue.Beta)] + public async Task ExecuteAsync(CancellationToken token) + { + _backgroundJobClient.Enqueue(x => x.CheckDataStewardsAndDistributionEndpointContactsAndNotifyUsers()); + _logger.LogInformation("CheckInvalidContacts Job Finished"); + } + + public async Task CheckDataStewardsAndDistributionEndpointContactsAndNotifyUsers() + { + await _registrationService.CheckDataStewardsAndDistributionEndpointContactsAndNotifyUsers(); + } + } +} diff --git a/src/COLID.Scheduler.Jobs/Implementation/BrokenEndpointNotificationJob.cs b/src/COLID.Scheduler.Jobs/Implementation/BrokenEndpointNotificationJob.cs new file mode 100644 index 0000000..de9d2da --- /dev/null +++ b/src/COLID.Scheduler.Jobs/Implementation/BrokenEndpointNotificationJob.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Hangfire; +using System.Threading; +using System.Threading.Tasks; +using COLID.SchedulerService.Jobs.Interfaces; +using Microsoft.Extensions.Logging; +using COLID.Scheduler.Common.Constants; +using COLID.Scheduler.Services.Interfaces; + +namespace COLID.SchedulerService.Jobs.Implementation +{ + class BrokenEndpointNotificationJob : IBrokenEndpointNotificationJob + { + private readonly IBackgroundJobClient _backgroundJobClient; + private readonly ILogger _logger; + private readonly IRemoteRegistrationService _registrationService; + + public BrokenEndpointNotificationJob(IBackgroundJobClient backgroundJobClient, ILogger logger, IRemoteRegistrationService registrationService) + { + _backgroundJobClient = backgroundJobClient; + _logger = logger; + _registrationService = registrationService; + } + + [Queue(Queue.Beta)] +#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously + public async Task ExecuteAsync(CancellationToken token) +#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously + { + _backgroundJobClient.Enqueue(x => x.NotifyUsersForInvalidDistributionEndpoints()); + _logger.LogInformation("InvalidDitributionEndpointNotification Job Finished"); + } + + public void NotifyUsersForInvalidDistributionEndpoints() + { + _logger.LogInformation("Calling registration api for to check the invalid distribution endpoint(s)"); + _registrationService.CheckDistributionEndpointValidityAndNotifyUsersAsync(); + } + } +} diff --git a/src/COLID.Scheduler.Jobs/Implementation/DueResourcesNotificationJob.cs b/src/COLID.Scheduler.Jobs/Implementation/DueResourcesNotificationJob.cs index cb77a38..ca95e3c 100644 --- a/src/COLID.Scheduler.Jobs/Implementation/DueResourcesNotificationJob.cs +++ b/src/COLID.Scheduler.Jobs/Implementation/DueResourcesNotificationJob.cs @@ -2,8 +2,8 @@ using System.Threading; using System.Threading.Tasks; using COLID.Scheduler.Common.Constants; -using COLID.Scheduler.Services.Interface; -using COLID.SchedulerService.Jobs.Interface; +using COLID.Scheduler.Services.Interfaces; +using COLID.SchedulerService.Jobs.Interfaces; using Hangfire; using Microsoft.Extensions.Logging; diff --git a/src/COLID.Scheduler.Jobs/Implementation/EntryChangedNotificationJob.cs b/src/COLID.Scheduler.Jobs/Implementation/EntryChangedNotificationJob.cs index 22ca048..468d740 100644 --- a/src/COLID.Scheduler.Jobs/Implementation/EntryChangedNotificationJob.cs +++ b/src/COLID.Scheduler.Jobs/Implementation/EntryChangedNotificationJob.cs @@ -2,7 +2,7 @@ using System.Threading; using System.Threading.Tasks; using COLID.Scheduler.Common.Constants; -using COLID.SchedulerService.Jobs.Interface; +using COLID.SchedulerService.Jobs.Interfaces; using Hangfire; using Microsoft.Extensions.Logging; diff --git a/src/COLID.Scheduler.Jobs/Implementation/InvalidContactNotificationJob.cs b/src/COLID.Scheduler.Jobs/Implementation/InvalidContactNotificationJob.cs new file mode 100644 index 0000000..8f12200 --- /dev/null +++ b/src/COLID.Scheduler.Jobs/Implementation/InvalidContactNotificationJob.cs @@ -0,0 +1,40 @@ +using System; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using COLID.Scheduler.Services.Interfaces; +using COLID.SchedulerService.Jobs.Implementation; +using COLID.SchedulerService.Jobs.Interfaces; +using Hangfire; +using Microsoft.Extensions.Logging; +using COLID.Scheduler.Common.Constants; +using COLID.Scheduler.Jobs.Interfaces; + +namespace COLID.Scheduler.Jobs.Implementation +{ + public class InvalidContactNotificationJob : IInvalidContactNotificationJob + { + private readonly IBackgroundJobClient _backgroundJobClient; + private readonly ILogger _logger; + private readonly IRemoteRegistrationService _registrationService; + + public InvalidContactNotificationJob(IBackgroundJobClient backgroundJobClient, ILogger logger, IRemoteRegistrationService registrationService) + { + _backgroundJobClient = backgroundJobClient; + _logger = logger; + _registrationService = registrationService; + } + + [Queue(Queue.Beta)] + public async Task ExecuteAsync(CancellationToken token) + { + _backgroundJobClient.Enqueue(x => x.CheckDataStewardsAndDistributionEndpointContactsAndNotifyUsers()); + _logger.LogInformation("CheckInvalidContacts Job Finished"); + } + + public async Task CheckDataStewardsAndDistributionEndpointContactsAndNotifyUsers() + { + await _registrationService.CheckDataStewardsAndDistributionEndpointContactsAndNotifyUsers(); + } + } +} diff --git a/src/COLID.Scheduler.Jobs/Implementation/InvalidDitributionEndpointNotificationJob.cs b/src/COLID.Scheduler.Jobs/Implementation/InvalidDitributionEndpointNotificationJob.cs index f099f38..0d4d990 100644 --- a/src/COLID.Scheduler.Jobs/Implementation/InvalidDitributionEndpointNotificationJob.cs +++ b/src/COLID.Scheduler.Jobs/Implementation/InvalidDitributionEndpointNotificationJob.cs @@ -4,10 +4,10 @@ using Hangfire; using System.Threading; using System.Threading.Tasks; -using COLID.SchedulerService.Jobs.Interface; +using COLID.SchedulerService.Jobs.Interfaces; using Microsoft.Extensions.Logging; using COLID.Scheduler.Common.Constants; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; namespace COLID.SchedulerService.Jobs.Implementation { diff --git a/src/COLID.Scheduler.Jobs/Implementation/MessageDeletionJob.cs b/src/COLID.Scheduler.Jobs/Implementation/MessageDeletionJob.cs index f790af9..89731e5 100644 --- a/src/COLID.Scheduler.Jobs/Implementation/MessageDeletionJob.cs +++ b/src/COLID.Scheduler.Jobs/Implementation/MessageDeletionJob.cs @@ -2,8 +2,8 @@ using System.Threading; using System.Threading.Tasks; using COLID.Scheduler.Common.Constants; -using COLID.Scheduler.Services.Interface; -using COLID.SchedulerService.Jobs.Interface; +using COLID.Scheduler.Services.Interfaces; +using COLID.SchedulerService.Jobs.Interfaces; using Hangfire; using Microsoft.Extensions.Logging; diff --git a/src/COLID.Scheduler.Jobs/Implementation/MessageMailingJob.cs b/src/COLID.Scheduler.Jobs/Implementation/MessageMailingJob.cs index bb38be0..bc48e40 100644 --- a/src/COLID.Scheduler.Jobs/Implementation/MessageMailingJob.cs +++ b/src/COLID.Scheduler.Jobs/Implementation/MessageMailingJob.cs @@ -6,8 +6,8 @@ using System.Threading.Tasks; using COLID.Scheduler.Common.Constants; using COLID.Scheduler.Common.DataModels; -using COLID.Scheduler.Services.Interface; -using COLID.SchedulerService.Jobs.Interface; +using COLID.Scheduler.Services.Interfaces; +using COLID.SchedulerService.Jobs.Interfaces; using Hangfire; using Microsoft.Extensions.Logging; @@ -67,7 +67,7 @@ public void MarkMessagesAsSent(ICollection messages) _logger.LogInformation($"Messages for {mailAddress} marked as sent."); } - private string CreateEmailBody(IEnumerable messages) + private static string CreateEmailBody(IEnumerable messages) { StringBuilder emailBody = new StringBuilder(); diff --git a/src/COLID.Scheduler.Jobs/Implementation/ResourceStatisticsJob.cs b/src/COLID.Scheduler.Jobs/Implementation/ResourceStatisticsJob.cs index 6203344..fa2217d 100644 --- a/src/COLID.Scheduler.Jobs/Implementation/ResourceStatisticsJob.cs +++ b/src/COLID.Scheduler.Jobs/Implementation/ResourceStatisticsJob.cs @@ -2,12 +2,12 @@ using System.Threading; using System.Threading.Tasks; using COLID.Scheduler.Common.Constants; -using COLID.Scheduler.Jobs.Interface; -using COLID.SchedulerService.Jobs.Interface; +using COLID.Scheduler.Jobs.Interfaces; +using COLID.SchedulerService.Jobs.Interfaces; using Hangfire; using Microsoft.Extensions.Logging; using COLID.StatisticsLog.Services; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using COLID.Scheduler.Common.DataModels; using System.Collections.Generic; using System.Linq; @@ -63,7 +63,7 @@ public async Task ExecuteAsync(CancellationToken token) /// /// list of statistics received from reporting service /// dictionary with consumer statistics - private Dictionary GetStatisticsByBasicProperty(List propertyCharacteristicsDto) + private static Dictionary GetStatisticsByBasicProperty(List propertyCharacteristicsDto) { var result = new Dictionary(); foreach (var propertyCharacteristics in propertyCharacteristicsDto) diff --git a/src/COLID.Scheduler.Jobs/Implementation/SaveSearchesSubscriptionsFavListStasticsJob.cs b/src/COLID.Scheduler.Jobs/Implementation/SaveSearchesSubscriptionsFavListStasticsJob.cs index 8a211fc..711c06c 100644 --- a/src/COLID.Scheduler.Jobs/Implementation/SaveSearchesSubscriptionsFavListStasticsJob.cs +++ b/src/COLID.Scheduler.Jobs/Implementation/SaveSearchesSubscriptionsFavListStasticsJob.cs @@ -2,12 +2,12 @@ using System.Threading; using System.Threading.Tasks; using COLID.Scheduler.Common.Constants; -using COLID.Scheduler.Jobs.Interface; -using COLID.SchedulerService.Jobs.Interface; +using COLID.Scheduler.Jobs.Interfaces; +using COLID.SchedulerService.Jobs.Interfaces; using Hangfire; using Microsoft.Extensions.Logging; using COLID.StatisticsLog.Services; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using COLID.Scheduler.Common.DataModels; using System.Collections.Generic; using System.Linq; diff --git a/src/COLID.Scheduler.Jobs/Implementation/SetBrokenFlagsInElasticJob.cs b/src/COLID.Scheduler.Jobs/Implementation/SetBrokenFlagsInElasticJob.cs new file mode 100644 index 0000000..73809f2 --- /dev/null +++ b/src/COLID.Scheduler.Jobs/Implementation/SetBrokenFlagsInElasticJob.cs @@ -0,0 +1,36 @@ +using System.Threading; +using System.Threading.Tasks; +using COLID.Scheduler.Services.Interfaces; +using Hangfire; +using Microsoft.Extensions.Logging; +using COLID.Scheduler.Common.Constants; +using COLID.Scheduler.Jobs.Interfaces; + +namespace COLID.Scheduler.Jobs.Implementation +{ + public class SetBrokenFlagsInElasticJob : ISetBrokenFlagsInElasticJob + { + private readonly IBackgroundJobClient _backgroundJobClient; + private readonly ILogger _logger; + private readonly IRemoteRegistrationService _registrationService; + + public SetBrokenFlagsInElasticJob(IBackgroundJobClient backgroundJobClient, ILogger logger, IRemoteRegistrationService registrationService) + { + _backgroundJobClient = backgroundJobClient; + _logger = logger; + _registrationService = registrationService; + } + + [Queue(Queue.Beta)] + public async Task ExecuteAsync(CancellationToken token) + { + _backgroundJobClient.Enqueue(x => x.SetBrokenFlagsInElastic()); + _logger.LogInformation("SetBrokenFlagsInElastic Job Finished"); + } + + public async Task SetBrokenFlagsInElastic() + { + await _registrationService.SetBrokenFlagsInElastic(); + } + } +} diff --git a/src/COLID.Scheduler.Jobs/Implementation/StoredQueriesExecutionJob.cs b/src/COLID.Scheduler.Jobs/Implementation/StoredQueriesExecutionJob.cs index 61edc1c..9827831 100644 --- a/src/COLID.Scheduler.Jobs/Implementation/StoredQueriesExecutionJob.cs +++ b/src/COLID.Scheduler.Jobs/Implementation/StoredQueriesExecutionJob.cs @@ -4,8 +4,8 @@ using System.Threading.Tasks; using COLID.Scheduler.Common.Constants; using COLID.Scheduler.Common.DataModels; -using COLID.Scheduler.Services.Interface; -using COLID.SchedulerService.Jobs.Interface; +using COLID.Scheduler.Services.Interfaces; +using COLID.SchedulerService.Jobs.Interfaces; using Hangfire; using Microsoft.Extensions.Logging; diff --git a/src/COLID.Scheduler.Jobs/Implementation/UniqueUserStatisticsJob.cs b/src/COLID.Scheduler.Jobs/Implementation/UniqueUserStatisticsJob.cs index 34a6bf0..3b237fc 100644 --- a/src/COLID.Scheduler.Jobs/Implementation/UniqueUserStatisticsJob.cs +++ b/src/COLID.Scheduler.Jobs/Implementation/UniqueUserStatisticsJob.cs @@ -2,12 +2,12 @@ using System.Threading; using System.Threading.Tasks; using COLID.Scheduler.Common.Constants; -using COLID.Scheduler.Jobs.Interface; -using COLID.SchedulerService.Jobs.Interface; +using COLID.Scheduler.Jobs.Interfaces; +using COLID.SchedulerService.Jobs.Interfaces; using Hangfire; using Microsoft.Extensions.Logging; using COLID.StatisticsLog.Services; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using COLID.Scheduler.Common.DataModels; using System.Collections.Generic; using System.Linq; diff --git a/src/COLID.Scheduler.Jobs/Implementation/UserInvalidNotificationJob.cs b/src/COLID.Scheduler.Jobs/Implementation/UserInvalidNotificationJob.cs index fb4cc4e..c3b44f9 100644 --- a/src/COLID.Scheduler.Jobs/Implementation/UserInvalidNotificationJob.cs +++ b/src/COLID.Scheduler.Jobs/Implementation/UserInvalidNotificationJob.cs @@ -7,8 +7,8 @@ using COLID.Scheduler.Common; using COLID.Scheduler.Common.Constants; using COLID.Scheduler.Common.DataModels; -using COLID.Scheduler.Jobs.Interface; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Jobs.Interfaces; +using COLID.Scheduler.Services.Interfaces; using Hangfire; using Microsoft.Extensions.Logging; using Queue = COLID.Scheduler.Common.Constants.Queue; @@ -107,7 +107,7 @@ private static bool IsTechnicalUserInEntry(ColidEntryContactsDto colidEntryConta .All(c => c.IsTechnicalContact); } - private IEnumerable RemoveInvalidEmailsByPattern(IEnumerable adUserEmailSet) + private static IEnumerable RemoveInvalidEmailsByPattern(IEnumerable adUserEmailSet) { var validEmails = new HashSet(adUserEmailSet.Count()); foreach (var potentialMail in adUserEmailSet) diff --git a/src/COLID.Scheduler.Jobs/Interfaces/IBrokenContactNotificationJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IBrokenContactNotificationJob.cs new file mode 100644 index 0000000..849a36a --- /dev/null +++ b/src/COLID.Scheduler.Jobs/Interfaces/IBrokenContactNotificationJob.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using COLID.SchedulerService.Jobs.Interfaces; + +namespace COLID.Scheduler.Jobs.Interfaces +{ + public interface IBrokenContactNotificationJob : IJob + { + Task CheckDataStewardsAndDistributionEndpointContactsAndNotifyUsers(); + } +} diff --git a/src/COLID.Scheduler.Jobs/Interfaces/IBrokenEndpointNotificationJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IBrokenEndpointNotificationJob.cs new file mode 100644 index 0000000..80d0f92 --- /dev/null +++ b/src/COLID.Scheduler.Jobs/Interfaces/IBrokenEndpointNotificationJob.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace COLID.SchedulerService.Jobs.Interfaces +{ + /// + /// Job to trigger notification informing user about invalid distribution endpoints associated with their resource(s). + /// + interface IBrokenEndpointNotificationJob : IJob + { + public void NotifyUsersForInvalidDistributionEndpoints(); + } +} diff --git a/src/COLID.Scheduler.Jobs/Interface/IDueResourcesNotificationJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IDueResourcesNotificationJob.cs similarity index 89% rename from src/COLID.Scheduler.Jobs/Interface/IDueResourcesNotificationJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/IDueResourcesNotificationJob.cs index 2cd3a95..9ad3d06 100644 --- a/src/COLID.Scheduler.Jobs/Interface/IDueResourcesNotificationJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/IDueResourcesNotificationJob.cs @@ -1,6 +1,6 @@ using System.Threading.Tasks; -namespace COLID.SchedulerService.Jobs.Interface +namespace COLID.SchedulerService.Jobs.Interfaces { /// /// Job to distribute the deletion of stored messages. diff --git a/src/COLID.Scheduler.Jobs/Interface/IEntryChangedNotificationJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IEntryChangedNotificationJob.cs similarity index 80% rename from src/COLID.Scheduler.Jobs/Interface/IEntryChangedNotificationJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/IEntryChangedNotificationJob.cs index 48738ec..1fccd60 100644 --- a/src/COLID.Scheduler.Jobs/Interface/IEntryChangedNotificationJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/IEntryChangedNotificationJob.cs @@ -1,4 +1,4 @@ -namespace COLID.SchedulerService.Jobs.Interface +namespace COLID.SchedulerService.Jobs.Interfaces { /// /// Job to distribute the notification in case an entry, to which a user subscribed, changed. diff --git a/src/COLID.Scheduler.Jobs/Interfaces/IInvalidContactNotificationJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IInvalidContactNotificationJob.cs new file mode 100644 index 0000000..83e4585 --- /dev/null +++ b/src/COLID.Scheduler.Jobs/Interfaces/IInvalidContactNotificationJob.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using COLID.SchedulerService.Jobs.Interfaces; + +namespace COLID.Scheduler.Jobs.Interfaces +{ + public interface IInvalidContactNotificationJob : IJob + { + Task CheckDataStewardsAndDistributionEndpointContactsAndNotifyUsers(); + } +} diff --git a/src/COLID.Scheduler.Jobs/Interface/IInvalidDitributionEndpointNotificationJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IInvalidDitributionEndpointNotificationJob.cs similarity index 88% rename from src/COLID.Scheduler.Jobs/Interface/IInvalidDitributionEndpointNotificationJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/IInvalidDitributionEndpointNotificationJob.cs index 3fc332c..04e807b 100644 --- a/src/COLID.Scheduler.Jobs/Interface/IInvalidDitributionEndpointNotificationJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/IInvalidDitributionEndpointNotificationJob.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace COLID.SchedulerService.Jobs.Interface +namespace COLID.SchedulerService.Jobs.Interfaces { /// /// Job to trigger notification informing user about invalid distribution endpoints associated with their resource(s). diff --git a/src/COLID.Scheduler.Jobs/Interface/IJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IJob.cs similarity index 90% rename from src/COLID.Scheduler.Jobs/Interface/IJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/IJob.cs index c6d2c1e..ad81f89 100644 --- a/src/COLID.Scheduler.Jobs/Interface/IJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/IJob.cs @@ -2,7 +2,7 @@ using System.Threading.Tasks; using Hangfire; -namespace COLID.SchedulerService.Jobs.Interface +namespace COLID.SchedulerService.Jobs.Interfaces { /// /// Base interface for jobs. diff --git a/src/COLID.Scheduler.Jobs/Interface/IMessageDeletionJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IMessageDeletionJob.cs similarity index 85% rename from src/COLID.Scheduler.Jobs/Interface/IMessageDeletionJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/IMessageDeletionJob.cs index e31d7f4..4517daa 100644 --- a/src/COLID.Scheduler.Jobs/Interface/IMessageDeletionJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/IMessageDeletionJob.cs @@ -1,4 +1,4 @@ -namespace COLID.SchedulerService.Jobs.Interface +namespace COLID.SchedulerService.Jobs.Interfaces { /// /// Job to distribute the deletion of stored messages. diff --git a/src/COLID.Scheduler.Jobs/Interface/IMessageMailingJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IMessageMailingJob.cs similarity index 94% rename from src/COLID.Scheduler.Jobs/Interface/IMessageMailingJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/IMessageMailingJob.cs index c433388..1011cdf 100644 --- a/src/COLID.Scheduler.Jobs/Interface/IMessageMailingJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/IMessageMailingJob.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using COLID.Scheduler.Common.DataModels; -namespace COLID.SchedulerService.Jobs.Interface +namespace COLID.SchedulerService.Jobs.Interfaces { /// /// Job to distribute the mailing of (stored) messages to the user. diff --git a/src/COLID.Scheduler.Jobs/Interface/IResourceStatisticsJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IResourceStatisticsJob.cs similarity index 81% rename from src/COLID.Scheduler.Jobs/Interface/IResourceStatisticsJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/IResourceStatisticsJob.cs index 6b3ba3b..2798f3d 100644 --- a/src/COLID.Scheduler.Jobs/Interface/IResourceStatisticsJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/IResourceStatisticsJob.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; -using COLID.SchedulerService.Jobs.Interface; +using COLID.SchedulerService.Jobs.Interfaces; -namespace COLID.Scheduler.Jobs.Interface +namespace COLID.Scheduler.Jobs.Interfaces { /// /// This Job fetches the ConsumerGroup, LifecycleStatus, InformationClassification and ResourceType diff --git a/src/COLID.Scheduler.Jobs/Interface/ISaveSearchesSubscriptionsFavListStasticsJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/ISaveSearchesSubscriptionsFavListStasticsJob.cs similarity index 81% rename from src/COLID.Scheduler.Jobs/Interface/ISaveSearchesSubscriptionsFavListStasticsJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/ISaveSearchesSubscriptionsFavListStasticsJob.cs index acfb22d..f16a4bd 100644 --- a/src/COLID.Scheduler.Jobs/Interface/ISaveSearchesSubscriptionsFavListStasticsJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/ISaveSearchesSubscriptionsFavListStasticsJob.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; -using COLID.SchedulerService.Jobs.Interface; +using COLID.SchedulerService.Jobs.Interfaces; -namespace COLID.Scheduler.Jobs.Interface +namespace COLID.Scheduler.Jobs.Interfaces { /// /// This Job fetches the Saved Searches, Subscriptions and Favorites List diff --git a/src/COLID.Scheduler.Jobs/Interfaces/ISetBrokenFlagsInElasticJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/ISetBrokenFlagsInElasticJob.cs new file mode 100644 index 0000000..65976f9 --- /dev/null +++ b/src/COLID.Scheduler.Jobs/Interfaces/ISetBrokenFlagsInElasticJob.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; +using System.Threading.Tasks; +using COLID.SchedulerService.Jobs.Interfaces; + +namespace COLID.Scheduler.Jobs.Interfaces +{ + public interface ISetBrokenFlagsInElasticJob : IJob + { + Task SetBrokenFlagsInElastic(); + } +} diff --git a/src/COLID.Scheduler.Jobs/Interface/IStoredQueriesExecutionJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IStoredQueriesExecutionJob.cs similarity index 81% rename from src/COLID.Scheduler.Jobs/Interface/IStoredQueriesExecutionJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/IStoredQueriesExecutionJob.cs index 0ff78c9..c45d8b0 100644 --- a/src/COLID.Scheduler.Jobs/Interface/IStoredQueriesExecutionJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/IStoredQueriesExecutionJob.cs @@ -1,4 +1,4 @@ -namespace COLID.SchedulerService.Jobs.Interface +namespace COLID.SchedulerService.Jobs.Interfaces { /// /// Job to trigger the execution of stored queries. diff --git a/src/COLID.Scheduler.Jobs/Interface/IUniqueUserStatisticsJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IUniqueUserStatisticsJob.cs similarity index 73% rename from src/COLID.Scheduler.Jobs/Interface/IUniqueUserStatisticsJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/IUniqueUserStatisticsJob.cs index 8c1b601..c793357 100644 --- a/src/COLID.Scheduler.Jobs/Interface/IUniqueUserStatisticsJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/IUniqueUserStatisticsJob.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; -using COLID.SchedulerService.Jobs.Interface; +using COLID.SchedulerService.Jobs.Interfaces; -namespace COLID.Scheduler.Jobs.Interface +namespace COLID.Scheduler.Jobs.Interfaces { /// /// This Job fetches and writes unique user counts to Elasticsearch. diff --git a/src/COLID.Scheduler.Jobs/Interface/IUserInvalidNotificationJob.cs b/src/COLID.Scheduler.Jobs/Interfaces/IUserInvalidNotificationJob.cs similarity index 61% rename from src/COLID.Scheduler.Jobs/Interface/IUserInvalidNotificationJob.cs rename to src/COLID.Scheduler.Jobs/Interfaces/IUserInvalidNotificationJob.cs index 194be23..823e245 100644 --- a/src/COLID.Scheduler.Jobs/Interface/IUserInvalidNotificationJob.cs +++ b/src/COLID.Scheduler.Jobs/Interfaces/IUserInvalidNotificationJob.cs @@ -1,9 +1,9 @@ using System; using System.Collections.Generic; using System.Text; -using COLID.SchedulerService.Jobs.Interface; +using COLID.SchedulerService.Jobs.Interfaces; -namespace COLID.Scheduler.Jobs.Interface +namespace COLID.Scheduler.Jobs.Interfaces { public interface IUserInvalidNotificationJob : IJob { diff --git a/src/COLID.Scheduler.Services/Implementation/MailService.cs b/src/COLID.Scheduler.Services/Implementation/MailService.cs index b38cb24..f201cb9 100644 --- a/src/COLID.Scheduler.Services/Implementation/MailService.cs +++ b/src/COLID.Scheduler.Services/Implementation/MailService.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Net; using System.Net.Mail; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using COLID.Scheduler.Services.Model; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; @@ -31,7 +31,7 @@ public bool SendEmail(string subject, string body, string recipient) client.Credentials = new NetworkCredential(_smtpOptions.User, _smtpOptions.Password); } - var message = new MailMessage(); + using var message = new MailMessage(); message.IsBodyHtml = true; message.Subject = subject; message.Body = body; diff --git a/src/COLID.Scheduler.Services/Implementation/RemoteAppDataService.cs b/src/COLID.Scheduler.Services/Implementation/RemoteAppDataService.cs index e767cf3..c606436 100644 --- a/src/COLID.Scheduler.Services/Implementation/RemoteAppDataService.cs +++ b/src/COLID.Scheduler.Services/Implementation/RemoteAppDataService.cs @@ -7,7 +7,7 @@ using COLID.Identity.Services; using COLID.Scheduler.Common.DataModels; using COLID.Scheduler.Services.Configuration; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using CorrelationId.Abstractions; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; diff --git a/src/COLID.Scheduler.Services/Implementation/RemoteRegistrationService.cs b/src/COLID.Scheduler.Services/Implementation/RemoteRegistrationService.cs index 5fd4324..990951a 100644 --- a/src/COLID.Scheduler.Services/Implementation/RemoteRegistrationService.cs +++ b/src/COLID.Scheduler.Services/Implementation/RemoteRegistrationService.cs @@ -1,11 +1,11 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Net.Http; using System.Threading; using System.Threading.Tasks; using COLID.Identity.Extensions; using COLID.Identity.Services; using COLID.Scheduler.Services.Configuration; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using CorrelationId.Abstractions; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; @@ -24,6 +24,8 @@ internal class RemoteRegistrationService : IRemoteRegistrationService private readonly ILogger _logger; private readonly string _appRegistrationServiceNotifyInvaildDistributionEndpointApi; + private readonly string _appRegistrationServiceNotifyInvalidContacts; + private readonly string _appRegistrationServiceStoreFlagsInElastic; private readonly string _appRegistrationServiceNotifyForDueReviewsApi; public RemoteRegistrationService( @@ -42,7 +44,9 @@ public RemoteRegistrationService( _logger = logger; var serverUrl = _configuration.GetConnectionString("RegistrationServiceUrl"); - _appRegistrationServiceNotifyInvaildDistributionEndpointApi = $"{serverUrl}/api/EndpointTest"; + _appRegistrationServiceNotifyInvaildDistributionEndpointApi = $"{serverUrl}/api/v3/resourceDataValidityCheck/checkDistributionEndpoints"; + _appRegistrationServiceNotifyInvalidContacts = $"{serverUrl}/api/v3/resourceDataValidityCheck/checkDataStewardsAndDistributionEndpointContacts"; + _appRegistrationServiceStoreFlagsInElastic = $"{serverUrl}/api/v3/resourceDataValidityCheck/setInvalidResourceDataInElastic"; _appRegistrationServiceNotifyForDueReviewsApi = $"{serverUrl}/api/v3/resource"; } public async Task CheckDistributionEndpointValidityAndNotifyUsersAsync() @@ -76,5 +80,31 @@ public async Task> NotifyDataStewardsForDueResourceRe return emailList; } } + + public async Task CheckDataStewardsAndDistributionEndpointContactsAndNotifyUsers() + { + using (var httpClient = _clientFactory.CreateClient()) + { + _logger.LogInformation("remote registration api called for checking invalid data stewards and distribution endpoint contacts"); + var response = await httpClient.SendRequestWithOptionsAsync( + HttpMethod.Get, _appRegistrationServiceNotifyInvalidContacts, string.Empty, + await _tokenService.GetAccessTokenForWebApiAsync().ConfigureAwait(false), _cancellationToken, _correlationContext.CorrelationContext); + + response.EnsureSuccessStatusCode(); + } + } + + public async Task SetBrokenFlagsInElastic() + { + using (var httpClient = _clientFactory.CreateClient()) + { + _logger.LogInformation("remote registration api called for setting broken flags in elastic"); + var response = await httpClient.SendRequestWithOptionsAsync( + HttpMethod.Get, _appRegistrationServiceStoreFlagsInElastic, string.Empty, + await _tokenService.GetAccessTokenForWebApiAsync().ConfigureAwait(false), _cancellationToken, _correlationContext.CorrelationContext); + + response.EnsureSuccessStatusCode(); + } + } } } diff --git a/src/COLID.Scheduler.Services/Implementation/RemoteReportingService.cs b/src/COLID.Scheduler.Services/Implementation/RemoteReportingService.cs index a4062a6..2895208 100644 --- a/src/COLID.Scheduler.Services/Implementation/RemoteReportingService.cs +++ b/src/COLID.Scheduler.Services/Implementation/RemoteReportingService.cs @@ -9,7 +9,7 @@ using COLID.Identity.Services; using COLID.Scheduler.Common.DataModels; using COLID.Scheduler.Services.Configuration; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using CorrelationId.Abstractions; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; diff --git a/src/COLID.Scheduler.Services/Implementation/RemoteSearchService.cs b/src/COLID.Scheduler.Services/Implementation/RemoteSearchService.cs index 5d01147..a2cf310 100644 --- a/src/COLID.Scheduler.Services/Implementation/RemoteSearchService.cs +++ b/src/COLID.Scheduler.Services/Implementation/RemoteSearchService.cs @@ -11,7 +11,7 @@ using COLID.Scheduler.Common.Constants; using COLID.Scheduler.Common.DataModels; using COLID.Scheduler.Services.Configuration; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using CorrelationId.Abstractions; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Configuration; @@ -31,7 +31,7 @@ internal class RemoteSearchService : IRemoteSearchService private readonly ILogger _logger; private readonly string _userEndpoint; - private readonly string _indexEndpoint; + //private readonly string _indexEndpoint; public RemoteSearchService( IHttpClientFactory clientFactory, diff --git a/src/COLID.Scheduler.Services/Implementation/SESMailService.cs b/src/COLID.Scheduler.Services/Implementation/SESMailService.cs index 7f04ac8..d20ea95 100644 --- a/src/COLID.Scheduler.Services/Implementation/SESMailService.cs +++ b/src/COLID.Scheduler.Services/Implementation/SESMailService.cs @@ -3,7 +3,7 @@ using System.Text; using Amazon.SimpleEmail; using Amazon.SimpleEmail.Model; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using COLID.Scheduler.Services.Model; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; diff --git a/src/COLID.Scheduler.Services/Interface/IMailService.cs b/src/COLID.Scheduler.Services/Interfaces/IMailService.cs similarity index 85% rename from src/COLID.Scheduler.Services/Interface/IMailService.cs rename to src/COLID.Scheduler.Services/Interfaces/IMailService.cs index 0e6df2c..08299ae 100644 --- a/src/COLID.Scheduler.Services/Interface/IMailService.cs +++ b/src/COLID.Scheduler.Services/Interfaces/IMailService.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; -namespace COLID.Scheduler.Services.Interface +namespace COLID.Scheduler.Services.Interfaces { /// /// Service to send mails via the AWS SES diff --git a/src/COLID.Scheduler.Services/Interface/IRemoteAppDataService.cs b/src/COLID.Scheduler.Services/Interfaces/IRemoteAppDataService.cs similarity index 98% rename from src/COLID.Scheduler.Services/Interface/IRemoteAppDataService.cs rename to src/COLID.Scheduler.Services/Interfaces/IRemoteAppDataService.cs index bd279bc..c0f45aa 100644 --- a/src/COLID.Scheduler.Services/Interface/IRemoteAppDataService.cs +++ b/src/COLID.Scheduler.Services/Interfaces/IRemoteAppDataService.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using COLID.Scheduler.Common.DataModels; -namespace COLID.Scheduler.Services.Interface +namespace COLID.Scheduler.Services.Interfaces { /// /// Service to handle communication and authentication with the external AppDataService diff --git a/src/COLID.Scheduler.Services/Interface/IRemoteRegistrationService.cs b/src/COLID.Scheduler.Services/Interfaces/IRemoteRegistrationService.cs similarity index 62% rename from src/COLID.Scheduler.Services/Interface/IRemoteRegistrationService.cs rename to src/COLID.Scheduler.Services/Interfaces/IRemoteRegistrationService.cs index 1767567..a7160f1 100644 --- a/src/COLID.Scheduler.Services/Interface/IRemoteRegistrationService.cs +++ b/src/COLID.Scheduler.Services/Interfaces/IRemoteRegistrationService.cs @@ -1,13 +1,16 @@ -using System; +using System; using System.Collections.Generic; using System.Text; using System.Threading.Tasks; -namespace COLID.Scheduler.Services.Interface +namespace COLID.Scheduler.Services.Interfaces { public interface IRemoteRegistrationService { Task CheckDistributionEndpointValidityAndNotifyUsersAsync(); + Task CheckDataStewardsAndDistributionEndpointContactsAndNotifyUsers(); + Task SetBrokenFlagsInElastic(); + Task> NotifyDataStewardsForDueResourceReview(); } } diff --git a/src/COLID.Scheduler.Services/Interface/IRemoteReportingService.cs b/src/COLID.Scheduler.Services/Interfaces/IRemoteReportingService.cs similarity index 97% rename from src/COLID.Scheduler.Services/Interface/IRemoteReportingService.cs rename to src/COLID.Scheduler.Services/Interfaces/IRemoteReportingService.cs index 31c85b1..ea0c4cb 100644 --- a/src/COLID.Scheduler.Services/Interface/IRemoteReportingService.cs +++ b/src/COLID.Scheduler.Services/Interfaces/IRemoteReportingService.cs @@ -3,7 +3,7 @@ using System.Threading.Tasks; using COLID.Scheduler.Common.DataModels; -namespace COLID.Scheduler.Services.Interface +namespace COLID.Scheduler.Services.Interfaces { /// /// Service to handle communication and authentication with the external ReportingService. diff --git a/src/COLID.Scheduler.Services/Interface/IRemoteSearchService.cs b/src/COLID.Scheduler.Services/Interfaces/IRemoteSearchService.cs similarity index 95% rename from src/COLID.Scheduler.Services/Interface/IRemoteSearchService.cs rename to src/COLID.Scheduler.Services/Interfaces/IRemoteSearchService.cs index 60e0091..2499217 100644 --- a/src/COLID.Scheduler.Services/Interface/IRemoteSearchService.cs +++ b/src/COLID.Scheduler.Services/Interfaces/IRemoteSearchService.cs @@ -5,7 +5,7 @@ using Nest; using Newtonsoft.Json.Linq; -namespace COLID.Scheduler.Services.Interface +namespace COLID.Scheduler.Services.Interfaces { /// /// Service to handle communication and authentication with the external SearchService. diff --git a/src/COLID.Scheduler.Services/ServicesModule.cs b/src/COLID.Scheduler.Services/ServicesModule.cs index a198306..d463b8e 100644 --- a/src/COLID.Scheduler.Services/ServicesModule.cs +++ b/src/COLID.Scheduler.Services/ServicesModule.cs @@ -1,7 +1,7 @@ using System; using COLID.Scheduler.Services.Configuration; using COLID.Scheduler.Services.Implementation; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using COLID.Scheduler.Services.Model; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; diff --git a/src/COLID.Scheduler.Web/appsettings.Development.json b/src/COLID.Scheduler.Web/appsettings.Development.json index 77ab34b..ddf2b4b 100644 --- a/src/COLID.Scheduler.Web/appsettings.Development.json +++ b/src/COLID.Scheduler.Web/appsettings.Development.json @@ -43,7 +43,9 @@ "UserInvalidNotificationJob": "0 1 * * *", "ResourceStatisticsJob": "0 3 * * *", "UniqueUserStatisticsJob": "0 3 * * *", - "InvalidDitributionEndpointNotificationJob": "0 0 * * 0", + "BrokenEndpointNotificationJob": "0 0 * * 0", + "BrokenContactsNotificationJob": "0 0 * * 0", + "SetBrokenFlagsInElastic": "0 6 * * 0", "DueResourcesNotificationJob": "0 0 * * 0", "SaveSearchesSubscriptionsFavListStasticsJob": "0 3 * * *" }, diff --git a/src/COLID.Scheduler.Web/appsettings.Docker.json b/src/COLID.Scheduler.Web/appsettings.Docker.json index 5017e11..170cd72 100644 --- a/src/COLID.Scheduler.Web/appsettings.Docker.json +++ b/src/COLID.Scheduler.Web/appsettings.Docker.json @@ -43,7 +43,9 @@ "UserInvalidNotificationJob": "*/20 * * * *", "ResourceStatisticsJob": "0 3 * * *", "UniqueUserStatisticsJob": "0 3 * * *", - "InvalidDitributionEndpointNotificationJob": "0 0 * * 0", + "BrokenEndpointNotificationJob": "0 0 * * 0", + "BrokenContactsNotificationJob": "0 0 * * 0", + "SetBrokenFlagsInElastic": "0 6 * * 0", "DueResourcesNotificationJob": "0 0 * * 0", "SaveSearchesSubscriptionsFavListStasticsJob": "0 3 * * *" }, diff --git a/src/COLID.Scheduler.Web/appsettings.Local.json b/src/COLID.Scheduler.Web/appsettings.Local.json index 32dd90e..eba1791 100644 --- a/src/COLID.Scheduler.Web/appsettings.Local.json +++ b/src/COLID.Scheduler.Web/appsettings.Local.json @@ -43,7 +43,9 @@ "UserInvalidNotificationJob": "*/20 * * * *", "ResourceStatisticsJob": "0 3 * * *", "UniqueUserStatisticsJob": "0 3 * * *", - "InvalidDitributionEndpointNotificationJob": "0 0 * * 0", + "BrokenEndpointNotificationJob": "0 0 * * 0", + "BrokenContactsNotificationJob": "0 0 * * 0", + "SetBrokenFlagsInElastic": "0 6 * * 0", "DueResourcesNotificationJob": "0 0 * * 0", "SaveSearchesSubscriptionsFavListStasticsJob": "0 3 * * *" }, diff --git a/src/COLID.Scheduler.Web/appsettings.Production.json b/src/COLID.Scheduler.Web/appsettings.Production.json index 1ade1c0..cdeb312 100644 --- a/src/COLID.Scheduler.Web/appsettings.Production.json +++ b/src/COLID.Scheduler.Web/appsettings.Production.json @@ -43,7 +43,9 @@ "UserInvalidNotificationJob": "0 1 * * *", "ResourceStatisticsJob": "0 3 * * *", "UniqueUserStatisticsJob": "0 3 * * *", - "InvalidDitributionEndpointNotificationJob": "0 0 * * 0", + "BrokenEndpointNotificationJob": "0 0 * * 0", + "BrokenContactsNotificationJob": "0 0 * * 0", + "SetBrokenFlagsInElastic": "0 6 * * 0", "DueResourcesNotificationJob": "0 0 * * 0", "SaveSearchesSubscriptionsFavListStasticsJob": "0 3 * * *" }, diff --git a/src/COLID.Scheduler.Web/appsettings.Release.json b/src/COLID.Scheduler.Web/appsettings.Release.json index a8dd588..b4dcce5 100644 --- a/src/COLID.Scheduler.Web/appsettings.Release.json +++ b/src/COLID.Scheduler.Web/appsettings.Release.json @@ -43,7 +43,9 @@ "UserInvalidNotificationJob": "0 1 * * *", "ResourceStatisticsJob": "0 3 * * *", "UniqueUserStatisticsJob": "0 3 * * *", - "InvalidDitributionEndpointNotificationJob": "0 0 * * 0", + "BrokenEndpointNotificationJob": "0 0 * * 0", + "BrokenContactsNotificationJob": "0 0 * * 0", + "SetBrokenFlagsInElastic": "0 6 * * 0", "DueResourcesNotificationJob": "0 0 * * 0", "SaveSearchesSubscriptionsFavListStasticsJob": "0 3 * * *" }, diff --git a/tests/FunctionalTests/Directory.Build.props b/tests/FunctionalTests/Directory.Build.props new file mode 100644 index 0000000..3e69eec --- /dev/null +++ b/tests/FunctionalTests/Directory.Build.props @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/tests/IntegrationTests/Directory.Build.props b/tests/IntegrationTests/Directory.Build.props new file mode 100644 index 0000000..3e69eec --- /dev/null +++ b/tests/IntegrationTests/Directory.Build.props @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/tests/UnitTests/Builder/ContactBuilder.cs b/tests/UnitTests/Builder/ContactBuilder.cs index b21a5d5..63bdc1c 100644 --- a/tests/UnitTests/Builder/ContactBuilder.cs +++ b/tests/UnitTests/Builder/ContactBuilder.cs @@ -16,7 +16,7 @@ public class ContactBuilder .SetBasePath(_filePath) .AddJsonFile("appsettings.json") .Build(); - public static readonly string _serviceUrl = _configuration.GetValue("ServiceUrl"); + private static readonly string _serviceUrl = _configuration.GetValue("ServiceUrl"); public ContactBuilder() { } diff --git a/tests/UnitTests/Directory.Build.props b/tests/UnitTests/Directory.Build.props new file mode 100644 index 0000000..3e69eec --- /dev/null +++ b/tests/UnitTests/Directory.Build.props @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/tests/UnitTests/Jobs/MessageDeletionJobTests.cs b/tests/UnitTests/Jobs/MessageDeletionJobTests.cs index 19dabdb..1d0d6a0 100644 --- a/tests/UnitTests/Jobs/MessageDeletionJobTests.cs +++ b/tests/UnitTests/Jobs/MessageDeletionJobTests.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using COLID.Common.Extensions; using COLID.Scheduler.Common.DataModels; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using COLID.SchedulerService.Jobs.Implementation; using Hangfire; using Hangfire.Common; diff --git a/tests/UnitTests/Jobs/UserInvalidNotificationJobTests.cs b/tests/UnitTests/Jobs/UserInvalidNotificationJobTests.cs index f5688fd..609e561 100644 --- a/tests/UnitTests/Jobs/UserInvalidNotificationJobTests.cs +++ b/tests/UnitTests/Jobs/UserInvalidNotificationJobTests.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using COLID.Common.Extensions; using COLID.Scheduler.Common.DataModels; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using COLID.SchedulerService.Jobs.Implementation; using Hangfire; using Hangfire.Common; @@ -110,15 +110,15 @@ public async Task CollectAndPrepareContactMessagesForEntries_Should_Call_Endpoin Assert.NotNull(resultList); Assert.NotEmpty(resultList); - var christian = resultList.First(x => x.ContactMail.Equals("christian.kaubisch.ext@bayer.com")); + var christian = resultList.First(x => x.ContactMail.Equals("christian.kaubisch.ext@bayer.com", StringComparison.Ordinal)); Assert.NotNull(christian); Assert.Equal(2, christian.ColidEntries.Count); - var simon = resultList.First(x => x.ContactMail.Equals("simon.lansing.ext@bayer.com")); + var simon = resultList.First(x => x.ContactMail.Equals("simon.lansing.ext@bayer.com", StringComparison.Ordinal)); Assert.NotNull(simon); Assert.Equal(1, simon.ColidEntries.Count); - var tim = resultList.FirstOrDefault(x => x.ContactMail.Equals("tim.odenthal.ext@bayer.com")); + var tim = resultList.FirstOrDefault(x => x.ContactMail.Equals("tim.odenthal.ext@bayer.com", StringComparison.Ordinal)); Assert.NotNull(tim); Assert.Equal(1, tim.ColidEntries.Count); diff --git a/tests/UnitTests/services/MailServiceTests.cs b/tests/UnitTests/services/MailServiceTests.cs index 401281b..7d1f04b 100644 --- a/tests/UnitTests/services/MailServiceTests.cs +++ b/tests/UnitTests/services/MailServiceTests.cs @@ -4,7 +4,7 @@ using System.Net.Mail; using System.Text; using COLID.Scheduler.Services.Implementation; -using COLID.Scheduler.Services.Interface; +using COLID.Scheduler.Services.Interfaces; using COLID.Scheduler.Services.Model; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options;