diff --git a/doc/dependency_decisions.yml b/doc/dependency_decisions.yml index abdfbe3..dc9c67b 100755 --- a/doc/dependency_decisions.yml +++ b/doc/dependency_decisions.yml @@ -4,7 +4,7 @@ - :who: mocsharp :why: MIT (https://github.com/ardalis/GuardClauses.Analyzers/raw/master/LICENSE) :versions: - - 4.0.1 + - 4.1.1 :when: 2022-08-16 21:39:30.077666354 Z - - :approve - Castle.Core @@ -18,7 +18,7 @@ - :who: mocsharp :why: MIT (https://github.com/coverlet-coverage/coverlet/raw/master/LICENSE) :versions: - - 3.2.0 + - 6.0.0 :when: 2022-08-16 21:40:21.855388365 Z - - :approve - JetBrains.Annotations @@ -32,7 +32,7 @@ - :who: woodheadio :why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) :versions: - - 6.0.14 + - 6.0.21 :when: 2023-08-16 16:49:26.950721112 Z - - :approve - Microsoft.CodeCoverage @@ -60,14 +60,14 @@ - :who: woodheadio :why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) :versions: - - 6.0.14 + - 6.0.21 :when: 2023-08-16 16:49:26.950721112 Z - - :approve - Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions - :who: woodheadio :why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) :versions: - - 6.0.14 + - 6.0.21 :when: 2023-08-16 16:49:26.950721112 Z - - :approve - Microsoft.Extensions.FileProviders.Abstractions @@ -109,7 +109,7 @@ - :who: woodheadio :why: MIT (https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) :versions: - - 17.5.0 + - 17.7.0 :when: 2023-08-16 16:49:26.950721112 Z - - :approve - Microsoft.NETCore.Platforms @@ -151,7 +151,7 @@ - :who: woodheadio :why: BSD 3-Clause License ( https://raw.githubusercontent.com/moq/moq4/main/License.txt) :versions: - - 4.18.4 + - 4.20.69 :when: 2023-08-16 16:49:26.950721112 Z - - :approve - NETStandard.Library @@ -179,14 +179,14 @@ - :who: mocsharp :why: MIT ( https://licenses.nuget.org/MIT) :versions: - - 7.2.3 + - 7.2.4 :when: 2022-11-09 18:57:32.294717110 Z - - :approve - RabbitMQ.Client - :who: mocsharp :why: Apache-2.0 (https://github.com/rabbitmq/rabbitmq-dotnet-client/raw/main/LICENSE-APACHE2) :versions: - - 6.4.0 + - 6.5.0 :when: 2022-08-16 21:39:52.474284611 Z - - :approve - runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl @@ -739,7 +739,7 @@ - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) :versions: - - 2.4.2 + - 2.5.0 :when: 2022-08-16 21:40:29.166018542 Z - - :approve - xunit.abstractions @@ -760,28 +760,28 @@ - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) :versions: - - 2.4.2 + - 2.5.0 :when: 2022-08-16 21:40:30.526718458 Z - - :approve - xunit.core - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) :versions: - - 2.4.2 + - 2.5.0 :when: 2022-08-16 21:40:30.973515441 Z - - :approve - xunit.extensibility.core - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) :versions: - - 2.4.2 + - 2.5.0 :when: 2022-08-16 21:40:31.401607230 Z - - :approve - xunit.extensibility.execution - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) :versions: - - 2.4.2 + - 2.5.0 :when: 2022-08-16 21:40:31.845685693 Z - - :approve - xunit.runner.visualstudio @@ -789,4 +789,4 @@ :why: MIT ( https://licenses.nuget.org/MIT) :versions: - 2.4.5 - :when: 2022-08-16 21:40:32.294717110 Z \ No newline at end of file + :when: 2022-08-16 21:40:32.294717110 Z diff --git a/src/Messaging/Events/ExportCompleteEvent.cs b/src/Messaging/Events/ExportCompleteEvent.cs index 5b96704..432b8b5 100755 --- a/src/Messaging/Events/ExportCompleteEvent.cs +++ b/src/Messaging/Events/ExportCompleteEvent.cs @@ -76,9 +76,9 @@ public ExportCompleteEvent() public ExportCompleteEvent(ExportRequestEvent exportRequest, ExportStatus exportStatus, Dictionary fileStatuses) { - Guard.Against.Null(exportRequest); - Guard.Against.Null(exportStatus); - Guard.Against.Null(fileStatuses); + Guard.Against.Null(exportRequest, nameof(exportRequest)); + Guard.Against.Null(exportStatus, nameof(exportStatus)); + Guard.Against.Null(fileStatuses, nameof(fileStatuses)); WorkflowInstanceId = exportRequest.WorkflowInstanceId; ExportTaskId = exportRequest.ExportTaskId; diff --git a/src/Messaging/Monai.Deploy.Messaging.csproj b/src/Messaging/Monai.Deploy.Messaging.csproj index 3834df4..4c5df90 100644 --- a/src/Messaging/Monai.Deploy.Messaging.csproj +++ b/src/Messaging/Monai.Deploy.Messaging.csproj @@ -74,8 +74,8 @@ - - + + diff --git a/src/Messaging/Tests/Monai.Deploy.Messaging.Tests.csproj b/src/Messaging/Tests/Monai.Deploy.Messaging.Tests.csproj index 35ddd1f..3ca0050 100644 --- a/src/Messaging/Tests/Monai.Deploy.Messaging.Tests.csproj +++ b/src/Messaging/Tests/Monai.Deploy.Messaging.Tests.csproj @@ -32,14 +32,14 @@ - - - - + + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs b/src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs index 5fcf592..9fa63cd 100755 --- a/src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs +++ b/src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs @@ -48,10 +48,10 @@ public RabbitMQConnectionFactory(ILogger logger) public IModel CreateChannel(ChannelType type, string hostName, string username, string password, string virtualHost, string useSSL, string portNumber) { - Guard.Against.NullOrWhiteSpace(hostName); - Guard.Against.NullOrWhiteSpace(username); - Guard.Against.NullOrWhiteSpace(password); - Guard.Against.NullOrWhiteSpace(virtualHost); + Guard.Against.NullOrWhiteSpace(hostName, nameof(hostName)); + Guard.Against.NullOrWhiteSpace(username, nameof(username)); + Guard.Against.NullOrWhiteSpace(password, nameof(password)); + Guard.Against.NullOrWhiteSpace(virtualHost, nameof(virtualHost)); var key = $"{type}{hostName}{username}{HashPassword(password)}{virtualHost}"; @@ -154,7 +154,7 @@ private IConnection CreateConnectionOnly(string hostName, string username, strin private static object HashPassword(string password) { - Guard.Against.NullOrWhiteSpace(password); + Guard.Against.NullOrWhiteSpace(password, nameof(password)); var sha256 = SHA256.Create(); var hash = sha256.ComputeHash(Encoding.UTF8.GetBytes(password)); return string.Join("", hash.Select(x => x.ToString("x2", CultureInfo.InvariantCulture))); diff --git a/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj b/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj index d596579..4628a97 100644 --- a/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj +++ b/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj @@ -63,8 +63,8 @@ - - + + diff --git a/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs b/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs index 5059ec9..cf49876 100755 --- a/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs +++ b/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs @@ -49,7 +49,7 @@ public RabbitMQMessagePublisherService(IOptions logger, IRabbitMQConnectionFactory rabbitMqConnectionFactory) { - Guard.Against.Null(options); + Guard.Against.Null(options, nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _rabbitMqConnectionFactory = rabbitMqConnectionFactory ?? throw new ArgumentNullException(nameof(rabbitMqConnectionFactory)); @@ -83,7 +83,7 @@ public RabbitMQMessagePublisherService(IOptions configuration) { - Guard.Against.Null(configuration); + Guard.Against.Null(configuration, nameof(configuration)); foreach (var key in ConfigurationKeys.PublisherRequiredKeys) { @@ -96,8 +96,8 @@ internal static void ValidateConfiguration(Dictionary configurat public Task Publish(string topic, Message message) { - Guard.Against.NullOrWhiteSpace(topic); - Guard.Against.Null(message); + Guard.Against.NullOrWhiteSpace(topic, nameof(topic)); + Guard.Against.Null(message, nameof(message)); using var loggingScope = _logger.BeginScope(new LoggingDataDictionary { diff --git a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs index e96603d..7a1cda7 100755 --- a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs +++ b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs @@ -58,7 +58,7 @@ public RabbitMQMessageSubscriberService(IOptions logger, IRabbitMQConnectionFactory rabbitMqConnectionFactory) { - Guard.Against.Null(options); + Guard.Against.Null(options, nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _rabbitMqConnectionFactory = rabbitMqConnectionFactory ?? throw new ArgumentNullException(nameof(rabbitMqConnectionFactory)); @@ -137,7 +137,7 @@ private void Channel_ModelShutdown(object? sender, ShutdownEventArgs e) internal static void ValidateConfiguration(Dictionary configuration) { - Guard.Against.Null(configuration); + Guard.Against.Null(configuration, nameof(configuration)); foreach (var key in ConfigurationKeys.SubscriberRequiredKeys) { @@ -177,8 +177,8 @@ public void SubscribeAsync(string topic, string queue, Func messageReceivedCallback, ushort prefetchCount = 0) { - Guard.Against.Null(topics); - Guard.Against.Null(messageReceivedCallback); + Guard.Against.Null(topics, nameof(topics)); + Guard.Against.Null(messageReceivedCallback, nameof(messageReceivedCallback)); var queueDeclareResult = DeclareQueues(topics, queue, prefetchCount); var consumer = CreateConsumer(messageReceivedCallback, queueDeclareResult); @@ -273,7 +273,7 @@ private QueueDeclareOk DeclareQueues(string[] topics, string queue, ushort prefe public void Acknowledge(MessageBase message) { - Guard.Against.Null(message); + Guard.Against.Null(message, nameof(message)); CreateChannel(); @@ -290,6 +290,8 @@ public void Acknowledge(MessageBase message) public async Task RequeueWithDelay(MessageBase message) { + Guard.Against.Null(message, nameof(message)); + try { await Task.Delay(_requeueDelay * 1000).ConfigureAwait(false); @@ -305,7 +307,7 @@ public async Task RequeueWithDelay(MessageBase message) public void Reject(MessageBase message, bool requeue = true) { - Guard.Against.Null(message); + Guard.Against.Null(message, nameof(message)); CreateChannel(); @@ -344,8 +346,8 @@ public void Dispose() private void BindToRoutingKeys(string[] topics, string queue, string deadLetterQueue = "") { - Guard.Against.Null(topics); - Guard.Against.NullOrWhiteSpace(queue); + Guard.Against.Null(topics, nameof(topics)); + Guard.Against.NullOrWhiteSpace(queue, nameof(queue)); foreach (var topic in topics) { @@ -363,17 +365,17 @@ private void BindToRoutingKeys(string[] topics, string queue, string deadLetterQ private static MessageReceivedEventArgs CreateMessage(string topic, BasicDeliverEventArgs eventArgs) { - Guard.Against.NullOrWhiteSpace(topic); - Guard.Against.Null(eventArgs); - - Guard.Against.Null(eventArgs.Body); - Guard.Against.Null(eventArgs.BasicProperties); - Guard.Against.Null(eventArgs.BasicProperties.MessageId); - Guard.Against.Null(eventArgs.BasicProperties.AppId); - Guard.Against.Null(eventArgs.BasicProperties.ContentType); - Guard.Against.Null(eventArgs.BasicProperties.CorrelationId); - Guard.Against.Null(eventArgs.BasicProperties.Timestamp); - Guard.Against.Null(eventArgs.DeliveryTag); + Guard.Against.NullOrWhiteSpace(topic, nameof(topic)); + Guard.Against.Null(eventArgs, nameof(eventArgs)); + + Guard.Against.Null(eventArgs.Body, nameof(eventArgs.Body)); + Guard.Against.Null(eventArgs.BasicProperties, nameof(eventArgs.BasicProperties)); + Guard.Against.Null(eventArgs.BasicProperties.MessageId, nameof(eventArgs.BasicProperties.MessageId)); + Guard.Against.Null(eventArgs.BasicProperties.AppId, nameof(eventArgs.BasicProperties.AppId)); + Guard.Against.Null(eventArgs.BasicProperties.ContentType, nameof(eventArgs.BasicProperties.ContentType)); + Guard.Against.Null(eventArgs.BasicProperties.CorrelationId, nameof(eventArgs.BasicProperties.CorrelationId)); + Guard.Against.Null(eventArgs.BasicProperties.Timestamp, nameof(eventArgs.BasicProperties.Timestamp)); + Guard.Against.Null(eventArgs.DeliveryTag, nameof(eventArgs.DeliveryTag)); return new MessageReceivedEventArgs( new Message( diff --git a/src/Plugins/RabbitMQ/Tests/Monai.Deploy.Messaging.RabbitMQ.Tests.csproj b/src/Plugins/RabbitMQ/Tests/Monai.Deploy.Messaging.RabbitMQ.Tests.csproj index dbe76aa..45af62c 100644 --- a/src/Plugins/RabbitMQ/Tests/Monai.Deploy.Messaging.RabbitMQ.Tests.csproj +++ b/src/Plugins/RabbitMQ/Tests/Monai.Deploy.Messaging.RabbitMQ.Tests.csproj @@ -37,16 +37,16 @@ - - - + + + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all