Skip to content

Commit

Permalink
Remove unused references and clean up licenses (#211)
Browse files Browse the repository at this point in the history
* Remove unused references
* Clean up licenses
* Update dependencies
* Update dependency decisions


Signed-off-by: Victor Chang <[email protected]>
  • Loading branch information
mocsharp authored Aug 12, 2023
1 parent 035de9c commit 31afb2f
Show file tree
Hide file tree
Showing 10 changed files with 4,868 additions and 6,351 deletions.
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 @@ -48,10 +48,10 @@ public RabbitMQConnectionFactory(ILogger<RabbitMQConnectionFactory> 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}";

Expand Down Expand Up @@ -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)));
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 @@ public RabbitMQMessageSubscriberService(IOptions<MessageBrokerServiceConfigurati
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 @@ -137,7 +137,7 @@ private void Channel_ModelShutdown(object? sender, ShutdownEventArgs e)

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 topic, string queue, Func<MessageReceivedEvent

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 @@ -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();

Expand All @@ -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);
Expand All @@ -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();

Expand Down Expand Up @@ -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)
{
Expand All @@ -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(
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

0 comments on commit 31afb2f

Please sign in to comment.