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 useless Utils class library #317

Merged
merged 3 commits into from
Nov 1, 2022
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
25 changes: 0 additions & 25 deletions Masa.Framework.sln
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Extensions", "Extensions",
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Ldap", "Ldap", "{0BC7A7F2-F8E0-4A6A-90E2-A0ACD997EBB1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Models", "Models", "{9CABAF1C-E5E1-4CB8-AAD4-D47387EED6AA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Security", "Security", "{2D07F9AD-9951-475D-B7C7-980B23FDE9BB}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Authentication", "Authentication", "{534346EF-1D11-48DB-9909-700CEC99FF08}"
Expand All @@ -135,8 +133,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.Caching.Memory",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.Exceptions", "src\Utils\Masa.Utils.Exceptions\Masa.Utils.Exceptions.csproj", "{7B0EDB07-D3AE-4077-9A23-35CA6556E791}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.Configuration.Dcc", "src\Utils\Configuration\Masa.Utils.Configuration.Dcc\Masa.Utils.Configuration.Dcc.csproj", "{E376F15A-3C13-4DBF-B972-E03D2350D7C4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.Configuration.Json", "src\Utils\Configuration\Masa.Utils.Configuration.Json\Masa.Utils.Configuration.Json.csproj", "{8AB652AF-3957-42F9-8F3E-FAFE56A44BE1}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.Data.DataAnnotations", "src\Utils\Data\Masa.Utils.Data.DataAnnotations\Masa.Utils.Data.DataAnnotations.csproj", "{766E3633-7B82-49CC-B012-CAE6264D4628}"
Expand Down Expand Up @@ -175,8 +171,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B477B68A
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.Ldap.Novell.Tests", "src\Utils\Ldap\Tests\Masa.Utils.Ldap.Novell.Tests\Masa.Utils.Ldap.Novell.Tests.csproj", "{023DE7BB-49B6-4C14-9DAC-F7B4E3E2D12C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.Models.Config", "src\Utils\Models\Masa.Utils.Models.Config\Masa.Utils.Models.Config.csproj", "{41675E4A-0B1A-436B-910A-A296D35661DC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.Security.Cryptography", "src\Utils\Security\Masa.Utils.Security.Cryptography\Masa.Utils.Security.Cryptography.csproj", "{F43B5288-30F0-429E-A10F-9560E8CE318D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Masa.Utils.Security.Token", "src\Utils\Security\Masa.Utils.Security.Token\Masa.Utils.Security.Token.csproj", "{42A17DC6-7F8D-487A-98F0-1DAF6FF81A63}"
Expand Down Expand Up @@ -861,14 +855,6 @@ Global
{7B0EDB07-D3AE-4077-9A23-35CA6556E791}.Release|Any CPU.Build.0 = Release|Any CPU
{7B0EDB07-D3AE-4077-9A23-35CA6556E791}.Release|x64.ActiveCfg = Release|Any CPU
{7B0EDB07-D3AE-4077-9A23-35CA6556E791}.Release|x64.Build.0 = Release|Any CPU
{E376F15A-3C13-4DBF-B972-E03D2350D7C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{E376F15A-3C13-4DBF-B972-E03D2350D7C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E376F15A-3C13-4DBF-B972-E03D2350D7C4}.Debug|x64.ActiveCfg = Debug|Any CPU
{E376F15A-3C13-4DBF-B972-E03D2350D7C4}.Debug|x64.Build.0 = Debug|Any CPU
{E376F15A-3C13-4DBF-B972-E03D2350D7C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E376F15A-3C13-4DBF-B972-E03D2350D7C4}.Release|Any CPU.Build.0 = Release|Any CPU
{E376F15A-3C13-4DBF-B972-E03D2350D7C4}.Release|x64.ActiveCfg = Release|Any CPU
{E376F15A-3C13-4DBF-B972-E03D2350D7C4}.Release|x64.Build.0 = Release|Any CPU
{8AB652AF-3957-42F9-8F3E-FAFE56A44BE1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8AB652AF-3957-42F9-8F3E-FAFE56A44BE1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8AB652AF-3957-42F9-8F3E-FAFE56A44BE1}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -989,14 +975,6 @@ Global
{023DE7BB-49B6-4C14-9DAC-F7B4E3E2D12C}.Release|Any CPU.Build.0 = Release|Any CPU
{023DE7BB-49B6-4C14-9DAC-F7B4E3E2D12C}.Release|x64.ActiveCfg = Release|Any CPU
{023DE7BB-49B6-4C14-9DAC-F7B4E3E2D12C}.Release|x64.Build.0 = Release|Any CPU
{41675E4A-0B1A-436B-910A-A296D35661DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{41675E4A-0B1A-436B-910A-A296D35661DC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{41675E4A-0B1A-436B-910A-A296D35661DC}.Debug|x64.ActiveCfg = Debug|Any CPU
{41675E4A-0B1A-436B-910A-A296D35661DC}.Debug|x64.Build.0 = Debug|Any CPU
{41675E4A-0B1A-436B-910A-A296D35661DC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{41675E4A-0B1A-436B-910A-A296D35661DC}.Release|Any CPU.Build.0 = Release|Any CPU
{41675E4A-0B1A-436B-910A-A296D35661DC}.Release|x64.ActiveCfg = Release|Any CPU
{41675E4A-0B1A-436B-910A-A296D35661DC}.Release|x64.Build.0 = Release|Any CPU
{F43B5288-30F0-429E-A10F-9560E8CE318D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F43B5288-30F0-429E-A10F-9560E8CE318D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F43B5288-30F0-429E-A10F-9560E8CE318D}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -2191,12 +2169,10 @@ Global
{706DA866-6226-430F-AB4D-98FEE7B0DDB0} = {5944A182-13B8-4DA6-AEE2-0A01E64A9648}
{69A6DFD9-F5A2-4714-94BA-36E85CDA3EF4} = {5944A182-13B8-4DA6-AEE2-0A01E64A9648}
{0BC7A7F2-F8E0-4A6A-90E2-A0ACD997EBB1} = {5944A182-13B8-4DA6-AEE2-0A01E64A9648}
{9CABAF1C-E5E1-4CB8-AAD4-D47387EED6AA} = {5944A182-13B8-4DA6-AEE2-0A01E64A9648}
{2D07F9AD-9951-475D-B7C7-980B23FDE9BB} = {5944A182-13B8-4DA6-AEE2-0A01E64A9648}
{534346EF-1D11-48DB-9909-700CEC99FF08} = {2D07F9AD-9951-475D-B7C7-980B23FDE9BB}
{015C4181-A8D9-4FA5-89B9-38A37FA9D31D} = {AF921AB1-64D1-4478-AB49-192F3EE416FC}
{7B0EDB07-D3AE-4077-9A23-35CA6556E791} = {5944A182-13B8-4DA6-AEE2-0A01E64A9648}
{E376F15A-3C13-4DBF-B972-E03D2350D7C4} = {56917740-626B-42D5-8BB8-6895F79FB7D2}
{8AB652AF-3957-42F9-8F3E-FAFE56A44BE1} = {56917740-626B-42D5-8BB8-6895F79FB7D2}
{766E3633-7B82-49CC-B012-CAE6264D4628} = {706DA866-6226-430F-AB4D-98FEE7B0DDB0}
{B7003322-212E-4568-9B61-95DB67CABC3F} = {706DA866-6226-430F-AB4D-98FEE7B0DDB0}
Expand All @@ -2216,7 +2192,6 @@ Global
{AE7980F2-6F94-4A93-9551-F47AD43FC545} = {0BC7A7F2-F8E0-4A6A-90E2-A0ACD997EBB1}
{B477B68A-16F3-4005-BDAD-09905A3267A5} = {0BC7A7F2-F8E0-4A6A-90E2-A0ACD997EBB1}
{023DE7BB-49B6-4C14-9DAC-F7B4E3E2D12C} = {B477B68A-16F3-4005-BDAD-09905A3267A5}
{41675E4A-0B1A-436B-910A-A296D35661DC} = {9CABAF1C-E5E1-4CB8-AAD4-D47387EED6AA}
{F43B5288-30F0-429E-A10F-9560E8CE318D} = {2D07F9AD-9951-475D-B7C7-980B23FDE9BB}
{42A17DC6-7F8D-487A-98F0-1DAF6FF81A63} = {2D07F9AD-9951-475D-B7C7-980B23FDE9BB}
{386F0326-D591-4BED-A01A-91C0E9814467} = {534346EF-1D11-48DB-9909-700CEC99FF08}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

<ItemGroup>
<ProjectReference Include="..\..\..\..\Utils\Masa.Utils.Exceptions\Masa.Utils.Exceptions.csproj" />
<ProjectReference Include="..\..\..\..\Utils\Models\Masa.Utils.Models.Config\Masa.Utils.Models.Config.csproj" />
<ProjectReference Include="..\Masa.Contrib.Dispatcher.IntegrationEvents\Masa.Contrib.Dispatcher.IntegrationEvents.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,22 @@ public class IntegrationEventBus : IIntegrationEventBus
private readonly IPublisher _publisher;
private readonly ILogger<IntegrationEventBus>? _logger;
private readonly IIntegrationEventLogService? _eventLogService;
private readonly IOptionsMonitor<AppConfig>? _appConfig;
private readonly IOptionsMonitor<MasaAppConfigureOptions>? _masaAppConfigureOptions;
private readonly IEventBus? _eventBus;
private readonly IUnitOfWork? _unitOfWork;

public IntegrationEventBus(IOptions<DispatcherOptions> options,
IPublisher publisher,
IIntegrationEventLogService? eventLogService = null,
IOptionsMonitor<AppConfig>? appConfig = null,
IOptionsMonitor<MasaAppConfigureOptions>? masaAppConfigureOptions = null,
ILogger<IntegrationEventBus>? logger = null,
IEventBus? eventBus = null,
IUnitOfWork? unitOfWork = null)
{
_dispatcherOptions = options.Value;
_publisher = publisher;
_eventLogService = eventLogService;
_appConfig = appConfig;
_masaAppConfigureOptions = masaAppConfigureOptions;
_logger = logger;
_eventBus = eventBus;
_unitOfWork = unitOfWork;
Expand Down Expand Up @@ -71,7 +71,7 @@ private async Task PublishIntegrationAsync<TEvent>(TEvent @event)
_logger?.LogDebug(
"----- Publishing integration event: {IntegrationEventIdPublished} from {AppId} - ({IntegrationEvent})",
@event.GetEventId(),
_appConfig?.CurrentValue.AppId ?? string.Empty, @event);
_masaAppConfigureOptions?.CurrentValue.AppId ?? string.Empty, @event);

await _eventLogService.MarkEventAsInProgressAsync(@event.GetEventId());

Expand All @@ -83,7 +83,7 @@ private async Task PublishIntegrationAsync<TEvent>(TEvent @event)
catch (Exception ex)
{
_logger?.LogError(ex, "Error Publishing integration event: {IntegrationEventId} from {AppId} - ({IntegrationEvent})",
@event.GetEventId(), _appConfig?.CurrentValue.AppId ?? string.Empty, @event);
@event.GetEventId(), _masaAppConfigureOptions?.CurrentValue.AppId ?? string.Empty, @event);
if (!isAdd) throw;

LocalQueueProcessor.Default.AddJobs(new IntegrationEventLogItem(@event.GetEventId(), @event.Topic, @event));
Expand All @@ -95,7 +95,7 @@ private async Task PublishIntegrationAsync<TEvent>(TEvent @event)
_logger?.LogDebug(
"----- Publishing integration event (don't use local message): {IntegrationEventIdPublished} from {AppId} - ({IntegrationEvent})",
@event.GetEventId(),
_appConfig?.CurrentValue.AppId ?? string.Empty, @event);
_masaAppConfigureOptions?.CurrentValue.AppId ?? string.Empty, @event);

await _publisher.PublishAsync(topicName, (dynamic)@event);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\BuildingBlocks\Configuration\Masa.BuildingBlocks.Configuration\Masa.BuildingBlocks.Configuration.csproj" />
<ProjectReference Include="..\..\..\..\BuildingBlocks\Dispatcher\Masa.BuildingBlocks.Dispatcher.IntegrationEvents\Masa.BuildingBlocks.Dispatcher.IntegrationEvents.csproj" />
<ProjectReference Include="..\..\..\..\Utils\Masa.Utils.Exceptions\Masa.Utils.Exceptions.csproj" />
<ProjectReference Include="..\..\..\..\Utils\Models\Masa.Utils.Models.Config\Masa.Utils.Models.Config.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,19 @@ namespace Masa.Contrib.Dispatcher.IntegrationEvents.Processor;

public class RetryByDataProcessor : ProcessorBase
{
private readonly IServiceProvider _serviceProvider;
private readonly IOptions<DispatcherOptions> _options;
private readonly IOptionsMonitor<AppConfig>? _appConfig;
private readonly IOptionsMonitor<MasaAppConfigureOptions>? _masaAppConfigureOptions;
private readonly ILogger<RetryByDataProcessor>? _logger;

public override int Delay => _options.Value.FailedRetryInterval;

public RetryByDataProcessor(
IServiceProvider serviceProvider,
IOptions<DispatcherOptions> options,
IOptionsMonitor<AppConfig>? appConfig = null,
IOptionsMonitor<MasaAppConfigureOptions>? masaAppConfigureOptions = null,
ILogger<RetryByDataProcessor>? logger = null) : base(serviceProvider)
{
_serviceProvider = serviceProvider;
_appConfig = appConfig;
_masaAppConfigureOptions = masaAppConfigureOptions;
_options = options;
_logger = logger;
}
Expand Down Expand Up @@ -64,7 +62,7 @@ await eventLogService.RetrieveEventLogsFailedToPublishAsync(_options.Value.Retry
{
_logger?.LogError(ex,
"Error Publishing integration event: {IntegrationEventId} from {AppId} - ({IntegrationEvent})",
eventLog.EventId, _appConfig?.CurrentValue.AppId ?? string.Empty, eventLog);
eventLog.EventId, _masaAppConfigureOptions?.CurrentValue.AppId ?? string.Empty, eventLog);
await eventLogService.MarkEventAsFailedAsync(eventLog.EventId);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace Masa.Contrib.Dispatcher.IntegrationEvents.Processor;

public class RetryByLocalQueueProcessor : ProcessorBase
{
private readonly IOptionsMonitor<AppConfig>? _appConfig;
private readonly IOptionsMonitor<MasaAppConfigureOptions>? _masaAppConfigureOptions;
private readonly IOptions<DispatcherOptions> _options;
private readonly ILogger<RetryByLocalQueueProcessor>? _logger;

Expand All @@ -14,10 +14,10 @@ public class RetryByLocalQueueProcessor : ProcessorBase
public RetryByLocalQueueProcessor(
IServiceProvider serviceProvider,
IOptions<DispatcherOptions> options,
IOptionsMonitor<AppConfig>? appConfig = null,
IOptionsMonitor<MasaAppConfigureOptions>? masaAppConfigureOptions = null,
ILogger<RetryByLocalQueueProcessor>? logger = null) : base(serviceProvider)
{
_appConfig = appConfig;
_masaAppConfigureOptions = masaAppConfigureOptions;
_options = options;
_logger = logger;
}
Expand Down Expand Up @@ -63,7 +63,7 @@ protected override async Task ExecuteAsync(IServiceProvider serviceProvider, Can
{
_logger?.LogError(ex,
"Error Publishing integration event: {IntegrationEventId} from {AppId} - ({IntegrationEvent})",
eventLog.EventId, _appConfig?.CurrentValue.AppId ?? string.Empty, eventLog);
eventLog.EventId, _masaAppConfigureOptions?.CurrentValue.AppId ?? string.Empty, eventLog);
await eventLogService.MarkEventAsFailedAsync(eventLog.EventId);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

global using Masa.BuildingBlocks.Configuration.Options;
global using Masa.BuildingBlocks.Data;
global using Masa.BuildingBlocks.Data.UoW;
global using Masa.BuildingBlocks.Dispatcher.Events;
Expand All @@ -11,7 +12,6 @@
global using Masa.Contrib.Dispatcher.IntegrationEvents.Options;
global using Masa.Contrib.Dispatcher.IntegrationEvents.Processor;
global using Masa.Contrib.Dispatcher.IntegrationEvents.Servers;
global using Masa.Utils.Models.Config;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.DependencyInjection.Extensions;
global using Microsoft.Extensions.Hosting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class IntegrationEventBusTest
private Mock<IDispatcherOptions> _options;
private Mock<IOptions<DispatcherOptions>> _dispatcherOptions;
private Mock<IIntegrationEventLogService> _eventLog;
private Mock<IOptionsMonitor<AppConfig>> _appConfig;
private Mock<IOptionsMonitor<MasaAppConfigureOptions>> _masaAppConfigureOptions;
private Mock<IUnitOfWork> _uoW;

[TestInitialize]
Expand All @@ -27,8 +27,8 @@ public void Initialize()
_eventLog.Setup(eventLog => eventLog.MarkEventAsInProgressAsync(It.IsAny<Guid>())).Verifiable();
_eventLog.Setup(eventLog => eventLog.MarkEventAsPublishedAsync(It.IsAny<Guid>())).Verifiable();
_eventLog.Setup(eventLog => eventLog.MarkEventAsFailedAsync(It.IsAny<Guid>())).Verifiable();
_appConfig = new();
_appConfig.Setup(appConfig => appConfig.CurrentValue).Returns(() => new AppConfig()
_masaAppConfigureOptions = new();
_masaAppConfigureOptions.Setup(appConfig => appConfig.CurrentValue).Returns(() => new MasaAppConfigureOptions
{
AppId = "Test"
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) MASA Stack All rights reserved.
// Licensed under the MIT License. See LICENSE.txt in the project root for license information.

global using Masa.BuildingBlocks.Configuration.Options;
global using Masa.BuildingBlocks.Data;
global using Masa.BuildingBlocks.Data.UoW;
global using Masa.BuildingBlocks.Dispatcher.Events;
Expand All @@ -9,7 +10,6 @@
global using Masa.Contrib.Dispatcher.IntegrationEvents.Dapr.Options;
global using Masa.Contrib.Dispatcher.IntegrationEvents.Processor;
global using Masa.Contrib.Dispatcher.IntegrationEvents.Tests.Infrastructure;
global using Masa.Utils.Models.Config;
global using Microsoft.Extensions.DependencyInjection;
global using Microsoft.Extensions.Options;
global using Microsoft.VisualStudio.TestTools.UnitTesting;
Expand Down
Loading