Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused references and clean up licenses #211

Merged
merged 4 commits into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
548 changes: 168 additions & 380 deletions doc/dependency_decisions.yml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/Messaging/Events/ExportCompleteEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public ExportCompleteEvent()

public ExportCompleteEvent(ExportRequestEvent exportRequest, ExportStatus exportStatus, Dictionary<string, FileExportStatus> 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;
Expand Down
9 changes: 3 additions & 6 deletions src/Messaging/Monai.Deploy.Messaging.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
~ Copyright 2021-2022 MONAI Consortium
~
~ Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -74,12 +74,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.14" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
<PackageReference Include="Ardalis.GuardClauses" Version="4.1.1" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="6.0.21" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.IO.Abstractions" Version="17.2.3" />
</ItemGroup>
</Project>
10 changes: 5 additions & 5 deletions src/Messaging/Tests/Monai.Deploy.Messaging.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
10 changes: 5 additions & 5 deletions src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

internal IReadOnlyList<IConnection> Connections
{
get { return _connections.Values.Select(p => p.connection).ToList(); }

Check warning on line 41 in src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / unit-test

Refactor 'Connections' into a method, properties should not copy collections.

Check warning on line 41 in src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / unit-test

Refactor 'Connections' into a method, properties should not copy collections.
}

public RabbitMQConnectionFactory(ILogger<RabbitMQConnectionFactory> logger)
Expand All @@ -48,15 +48,15 @@

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}";

var connection = _connections.AddOrUpdate(key,
x => MakeConnection(type, hostName, username, password, virtualHost, key, useSSL, portNumber),

Check warning on line 59 in src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / unit-test

Use the lambda parameter instead of capturing the argument 'key'
(updateKey, updateConnection) =>
{
// If connection to RMQ is lost and:
Expand All @@ -80,7 +80,7 @@
return connection.model;
}

private void ConnectionShutdown(ShutdownEventArgs args, IConnection value, string key)

Check warning on line 83 in src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs

View workflow job for this annotation

GitHub Actions / unit-test

Remove this unused method parameter 'value'.
{
_logger.ConnectionShutdown(args.ToString());
}
Expand Down Expand Up @@ -154,7 +154,7 @@

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)));
Expand Down
5 changes: 2 additions & 3 deletions src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Polly" Version="7.2.3" />
<PackageReference Include="RabbitMQ.Client" Version="6.4.0" />
<PackageReference Include="System.Collections.Concurrent" Version="4.3.0" />
<PackageReference Include="Polly" Version="7.2.4" />
<PackageReference Include="RabbitMQ.Client" Version="6.5.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public RabbitMQMessagePublisherService(IOptions<MessageBrokerServiceConfiguratio
ILogger<RabbitMQMessagePublisherService> 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));
Expand Down Expand Up @@ -83,7 +83,7 @@ public RabbitMQMessagePublisherService(IOptions<MessageBrokerServiceConfiguratio

internal static void ValidateConfiguration(Dictionary<string, string> configuration)
{
Guard.Against.Null(configuration);
Guard.Against.Null(configuration, nameof(configuration));

foreach (var key in ConfigurationKeys.PublisherRequiredKeys)
{
Expand All @@ -96,8 +96,8 @@ internal static void ValidateConfiguration(Dictionary<string, string> 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<string, object>
{
Expand Down
40 changes: 21 additions & 19 deletions src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
ILogger<RabbitMQMessageSubscriberService> 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));
Expand Down Expand Up @@ -112,7 +112,7 @@
_channel = _rabbitMqConnectionFactory.CreateChannel(ChannelType.Subscriber, _endpoint, _username, _password, _virtualHost, _useSSL, _portNumber);
_channel.ExchangeDeclare(_exchange, ExchangeType.Topic, durable: true, autoDelete: false);
_channel.ExchangeDeclare(_deadLetterExchange, ExchangeType.Topic, durable: true, autoDelete: false);
_channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false);

Check warning on line 115 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 115 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 115 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.

Check warning on line 115 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.

Check warning on line 115 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / unit-test

Dereference of a possibly null reference.

Check warning on line 115 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / unit-test

Dereference of a possibly null reference.

Check warning on line 115 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / analyze (csharp)

Dereference of a possibly null reference.

Check warning on line 115 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / analyze (csharp)

Dereference of a possibly null reference.
_channel.ModelShutdown += Channel_ModelShutdown;
_logger.ConnectedToRabbitMQ(Name, _endpoint, _virtualHost);
});
Expand All @@ -137,7 +137,7 @@

internal static void ValidateConfiguration(Dictionary<string, string> configuration)
{
Guard.Against.Null(configuration);
Guard.Against.Null(configuration, nameof(configuration));

foreach (var key in ConfigurationKeys.SubscriberRequiredKeys)
{
Expand Down Expand Up @@ -177,8 +177,8 @@

public void SubscribeAsync(string[] topics, string queue, Func<MessageReceivedEventArgs, Task> 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);
Expand Down Expand Up @@ -212,7 +212,7 @@
_logger.InvalidMessage(queueDeclareResult.QueueName, eventArgs.RoutingKey, eventArgs.BasicProperties.MessageId, ex);

_logger.SendingNAcknowledgement(eventArgs.BasicProperties.MessageId);
_channel.BasicNack(eventArgs.DeliveryTag, multiple: false, requeue: false);

Check warning on line 215 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 215 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / build (ubuntu-latest)

Dereference of a possibly null reference.

Check warning on line 215 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.

Check warning on line 215 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / build (windows-latest)

Dereference of a possibly null reference.

Check warning on line 215 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / unit-test

Dereference of a possibly null reference.

Check warning on line 215 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / unit-test

Dereference of a possibly null reference.

Check warning on line 215 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / analyze (csharp)

Dereference of a possibly null reference.

Check warning on line 215 in src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

View workflow job for this annotation

GitHub Actions / analyze (csharp)

Dereference of a possibly null reference.
_logger.NAcknowledgementSent(eventArgs.BasicProperties.MessageId, false);
return;
}
Expand Down Expand Up @@ -273,7 +273,7 @@

public void Acknowledge(MessageBase message)
{
Guard.Against.Null(message);
Guard.Against.Null(message, nameof(message));

CreateChannel();

Expand All @@ -290,6 +290,8 @@

public async Task RequeueWithDelay(MessageBase message)
{
Guard.Against.Null(message, nameof(message));

try
{
await Task.Delay(_requeueDelay * 1000).ConfigureAwait(false);
Expand All @@ -305,7 +307,7 @@

public void Reject(MessageBase message, bool requeue = true)
{
Guard.Against.Null(message);
Guard.Against.Null(message, nameof(message));

CreateChannel();

Expand Down Expand Up @@ -344,8 +346,8 @@

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)
{
Expand All @@ -363,17 +365,17 @@

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(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!--
<!--
~ Copyright 2022 MONAI Consortium
~
~ Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -37,20 +37,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.14" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.21" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.0" />
<PackageReference Include="Moq" Version="4.20.69" />
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.2.3" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="xunit" Version="2.5.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="3.2.0">
<PackageReference Include="coverlet.collector" Version="6.0.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Loading
Loading