From 11cede60c0939665f25388d66f53dfcfe8392565 Mon Sep 17 00:00:00 2001 From: "internalautomation[bot]" <85681268+internalautomation[bot]@users.noreply.github.com> Date: Thu, 21 Nov 2024 18:14:32 -0500 Subject: [PATCH] GitHubSync update - master (#725) * GitHubSync update - master * Update TFMs * Update testing packages * Update packages * Update packages * Update packages to prevent transitive CVE * Update workflows * Add workaround to avoid NETSDK1206 warning * Update hardcoded path --------- Co-authored-by: internalautomation[bot] <85681268+internalautomation[bot]@users.noreply.github.com> Co-authored-by: Brandon Ording --- .github/dependabot.yml | 5 ++ .github/workflows/ci.yml | 4 +- .github/workflows/release.yml | 33 ++++------- src/Custom.Build.props | 5 ++ src/Directory.Build.props | 4 +- src/Directory.Build.targets | 4 +- src/TestHelper/EnvironmentVariables.cs | 6 +- src/TestHelper/TestHelper.csproj | 9 +-- ...TimeoutMigrationTool.ASQ.FakeTarget.csproj | 11 +++- .../ASQTargetTests.cs | 38 ++++++------- ...tMigrationTool.ASQ.IntegrationTests.csproj | 6 +- ...utMigrationTool.Asp.AcceptanceTests.csproj | 22 ++++--- .../TimeoutMigrationTool.Asp.FakeData.csproj | 10 +++- ...tMigrationTool.Asp.IntegrationTests.csproj | 6 +- .../MigrationRunner.cs | 2 +- ...tMigrationTool.Msmq.AcceptanceTests.csproj | 12 +--- .../MsmqTimeoutsTargetTests.cs | 6 +- ...MigrationTool.Msmq.IntegrationTests.csproj | 11 ++-- ...tionTool.NHibernate.AcceptanceTests.csproj | 22 ++++--- ...utMigrationTool.NHibernate.FakeData.csproj | 5 +- ...ol.NHibernate.OracleAcceptanceTests.csproj | 24 ++++---- ...utMigrationTool.RabbitMq.FakeTarget.csproj | 9 ++- .../RabbitMqTimeoutsTargetTestsV1.cs | 26 ++++----- .../RabbitMqTimeoutsTargetTestsV2.cs | 26 ++++----- ...ationTool.RabbitMq.IntegrationTests.csproj | 6 +- ...TimeoutMigrationTool.Raven.FakeData.csproj | 2 +- .../Raven3/Raven3TestSuite.cs | 4 +- .../Raven4/Raven4TestSuite.cs | 4 +- ...igrationTool.Raven.IntegrationTests.csproj | 6 +- ...igrationTool.Raven3.AcceptanceTests.csproj | 18 +++--- ...igrationTool.Raven4.AcceptanceTests.csproj | 20 +++---- ...tMigrationTool.SqlP.AcceptanceTests.csproj | 21 +++---- .../TimeoutMigrationTool.SqlP.FakeData.csproj | 3 +- .../SqlTTimeoutsTargetTests.cs | 18 +++--- ...MigrationTool.SqlT.IntegrationTests.csproj | 11 ++-- .../AbortRunnerTests.cs | 6 +- .../FakeTimeoutTarget.cs | 6 +- .../FakeTimeoutsSource.cs | 6 +- .../MigrationRunnerTests.cs | 8 +-- .../TimeoutMigrationTool.Tests.csproj | 8 +-- .../Asp/AspTimeoutsSource.cs | 10 ++-- .../MigrationCheckResult.cs | 2 +- .../NHibernate/StagedTimeoutEntity.cs | 2 +- src/TimeoutMigrationTool/PreviewRunner.cs | 2 +- .../RabbitMq/RabbitBatchWriter.cs | 2 +- .../RavenDB/Raven3Adapter.cs | 2 +- .../RavenDB/Raven4Adapter.cs | 2 +- .../RavenDB/RavenToolState.cs | 3 +- .../RavenDB/RavenToolStateDto.cs | 2 +- .../SqlP/SqlTimeoutsSource.cs | 2 +- .../TimeoutMigrationTool.csproj | 18 +++--- src/msbuild/AutomaticVersionRanges.targets | 42 ++++++++++++++ src/msbuild/ConvertToVersionRange.cs | 57 +++++++++++++++++++ 53 files changed, 339 insertions(+), 260 deletions(-) create mode 100644 src/msbuild/AutomaticVersionRanges.targets create mode 100644 src/msbuild/ConvertToVersionRange.cs diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 8a261a25..bc1175f8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,7 +1,12 @@ version: 2 +registries: + particular-packages: + type: nuget-feed + url: https://f.feedz.io/particular-software/packages/nuget/index.json updates: - package-ecosystem: nuget directory: "/src" + registries: "*" schedule: interval: daily open-pull-requests-limit: 1000 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 85dbbb8b..e34c2ce6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,9 +58,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4.1.0 with: - dotnet-version: | - 7.0.x - 6.0.x + dotnet-version: 8.0.x - name: Build run: dotnet build src --configuration Release - name: Upload packages diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c86217a5..15073918 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,38 +8,25 @@ env: DOTNET_NOLOGO: true jobs: release: - runs-on: windows-2019 # Code signing requirement https://github.com/NuGet/Home/issues/7939 + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v4.2.2 with: fetch-depth: 0 - - name: Parse repo name - run: | - $FullName = "$env:GITHUB_REPOSITORY" - $Org,$RepoName = $FullName.Split('/') - echo "PARTICULAR_REPO_NAME=$RepoName" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append - shell: pwsh - name: Setup .NET SDK uses: actions/setup-dotnet@v4.1.0 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Build run: dotnet build src --configuration Release - - name: Install NuGetKeyVaultSignTool - run: dotnet tool install --global NuGetKeyVaultSignTool - - name: Sign NuGet Packages - run: | - NuGetKeyVaultSignTool sign nugets\*.nupkg ` - --file-digest sha256 ` - --timestamp-rfc3161 http://timestamp.digicert.com ` - --timestamp-digest sha256 ` - --azure-key-vault-url https://particularcodesigning.vault.azure.net ` - --azure-key-vault-client-id ${{ secrets.AZURE_KEY_VAULT_CLIENT_ID }} ` - --azure-key-vault-tenant-id ${{ secrets.AZURE_KEY_VAULT_TENANT_ID }} ` - --azure-key-vault-client-secret ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }} ` - --azure-key-vault-certificate ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }} - shell: pwsh + - name: Sign NuGet packages + uses: Particular/sign-nuget-packages-action@v1.0.0 + with: + client-id: ${{ secrets.AZURE_KEY_VAULT_CLIENT_ID }} + tenant-id: ${{ secrets.AZURE_KEY_VAULT_TENANT_ID }} + client-secret: ${{ secrets.AZURE_KEY_VAULT_CLIENT_SECRET }} + certificate-name: ${{ secrets.AZURE_KEY_VAULT_CERTIFICATE_NAME }} - name: Publish artifacts uses: actions/upload-artifact@v4.4.3 with: @@ -47,6 +34,6 @@ jobs: path: nugets/* retention-days: 1 - name: Deploy - uses: Particular/push-octopus-package-action@v2.1.0 + uses: Particular/push-octopus-package-action@main with: octopus-deploy-api-key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }} diff --git a/src/Custom.Build.props b/src/Custom.Build.props index 942771b1..ed54579c 100644 --- a/src/Custom.Build.props +++ b/src/Custom.Build.props @@ -5,4 +5,9 @@ minor + + + + + diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 7e3a698c..4b7369cc 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -7,10 +7,10 @@ true 5.0 true - low + all - 2.1.2 + 2.1.3 0024000004800000940000000602000000240000525341310004000001000100dde965e6172e019ac82c2639ffe494dd2e7dd16347c34762a05732b492e110f2e4e2e1b5ef2d85c848ccfb671ee20a47c8d1376276708dc30a90ff1121b647ba3b7259a6bc383b2034938ef0e275b58b920375ac605076178123693c6c4f1331661a62eba28c249386855637780e3ff5f23a6d854700eaa6803ef48907513b92 00240000048000009400000006020000002400005253413100040000010001007f16e21368ff041183fab592d9e8ed37e7be355e93323147a1d29983d6e591b04282e4da0c9e18bd901e112c0033925eb7d7872c2f1706655891c5c9d57297994f707d16ee9a8f40d978f064ee1ffc73c0db3f4712691b23bf596f75130f4ec978cf78757ec034625a5f27e6bb50c618931ea49f6f628fd74271c32959efb1c5 diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets index d47a6af6..98966408 100644 --- a/src/Directory.Build.targets +++ b/src/Directory.Build.targets @@ -1,7 +1,5 @@ - - all - + diff --git a/src/TestHelper/EnvironmentVariables.cs b/src/TestHelper/EnvironmentVariables.cs index e8a58d09..7f58c41c 100644 --- a/src/TestHelper/EnvironmentVariables.cs +++ b/src/TestHelper/EnvironmentVariables.cs @@ -14,13 +14,13 @@ public static class EnvironmentVariables public const string SqlServerConnectionString = "SqlServerConnectionString"; - public static IReadOnlyList Names { get; } = new List - { + public static IReadOnlyList Names { get; } = + [ AzureStorageConnectionString, Raven4Url, OracleConnectionString, RabbitMqHost, Raven3Url, SqlServerConnectionString, - }; + ]; } \ No newline at end of file diff --git a/src/TestHelper/TestHelper.csproj b/src/TestHelper/TestHelper.csproj index b7950d93..36ed7528 100644 --- a/src/TestHelper/TestHelper.csproj +++ b/src/TestHelper/TestHelper.csproj @@ -1,12 +1,13 @@ - + - net48;net6.0;net7.0 + net48;net8.0 + 12.0 - - + + diff --git a/src/TimeoutMigrationTool.ASQ.FakeTarget/TimeoutMigrationTool.ASQ.FakeTarget.csproj b/src/TimeoutMigrationTool.ASQ.FakeTarget/TimeoutMigrationTool.ASQ.FakeTarget.csproj index fa69a2da..3a705bea 100644 --- a/src/TimeoutMigrationTool.ASQ.FakeTarget/TimeoutMigrationTool.ASQ.FakeTarget.csproj +++ b/src/TimeoutMigrationTool.ASQ.FakeTarget/TimeoutMigrationTool.ASQ.FakeTarget.csproj @@ -1,13 +1,18 @@ - + - net6.0 + net8.0 Exe + - + + + + + diff --git a/src/TimeoutMigrationTool.ASQ.IntegrationTests/ASQTargetTests.cs b/src/TimeoutMigrationTool.ASQ.IntegrationTests/ASQTargetTests.cs index a4d25b1f..be64d731 100644 --- a/src/TimeoutMigrationTool.ASQ.IntegrationTests/ASQTargetTests.cs +++ b/src/TimeoutMigrationTool.ASQ.IntegrationTests/ASQTargetTests.cs @@ -1,13 +1,13 @@ namespace TimeoutMigrationTool.ASQ.IntegrationTests { - using Microsoft.Azure.Cosmos.Table; - using NUnit.Framework; - using Particular.TimeoutMigrationTool; - using Particular.TimeoutMigrationTool.ASQ; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; + using Microsoft.Azure.Cosmos.Table; + using NUnit.Framework; + using Particular.TimeoutMigrationTool; + using Particular.TimeoutMigrationTool.ASQ; [TestFixture] [EnvironmentSpecificTest(EnvironmentVariables.AzureStorageConnectionString)] @@ -113,8 +113,8 @@ public async Task StageBatch_inserts_timeouts_into_the_staging_queue() await using var migrator = await timeoutTarget.PrepareTargetEndpointBatchMigrator(endpointName); // Act - var numberStaged = await migrator.StageBatch(new List - { + var numberStaged = await migrator.StageBatch( + [ new TimeoutData { Id = "SomeID", @@ -137,7 +137,7 @@ public async Task StageBatch_inserts_timeouts_into_the_staging_queue() State = new byte[2], Time = new DateTime(2021, 12, 12, 12, 13, 13, DateTimeKind.Utc) }, - }, 1); + ], 1); // Assert var recordsInTable = await ReadTimeoutsFromTable(nameProvider.GetStagingTableName(endpointName)); @@ -160,8 +160,8 @@ public async Task CompleteBatch_Moves_All_Entries_From_Staging_To_DelayedMessage var timeoutTarget = new ASQTarget(connectionString, nameProvider); await using var migrator = await timeoutTarget.PrepareTargetEndpointBatchMigrator(endpointName); - await migrator.StageBatch(new List - { + await migrator.StageBatch( + [ new TimeoutData { Id = "SomeID", @@ -184,7 +184,7 @@ await migrator.StageBatch(new List State = new byte[2], Time = new DateTime(2021, 12, 12, 12, 13, 13, DateTimeKind.Utc) }, - }, 1); + ], 1); // Act var numberCompleted = await migrator.CompleteBatch(1); @@ -210,8 +210,8 @@ public async Task CompleteBatch_Removes_All_Entries_From_Staging() var timeoutTarget = new ASQTarget(connectionString, nameProvider); await using var migrator = await timeoutTarget.PrepareTargetEndpointBatchMigrator(endpointName); - await migrator.StageBatch(new List - { + await migrator.StageBatch( + [ new TimeoutData { Id = "SomeID", @@ -234,7 +234,7 @@ await migrator.StageBatch(new List State = new byte[2], Time = new DateTime(2021, 12, 12, 12, 13, 13, DateTimeKind.Utc) }, - }, 1); + ], 1); // Act await migrator.CompleteBatch(1); @@ -276,8 +276,8 @@ public async Task Complete_Throws_If_Messages_Are_Still_Staged() var timeoutTarget = new ASQTarget(connectionString, nameProvider); await using var migrator = await timeoutTarget.PrepareTargetEndpointBatchMigrator(endpointName); - var numberStaged = await migrator.StageBatch(new List - { + var numberStaged = await migrator.StageBatch( + [ new TimeoutData { Id = "SomeID", @@ -300,7 +300,7 @@ public async Task Complete_Throws_If_Messages_Are_Still_Staged() State = new byte[2], Time = new DateTime(2021, 12, 12, 12, 13, 13, DateTimeKind.Utc) }, - }, 1); + ], 1); // Assert Assert.ThrowsAsync(async () => @@ -321,8 +321,8 @@ public async Task Complete_Removes_Staging_Queue_If_Empty() var timeoutTarget = new ASQTarget(connectionString, nameProvider); await using var migrator = await timeoutTarget.PrepareTargetEndpointBatchMigrator(endpointName); - await migrator.StageBatch(new List - { + await migrator.StageBatch( + [ new TimeoutData { Id = "SomeID", @@ -345,7 +345,7 @@ await migrator.StageBatch(new List State = new byte[2], Time = new DateTime(2021, 12, 12, 12, 13, 13, DateTimeKind.Utc) }, - }, 1); + ], 1); await migrator.CompleteBatch(1); diff --git a/src/TimeoutMigrationTool.ASQ.IntegrationTests/TimeoutMigrationTool.ASQ.IntegrationTests.csproj b/src/TimeoutMigrationTool.ASQ.IntegrationTests/TimeoutMigrationTool.ASQ.IntegrationTests.csproj index f8c3691d..10adc8b4 100644 --- a/src/TimeoutMigrationTool.ASQ.IntegrationTests/TimeoutMigrationTool.ASQ.IntegrationTests.csproj +++ b/src/TimeoutMigrationTool.ASQ.IntegrationTests/TimeoutMigrationTool.ASQ.IntegrationTests.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net8.0 @@ -11,9 +11,7 @@ - - - + diff --git a/src/TimeoutMigrationTool.Asp.AcceptanceTests/TimeoutMigrationTool.Asp.AcceptanceTests.csproj b/src/TimeoutMigrationTool.Asp.AcceptanceTests/TimeoutMigrationTool.Asp.AcceptanceTests.csproj index 57b8a78e..0bb0d342 100644 --- a/src/TimeoutMigrationTool.Asp.AcceptanceTests/TimeoutMigrationTool.Asp.AcceptanceTests.csproj +++ b/src/TimeoutMigrationTool.Asp.AcceptanceTests/TimeoutMigrationTool.Asp.AcceptanceTests.csproj @@ -1,11 +1,7 @@ - + - net6.0;net7.0 - - $(NoWarn);NU1608 + net8.0 @@ -15,21 +11,23 @@ - - - + - + - - + + + + + + diff --git a/src/TimeoutMigrationTool.Asp.FakeData/TimeoutMigrationTool.Asp.FakeData.csproj b/src/TimeoutMigrationTool.Asp.FakeData/TimeoutMigrationTool.Asp.FakeData.csproj index fffd341d..c5d7767d 100644 --- a/src/TimeoutMigrationTool.Asp.FakeData/TimeoutMigrationTool.Asp.FakeData.csproj +++ b/src/TimeoutMigrationTool.Asp.FakeData/TimeoutMigrationTool.Asp.FakeData.csproj @@ -1,13 +1,17 @@ - + - net6.0 + net8.0 Exe - + + + + + \ No newline at end of file diff --git a/src/TimeoutMigrationTool.Asp.IntegrationTests/TimeoutMigrationTool.Asp.IntegrationTests.csproj b/src/TimeoutMigrationTool.Asp.IntegrationTests/TimeoutMigrationTool.Asp.IntegrationTests.csproj index f8c3691d..10adc8b4 100644 --- a/src/TimeoutMigrationTool.Asp.IntegrationTests/TimeoutMigrationTool.Asp.IntegrationTests.csproj +++ b/src/TimeoutMigrationTool.Asp.IntegrationTests/TimeoutMigrationTool.Asp.IntegrationTests.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net8.0 @@ -11,9 +11,7 @@ - - - + diff --git a/src/TimeoutMigrationTool.Msmq.AcceptanceTests/MigrationRunner.cs b/src/TimeoutMigrationTool.Msmq.AcceptanceTests/MigrationRunner.cs index 9d31ca40..3cd337d0 100644 --- a/src/TimeoutMigrationTool.Msmq.AcceptanceTests/MigrationRunner.cs +++ b/src/TimeoutMigrationTool.Msmq.AcceptanceTests/MigrationRunner.cs @@ -13,7 +13,7 @@ public static void Run(string connectionString) var isDebug = TestContext.CurrentContext.TestDirectory.IndexOf(@"\bin\Debug\", StringComparison.OrdinalIgnoreCase) != -1; var build = isDebug ? "Debug" : "Release"; - var exePath = Path.GetFullPath(TestContext.CurrentContext.TestDirectory + $@"\..\..\..\..\TimeoutMigrationTool\bin\{build}\net6.0\TimeoutMigrationTool.dll"); + var exePath = Path.GetFullPath(TestContext.CurrentContext.TestDirectory + $@"\..\..\..\..\TimeoutMigrationTool\bin\{build}\net8.0\TimeoutMigrationTool.dll"); var args = $@"exec {exePath} migrate --allEndpoints sqlp --source ""{connectionString}"" --dialect MsSqlServer msmq --target ""{connectionString}"""; var startInfo = new ProcessStartInfo("dotnet", args) diff --git a/src/TimeoutMigrationTool.Msmq.AcceptanceTests/TimeoutMigrationTool.Msmq.AcceptanceTests.csproj b/src/TimeoutMigrationTool.Msmq.AcceptanceTests/TimeoutMigrationTool.Msmq.AcceptanceTests.csproj index 5bf8caac..f7ad4c8c 100644 --- a/src/TimeoutMigrationTool.Msmq.AcceptanceTests/TimeoutMigrationTool.Msmq.AcceptanceTests.csproj +++ b/src/TimeoutMigrationTool.Msmq.AcceptanceTests/TimeoutMigrationTool.Msmq.AcceptanceTests.csproj @@ -2,10 +2,6 @@ net48 - - $(NoWarn);NU1608 @@ -14,17 +10,15 @@ - - - + - + - + diff --git a/src/TimeoutMigrationTool.Msmq.IntegrationTests/MsmqTimeoutsTargetTests.cs b/src/TimeoutMigrationTool.Msmq.IntegrationTests/MsmqTimeoutsTargetTests.cs index 56f76518..a98dbebb 100644 --- a/src/TimeoutMigrationTool.Msmq.IntegrationTests/MsmqTimeoutsTargetTests.cs +++ b/src/TimeoutMigrationTool.Msmq.IntegrationTests/MsmqTimeoutsTargetTests.cs @@ -161,8 +161,8 @@ Headers varbinary(max) not null, const int batchNumber = 2; await using var endpointTarget = await sut.PrepareTargetEndpointBatchMigrator(ExistingEndpointName); - await endpointTarget.StageBatch(new List - { + await endpointTarget.StageBatch( + [ new TimeoutData { Id = "SomeID", @@ -185,7 +185,7 @@ await endpointTarget.StageBatch(new List State = new byte[2], Time = new DateTime(2021, 12, 12, 12, 13, 13, DateTimeKind.Utc) }, - }, batchNumber); + ], batchNumber); await endpointTarget.CompleteBatch(batchNumber); diff --git a/src/TimeoutMigrationTool.Msmq.IntegrationTests/TimeoutMigrationTool.Msmq.IntegrationTests.csproj b/src/TimeoutMigrationTool.Msmq.IntegrationTests/TimeoutMigrationTool.Msmq.IntegrationTests.csproj index bb6808fd..894b3c66 100644 --- a/src/TimeoutMigrationTool.Msmq.IntegrationTests/TimeoutMigrationTool.Msmq.IntegrationTests.csproj +++ b/src/TimeoutMigrationTool.Msmq.IntegrationTests/TimeoutMigrationTool.Msmq.IntegrationTests.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net8.0 @@ -11,11 +11,12 @@ - - - + - + + + + diff --git a/src/TimeoutMigrationTool.NHibernate.AcceptanceTests/TimeoutMigrationTool.NHibernate.AcceptanceTests.csproj b/src/TimeoutMigrationTool.NHibernate.AcceptanceTests/TimeoutMigrationTool.NHibernate.AcceptanceTests.csproj index 10dfac2f..e1475f88 100644 --- a/src/TimeoutMigrationTool.NHibernate.AcceptanceTests/TimeoutMigrationTool.NHibernate.AcceptanceTests.csproj +++ b/src/TimeoutMigrationTool.NHibernate.AcceptanceTests/TimeoutMigrationTool.NHibernate.AcceptanceTests.csproj @@ -1,12 +1,8 @@ - + - net6.0;net7.0 + net8.0 $(DefineConstants);SQLSERVER - - $(NoWarn);NU1608 @@ -16,18 +12,20 @@ - - - + - + + - - + + + + + diff --git a/src/TimeoutMigrationTool.NHibernate.FakeData/TimeoutMigrationTool.NHibernate.FakeData.csproj b/src/TimeoutMigrationTool.NHibernate.FakeData/TimeoutMigrationTool.NHibernate.FakeData.csproj index 48d31ae0..efbc5b54 100644 --- a/src/TimeoutMigrationTool.NHibernate.FakeData/TimeoutMigrationTool.NHibernate.FakeData.csproj +++ b/src/TimeoutMigrationTool.NHibernate.FakeData/TimeoutMigrationTool.NHibernate.FakeData.csproj @@ -6,8 +6,9 @@ - - + + + \ No newline at end of file diff --git a/src/TimeoutMigrationTool.NHibernate.OracleAcceptanceTests/TimeoutMigrationTool.NHibernate.OracleAcceptanceTests.csproj b/src/TimeoutMigrationTool.NHibernate.OracleAcceptanceTests/TimeoutMigrationTool.NHibernate.OracleAcceptanceTests.csproj index b8561e8b..e507dd49 100644 --- a/src/TimeoutMigrationTool.NHibernate.OracleAcceptanceTests/TimeoutMigrationTool.NHibernate.OracleAcceptanceTests.csproj +++ b/src/TimeoutMigrationTool.NHibernate.OracleAcceptanceTests/TimeoutMigrationTool.NHibernate.OracleAcceptanceTests.csproj @@ -1,12 +1,8 @@ - + - net6.0;net7.0 + net8.0 $(DefineConstants);ORACLE - - $(NoWarn);NU1608 @@ -16,18 +12,20 @@ - - - + - + - - - + + + + + + + diff --git a/src/TimeoutMigrationTool.RabbitMq.FakeTarget/TimeoutMigrationTool.RabbitMq.FakeTarget.csproj b/src/TimeoutMigrationTool.RabbitMq.FakeTarget/TimeoutMigrationTool.RabbitMq.FakeTarget.csproj index 25810686..6d0c0b73 100644 --- a/src/TimeoutMigrationTool.RabbitMq.FakeTarget/TimeoutMigrationTool.RabbitMq.FakeTarget.csproj +++ b/src/TimeoutMigrationTool.RabbitMq.FakeTarget/TimeoutMigrationTool.RabbitMq.FakeTarget.csproj @@ -1,12 +1,17 @@ - net6.0 + net8.0 Exe - + + + + + + diff --git a/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/RabbitMqTimeoutsTargetTestsV1.cs b/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/RabbitMqTimeoutsTargetTestsV1.cs index fcc7b98d..4d53d9e2 100644 --- a/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/RabbitMqTimeoutsTargetTestsV1.cs +++ b/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/RabbitMqTimeoutsTargetTestsV1.cs @@ -68,10 +68,10 @@ public async Task AbleToMigrate_ExistingDestination_ReturnsNoProblems() EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), - Destinations = new List - { + Destinations = + [ ExistingEndpointNameUsingConventional, ExistingEndpointNameUsingDirect - } + ] }; var result = await sut.AbleToMigrate(info); @@ -89,10 +89,10 @@ public async Task AbleToMigrate_DelayedDeliveryDoesNotExist_ReturnsProblems() EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), - Destinations = new List - { + Destinations = + [ ExistingEndpointNameUsingConventional, ExistingEndpointNameUsingDirect - } + ] }; var result = await sut.AbleToMigrate(info); @@ -116,7 +116,7 @@ public async Task AbleToMigrate_NonExistingDestination_ReturnsProblems() EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), - Destinations = new List { ExistingEndpointNameUsingConventional, NonExistingEndpointName } + Destinations = [ExistingEndpointNameUsingConventional, NonExistingEndpointName] }; var result = await sut.AbleToMigrate(info); @@ -133,7 +133,7 @@ public async Task AbleToMigrate_TimeoutHigherThan9Years_ReturnsProblems() EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddYears(9), - Destinations = new List { ExistingEndpointNameUsingConventional } + Destinations = [ExistingEndpointNameUsingConventional] }; var result = await sut.AbleToMigrate(info); @@ -152,7 +152,7 @@ public async Task Should_handle_negative_delays() EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), - Destinations = new List { ExistingEndpointNameUsingConventional } + Destinations = [ExistingEndpointNameUsingConventional] }; var migrateResult = await sut.AbleToMigrate(info); @@ -160,17 +160,17 @@ public async Task Should_handle_negative_delays() await using var endpointTarget = await sut.PrepareTargetEndpointBatchMigrator(ExistingEndpointNameUsingConventional); - await endpointTarget.StageBatch(new List - { + await endpointTarget.StageBatch( + [ new TimeoutData { Id = "SomeID", - Headers = new Dictionary(), + Headers = [], Destination = ExistingEndpointNameUsingConventional, State = new byte[2], Time = DateTime.Now - TimeSpan.FromDays(1) } - }, BatchNumber); + ], BatchNumber); var numPumped = await sut.CompleteBatch(BatchNumber); diff --git a/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/RabbitMqTimeoutsTargetTestsV2.cs b/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/RabbitMqTimeoutsTargetTestsV2.cs index 384280bf..53781afa 100644 --- a/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/RabbitMqTimeoutsTargetTestsV2.cs +++ b/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/RabbitMqTimeoutsTargetTestsV2.cs @@ -68,10 +68,10 @@ public async Task AbleToMigrate_ExistingDestination_ReturnsNoProblems() EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), - Destinations = new List - { + Destinations = + [ ExistingEndpointNameUsingConventional, ExistingEndpointNameUsingDirect - } + ] }; var result = await sut.AbleToMigrate(info); @@ -89,10 +89,10 @@ public async Task AbleToMigrate_DelayedDeliveryDoesNotExist_ReturnsProblems() EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), - Destinations = new List - { + Destinations = + [ ExistingEndpointNameUsingConventional, ExistingEndpointNameUsingDirect - } + ] }; var result = await sut.AbleToMigrate(info); @@ -116,7 +116,7 @@ public async Task AbleToMigrate_NonExistingDestination_ReturnsProblems() EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), - Destinations = new List { ExistingEndpointNameUsingConventional, NonExistingEndpointName } + Destinations = [ExistingEndpointNameUsingConventional, NonExistingEndpointName] }; var result = await sut.AbleToMigrate(info); @@ -133,7 +133,7 @@ public async Task AbleToMigrate_TimeoutHigherThan9Years_ReturnsProblems() EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddYears(9), - Destinations = new List { ExistingEndpointNameUsingConventional } + Destinations = [ExistingEndpointNameUsingConventional] }; var result = await sut.AbleToMigrate(info); @@ -152,7 +152,7 @@ public async Task Should_handle_negative_delays() EndpointName = ExistingEndpointNameUsingConventional, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), - Destinations = new List { ExistingEndpointNameUsingConventional } + Destinations = [ExistingEndpointNameUsingConventional] }; var migrateResult = await sut.AbleToMigrate(info); @@ -160,17 +160,17 @@ public async Task Should_handle_negative_delays() await using var endpointTarget = await sut.PrepareTargetEndpointBatchMigrator(ExistingEndpointNameUsingConventional); - await endpointTarget.StageBatch(new List - { + await endpointTarget.StageBatch( + [ new TimeoutData { Id = "SomeID", - Headers = new Dictionary(), + Headers = [], Destination = ExistingEndpointNameUsingConventional, State = new byte[2], Time = DateTime.Now - TimeSpan.FromDays(1) } - }, BatchNumber); + ], BatchNumber); var numPumped = await sut.CompleteBatch(BatchNumber); diff --git a/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/TimeoutMigrationTool.RabbitMq.IntegrationTests.csproj b/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/TimeoutMigrationTool.RabbitMq.IntegrationTests.csproj index 786c709d..9bd25c50 100644 --- a/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/TimeoutMigrationTool.RabbitMq.IntegrationTests.csproj +++ b/src/TimeoutMigrationTool.RabbitMq.IntegrationTests/TimeoutMigrationTool.RabbitMq.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net8.0 @@ -11,9 +11,7 @@ - - - + diff --git a/src/TimeoutMigrationTool.Raven.FakeData/TimeoutMigrationTool.Raven.FakeData.csproj b/src/TimeoutMigrationTool.Raven.FakeData/TimeoutMigrationTool.Raven.FakeData.csproj index 8996d917..36239536 100644 --- a/src/TimeoutMigrationTool.Raven.FakeData/TimeoutMigrationTool.Raven.FakeData.csproj +++ b/src/TimeoutMigrationTool.Raven.FakeData/TimeoutMigrationTool.Raven.FakeData.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 Exe diff --git a/src/TimeoutMigrationTool.Raven.IntegrationTests/Raven3/Raven3TestSuite.cs b/src/TimeoutMigrationTool.Raven.IntegrationTests/Raven3/Raven3TestSuite.cs index ae1ced61..6b14498e 100644 --- a/src/TimeoutMigrationTool.Raven.IntegrationTests/Raven3/Raven3TestSuite.cs +++ b/src/TimeoutMigrationTool.Raven.IntegrationTests/Raven3/Raven3TestSuite.cs @@ -54,7 +54,7 @@ public async Task InitTimeouts(int nrOfTimeouts) SagaId = Guid.NewGuid(), OwningTimeoutManager = "A", Time = i < nrOfTimeouts / 2 ? DateTime.Now.AddDays(7) : DateTime.Now.AddDays(14), - Headers = new Dictionary(), + Headers = [], State = Encoding.ASCII.GetBytes("This is my state") }; @@ -93,7 +93,7 @@ public async Task InitTimeouts(int nrOfTimeouts, string end SagaId = Guid.NewGuid(), OwningTimeoutManager = endpointName, Time = DateTime.Now.AddDays(daysToTrigger), - Headers = new Dictionary(), + Headers = [], State = Encoding.ASCII.GetBytes("This is my state") }; diff --git a/src/TimeoutMigrationTool.Raven.IntegrationTests/Raven4/Raven4TestSuite.cs b/src/TimeoutMigrationTool.Raven.IntegrationTests/Raven4/Raven4TestSuite.cs index d8ff7c43..7335054f 100644 --- a/src/TimeoutMigrationTool.Raven.IntegrationTests/Raven4/Raven4TestSuite.cs +++ b/src/TimeoutMigrationTool.Raven.IntegrationTests/Raven4/Raven4TestSuite.cs @@ -70,7 +70,7 @@ public async Task InitTimeouts(int nrOfTimeouts) SagaId = Guid.NewGuid(), OwningTimeoutManager = "A", Time = i < nrOfTimeouts / 2 ? DateTime.Now.AddDays(7) : DateTime.Now.AddDays(14), - Headers = new Dictionary(), + Headers = [], State = Encoding.ASCII.GetBytes("This is my state") }; @@ -114,7 +114,7 @@ public async Task InitTimeouts(int nrOfTimeouts, string end SagaId = Guid.NewGuid(), OwningTimeoutManager = endpointName, Time = DateTime.Now.AddDays(daysToTrigger), - Headers = new Dictionary(), + Headers = [], State = Encoding.ASCII.GetBytes("This is my state") }; diff --git a/src/TimeoutMigrationTool.Raven.IntegrationTests/TimeoutMigrationTool.Raven.IntegrationTests.csproj b/src/TimeoutMigrationTool.Raven.IntegrationTests/TimeoutMigrationTool.Raven.IntegrationTests.csproj index 786c709d..9bd25c50 100644 --- a/src/TimeoutMigrationTool.Raven.IntegrationTests/TimeoutMigrationTool.Raven.IntegrationTests.csproj +++ b/src/TimeoutMigrationTool.Raven.IntegrationTests/TimeoutMigrationTool.Raven.IntegrationTests.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0 + net8.0 @@ -11,9 +11,7 @@ - - - + diff --git a/src/TimeoutMigrationTool.Raven3.AcceptanceTests/TimeoutMigrationTool.Raven3.AcceptanceTests.csproj b/src/TimeoutMigrationTool.Raven3.AcceptanceTests/TimeoutMigrationTool.Raven3.AcceptanceTests.csproj index 5269c2c0..9a1a7367 100644 --- a/src/TimeoutMigrationTool.Raven3.AcceptanceTests/TimeoutMigrationTool.Raven3.AcceptanceTests.csproj +++ b/src/TimeoutMigrationTool.Raven3.AcceptanceTests/TimeoutMigrationTool.Raven3.AcceptanceTests.csproj @@ -1,11 +1,7 @@  - net6.0;net7.0 - - $(NoWarn);NU1608 + net8.0 @@ -15,16 +11,18 @@ - - - + - - + + + + + + diff --git a/src/TimeoutMigrationTool.Raven4.AcceptanceTests/TimeoutMigrationTool.Raven4.AcceptanceTests.csproj b/src/TimeoutMigrationTool.Raven4.AcceptanceTests/TimeoutMigrationTool.Raven4.AcceptanceTests.csproj index dde5ca4b..dcca465a 100644 --- a/src/TimeoutMigrationTool.Raven4.AcceptanceTests/TimeoutMigrationTool.Raven4.AcceptanceTests.csproj +++ b/src/TimeoutMigrationTool.Raven4.AcceptanceTests/TimeoutMigrationTool.Raven4.AcceptanceTests.csproj @@ -1,11 +1,7 @@  - net6.0;net7.0 - - $(NoWarn);NU1608 + net8.0 @@ -15,19 +11,21 @@ - - - + - + - + - + + + + + diff --git a/src/TimeoutMigrationTool.SqlP.AcceptanceTests/TimeoutMigrationTool.SqlP.AcceptanceTests.csproj b/src/TimeoutMigrationTool.SqlP.AcceptanceTests/TimeoutMigrationTool.SqlP.AcceptanceTests.csproj index afc6de79..f309bc37 100644 --- a/src/TimeoutMigrationTool.SqlP.AcceptanceTests/TimeoutMigrationTool.SqlP.AcceptanceTests.csproj +++ b/src/TimeoutMigrationTool.SqlP.AcceptanceTests/TimeoutMigrationTool.SqlP.AcceptanceTests.csproj @@ -1,11 +1,7 @@  - net6.0;net7.0 - - $(NoWarn);NU1608 + net8.0 @@ -15,20 +11,21 @@ - - - + - + - + - - + + + + + diff --git a/src/TimeoutMigrationTool.SqlP.FakeData/TimeoutMigrationTool.SqlP.FakeData.csproj b/src/TimeoutMigrationTool.SqlP.FakeData/TimeoutMigrationTool.SqlP.FakeData.csproj index f7e05b82..2b605ca9 100644 --- a/src/TimeoutMigrationTool.SqlP.FakeData/TimeoutMigrationTool.SqlP.FakeData.csproj +++ b/src/TimeoutMigrationTool.SqlP.FakeData/TimeoutMigrationTool.SqlP.FakeData.csproj @@ -6,8 +6,9 @@ + - + \ No newline at end of file diff --git a/src/TimeoutMigrationTool.SqlT.IntegrationTests/SqlTTimeoutsTargetTests.cs b/src/TimeoutMigrationTool.SqlT.IntegrationTests/SqlTTimeoutsTargetTests.cs index bcfc9b7d..0a744ec2 100644 --- a/src/TimeoutMigrationTool.SqlT.IntegrationTests/SqlTTimeoutsTargetTests.cs +++ b/src/TimeoutMigrationTool.SqlT.IntegrationTests/SqlTTimeoutsTargetTests.cs @@ -57,10 +57,10 @@ RowVersion bigint IDENTITY(1,1) NOT NULL EndpointName = ExistingEndpointName, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), - Destinations = new List - { + Destinations = + [ ExistingDestination - } + ] }; var result = await sut.AbleToMigrate(info); @@ -86,10 +86,10 @@ IF OBJECT_ID('{0}.{1}', 'u') IS NOT NULL EndpointName = ExistingEndpointName, ShortestTimeout = DateTime.UtcNow.AddDays(3), LongestTimeout = DateTime.UtcNow.AddDays(5), - Destinations = new List - { + Destinations = + [ ExistingDestination - } + ] }; var result = await sut.AbleToMigrate(info); @@ -161,8 +161,8 @@ RowVersion bigint IDENTITY(1,1) NOT NULL const int BatchNumber = 2; await using var endpointTarget = await sut.PrepareTargetEndpointBatchMigrator(ExistingEndpointName); - await endpointTarget.StageBatch(new List - { + await endpointTarget.StageBatch( + [ new TimeoutData { Id = "SomeID", @@ -185,7 +185,7 @@ await endpointTarget.StageBatch(new List State = new byte[2], Time = new DateTime(2021, 12, 12, 12, 13, 13, DateTimeKind.Utc) }, - }, BatchNumber); + ], BatchNumber); await endpointTarget.CompleteBatch(BatchNumber); diff --git a/src/TimeoutMigrationTool.SqlT.IntegrationTests/TimeoutMigrationTool.SqlT.IntegrationTests.csproj b/src/TimeoutMigrationTool.SqlT.IntegrationTests/TimeoutMigrationTool.SqlT.IntegrationTests.csproj index bb6808fd..894b3c66 100644 --- a/src/TimeoutMigrationTool.SqlT.IntegrationTests/TimeoutMigrationTool.SqlT.IntegrationTests.csproj +++ b/src/TimeoutMigrationTool.SqlT.IntegrationTests/TimeoutMigrationTool.SqlT.IntegrationTests.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net8.0 @@ -11,11 +11,12 @@ - - - + - + + + + diff --git a/src/TimeoutMigrationTool.Tests/AbortRunnerTests.cs b/src/TimeoutMigrationTool.Tests/AbortRunnerTests.cs index 06cd15ab..153fa38b 100644 --- a/src/TimeoutMigrationTool.Tests/AbortRunnerTests.cs +++ b/src/TimeoutMigrationTool.Tests/AbortRunnerTests.cs @@ -20,14 +20,14 @@ public void Setup() runner = new AbortRunner(logger, timeoutsSource, timeoutsTarget); - endpoints = new List - { + endpoints = + [ new EndpointInfo { EndpointName = "Sales", NrOfTimeouts = 500 } - }; + ]; testEndpoint = endpoints.First().EndpointName; timeoutsSource.SetupEndpoints(endpoints); } diff --git a/src/TimeoutMigrationTool.Tests/FakeTimeoutTarget.cs b/src/TimeoutMigrationTool.Tests/FakeTimeoutTarget.cs index beb72834..433ac4e8 100644 --- a/src/TimeoutMigrationTool.Tests/FakeTimeoutTarget.cs +++ b/src/TimeoutMigrationTool.Tests/FakeTimeoutTarget.cs @@ -8,8 +8,8 @@ public class FakeTimeoutTarget : ITimeoutsTarget, ITimeoutsTarget.IEndpointTarge { List problemsToReturn; public bool BatchWasStaged { get; private set; } - public List TimeoutsStaged { get; } = new List(); - public List BatchesCompleted { get; } = new List(); + public List TimeoutsStaged { get; } = []; + public List BatchesCompleted { get; } = []; public bool EndpointWasVerified { get; private set; } = false; public bool MigrationWasAborted { get; private set; } @@ -32,7 +32,7 @@ public ValueTask CompleteBatch(int batchNumber) public ValueTask AbleToMigrate(EndpointInfo endpoint) { EndpointWasVerified = true; - var problems = problemsToReturn ?? new List(); + var problems = problemsToReturn ?? []; var result = new MigrationCheckResult { diff --git a/src/TimeoutMigrationTool.Tests/FakeTimeoutsSource.cs b/src/TimeoutMigrationTool.Tests/FakeTimeoutsSource.cs index 6e58cd3e..189fab6d 100644 --- a/src/TimeoutMigrationTool.Tests/FakeTimeoutsSource.cs +++ b/src/TimeoutMigrationTool.Tests/FakeTimeoutsSource.cs @@ -9,9 +9,9 @@ namespace TimeoutMigrationTool.Tests public class FakeTimeoutsSource : ITimeoutsSource { IToolState existingToolState; - List preparedBatches = new List(); - List endpoints = new List(); - List readBatchResults = new List(); + List preparedBatches = []; + List endpoints = []; + List readBatchResults = []; public bool BatchWasRead { get; private set; } public bool BatchWasCompleted { get; private set; } public bool BatchWasStaged { get; private set; } diff --git a/src/TimeoutMigrationTool.Tests/MigrationRunnerTests.cs b/src/TimeoutMigrationTool.Tests/MigrationRunnerTests.cs index 23dd0790..bbfb7bb1 100644 --- a/src/TimeoutMigrationTool.Tests/MigrationRunnerTests.cs +++ b/src/TimeoutMigrationTool.Tests/MigrationRunnerTests.cs @@ -19,14 +19,14 @@ public void Setup() runner = new MigrationRunner(logger, timeoutsSource, timeoutsTarget); - endpoints = new List - { + endpoints = + [ new EndpointInfo { EndpointName = "Sales", NrOfTimeouts = 500 } - }; + ]; testEndpoint = endpoints.First().EndpointName; timeoutsSource.SetupEndpoints(endpoints); } @@ -67,7 +67,7 @@ public void WhenRunningWithStateStoragePreparedAndParametersMismatch() RunParameters = new Dictionary { { "somekey", "somevalue" } } }; timeoutsSource.SetupToolStateToReturn(toolState); - timeoutsSource.SetupEndpoints(new List()); + timeoutsSource.SetupEndpoints([]); Assert.ThrowsAsync(async () => { diff --git a/src/TimeoutMigrationTool.Tests/TimeoutMigrationTool.Tests.csproj b/src/TimeoutMigrationTool.Tests/TimeoutMigrationTool.Tests.csproj index 738594f5..2cdfd0a3 100644 --- a/src/TimeoutMigrationTool.Tests/TimeoutMigrationTool.Tests.csproj +++ b/src/TimeoutMigrationTool.Tests/TimeoutMigrationTool.Tests.csproj @@ -1,7 +1,7 @@ - net6.0;net7.0 + net8.0 @@ -10,9 +10,9 @@ - - - + + + diff --git a/src/TimeoutMigrationTool/Asp/AspTimeoutsSource.cs b/src/TimeoutMigrationTool/Asp/AspTimeoutsSource.cs index 3610940b..28fe1fe5 100644 --- a/src/TimeoutMigrationTool/Asp/AspTimeoutsSource.cs +++ b/src/TimeoutMigrationTool/Asp/AspTimeoutsSource.cs @@ -531,7 +531,7 @@ public async Task> ListEndpoints(DateTime cutOffTime TableOperators.And, GenerateFilterCondition(nameof(TimeoutDataEntity.OwningTimeoutManager), QueryComparisons.Equal, endpointNameToBelisted))); - query.SelectColumns = new List { nameof(DynamicTableEntity.PartitionKey), nameof(TimeoutDataEntity.Destination) }; + query.SelectColumns = [nameof(DynamicTableEntity.PartitionKey), nameof(TimeoutDataEntity.Destination)]; TableContinuationToken token = null; var numberOfTimeouts = 0; @@ -575,8 +575,8 @@ public async Task> ListEndpoints(DateTime cutOffTime } } while (token != null && !queryCancellationToken.IsCancellationRequested); - return new List - { + return + [ new EndpointInfo { Destinations = destinations.ToList(), @@ -585,7 +585,7 @@ public async Task> ListEndpoints(DateTime cutOffTime ShortestTimeout = minDateTime, NrOfTimeouts = numberOfTimeouts } - }; + ]; } public async Task Abort() @@ -618,7 +618,7 @@ public async Task Abort() GenerateFilterCondition(nameof(PartialTimeoutDataEntityWithOwningTimeoutManager.OwningTimeoutManager), QueryComparisons.Equal, toolState.UniqueHiddenEndpointName))); - query.SelectColumns = new List { nameof(PartialTimeoutDataEntityWithOwningTimeoutManager.OwningTimeoutManager) }; + query.SelectColumns = [nameof(PartialTimeoutDataEntityWithOwningTimeoutManager.OwningTimeoutManager)]; TableContinuationToken token = null; CancellationToken queryCancellationToken = CancellationToken.None; diff --git a/src/TimeoutMigrationTool/MigrationCheckResult.cs b/src/TimeoutMigrationTool/MigrationCheckResult.cs index 45bf8fac..c62aee23 100644 --- a/src/TimeoutMigrationTool/MigrationCheckResult.cs +++ b/src/TimeoutMigrationTool/MigrationCheckResult.cs @@ -5,7 +5,7 @@ public class MigrationCheckResult { - public List Problems { get; set; } = new List(); + public List Problems { get; set; } = []; public bool CanMigrate => !Problems.Any(); } diff --git a/src/TimeoutMigrationTool/NHibernate/StagedTimeoutEntity.cs b/src/TimeoutMigrationTool/NHibernate/StagedTimeoutEntity.cs index 2bb45b98..4178228c 100644 --- a/src/TimeoutMigrationTool/NHibernate/StagedTimeoutEntity.cs +++ b/src/TimeoutMigrationTool/NHibernate/StagedTimeoutEntity.cs @@ -34,7 +34,7 @@ public virtual TimeoutData ToTimeoutData() static Dictionary ConvertStringToDictionary(string data) { - return string.IsNullOrEmpty(data) ? new Dictionary() : DeSerialize>(data); + return string.IsNullOrEmpty(data) ? [] : DeSerialize>(data); } static T DeSerialize(string data) diff --git a/src/TimeoutMigrationTool/PreviewRunner.cs b/src/TimeoutMigrationTool/PreviewRunner.cs index 363721b9..efbdf983 100644 --- a/src/TimeoutMigrationTool/PreviewRunner.cs +++ b/src/TimeoutMigrationTool/PreviewRunner.cs @@ -36,7 +36,7 @@ public async Task Run() logger.LogInformation($"\t-Longest timeout: {endpoint.LongestTimeout}"); logger.LogInformation($"\t-Timeout destinations: {string.Join(",", endpoint.Destinations)}"); - endpointProblems[endpoint.EndpointName] = new List(); + endpointProblems[endpoint.EndpointName] = []; var migrationCheckResult = await timeoutsTarget.AbleToMigrate(endpoint); diff --git a/src/TimeoutMigrationTool/RabbitMq/RabbitBatchWriter.cs b/src/TimeoutMigrationTool/RabbitMq/RabbitBatchWriter.cs index ce264c93..e661fce6 100644 --- a/src/TimeoutMigrationTool/RabbitMq/RabbitBatchWriter.cs +++ b/src/TimeoutMigrationTool/RabbitMq/RabbitBatchWriter.cs @@ -82,7 +82,7 @@ IConnection GetConnection(string rabbitMqBroker) void Fill(IBasicProperties properties, TimeoutData timeout, TimeSpan delay) { - var messageHeaders = timeout.Headers ?? new Dictionary(); + var messageHeaders = timeout.Headers ?? []; if (messageHeaders.TryGetValue("NServiceBus.MessageId", out var originalMessageId) && !string.IsNullOrEmpty(originalMessageId)) { diff --git a/src/TimeoutMigrationTool/RavenDB/Raven3Adapter.cs b/src/TimeoutMigrationTool/RavenDB/Raven3Adapter.cs index d63f56cf..0e8d5e0f 100644 --- a/src/TimeoutMigrationTool/RavenDB/Raven3Adapter.cs +++ b/src/TimeoutMigrationTool/RavenDB/Raven3Adapter.cs @@ -342,7 +342,7 @@ public async Task> GetDocuments(IEnumerable ids, Act { if (!ids.Any()) { - return new List(); + return []; } if (ids.Any(id => string.IsNullOrEmpty(id))) diff --git a/src/TimeoutMigrationTool/RavenDB/Raven4Adapter.cs b/src/TimeoutMigrationTool/RavenDB/Raven4Adapter.cs index f8dd8494..7a6218ba 100644 --- a/src/TimeoutMigrationTool/RavenDB/Raven4Adapter.cs +++ b/src/TimeoutMigrationTool/RavenDB/Raven4Adapter.cs @@ -309,7 +309,7 @@ public async Task> GetDocuments(IEnumerable ids, Act { if (!ids.Any()) { - return new List(); + return []; } if (ids.Any(id => string.IsNullOrEmpty(id))) diff --git a/src/TimeoutMigrationTool/RavenDB/RavenToolState.cs b/src/TimeoutMigrationTool/RavenDB/RavenToolState.cs index 159a54b4..80b81344 100644 --- a/src/TimeoutMigrationTool/RavenDB/RavenToolState.cs +++ b/src/TimeoutMigrationTool/RavenDB/RavenToolState.cs @@ -3,7 +3,6 @@ namespace Particular.TimeoutMigrationTool.RavenDB using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; - using global::NHibernate.Mapping; public class RavenToolState : IToolState { @@ -12,7 +11,7 @@ public RavenToolState(IDictionary runParameters, string endpoint RunParameters = runParameters; EndpointName = endpointName; Status = migrationStatus; - Batches = new List(); + Batches = []; } public RavenToolState(IDictionary runParameters, string endpointName, IEnumerable batches, MigrationStatus migrationStatus) : this(runParameters, endpointName, migrationStatus) diff --git a/src/TimeoutMigrationTool/RavenDB/RavenToolStateDto.cs b/src/TimeoutMigrationTool/RavenDB/RavenToolStateDto.cs index c0382718..c26182a0 100644 --- a/src/TimeoutMigrationTool/RavenDB/RavenToolStateDto.cs +++ b/src/TimeoutMigrationTool/RavenDB/RavenToolStateDto.cs @@ -6,7 +6,7 @@ namespace Particular.TimeoutMigrationTool.RavenDB public class RavenToolStateDto { - public List Batches { get; set; } = new List(); + public List Batches { get; set; } = []; public IDictionary RunParameters { get; set; } = new Dictionary(); public MigrationStatus Status { get; set; } public DateTime StartedAt { get; set; } diff --git a/src/TimeoutMigrationTool/SqlP/SqlTimeoutsSource.cs b/src/TimeoutMigrationTool/SqlP/SqlTimeoutsSource.cs index c5d17ed3..5e40f748 100644 --- a/src/TimeoutMigrationTool/SqlP/SqlTimeoutsSource.cs +++ b/src/TimeoutMigrationTool/SqlP/SqlTimeoutsSource.cs @@ -90,7 +90,7 @@ public async Task> ReadBatch(int batchNumber) List results = null; if (reader.HasRows) { - results = new List(); + results = []; await foreach (var timeoutDataRow in ReadTimeoutDataRows(reader)) { results.Add(timeoutDataRow); diff --git a/src/TimeoutMigrationTool/TimeoutMigrationTool.csproj b/src/TimeoutMigrationTool/TimeoutMigrationTool.csproj index 16064922..2a5f5288 100644 --- a/src/TimeoutMigrationTool/TimeoutMigrationTool.csproj +++ b/src/TimeoutMigrationTool/TimeoutMigrationTool.csproj @@ -1,7 +1,7 @@ - + - net6.0;net7.0 + net8.0 Exe false true @@ -11,26 +11,22 @@ Particular.TimeoutMigration Tool to migrate timeouts from the timeout manager to native transport timeouts migrate-timeouts - True + true Particular.TimeoutMigrationTool - + - - + + - + - - - - diff --git a/src/msbuild/AutomaticVersionRanges.targets b/src/msbuild/AutomaticVersionRanges.targets new file mode 100644 index 00000000..97372103 --- /dev/null +++ b/src/msbuild/AutomaticVersionRanges.targets @@ -0,0 +1,42 @@ + + + + false + false + false + true + + + + + + + + + + + @(_ProjectReferencesWithVersions->Count()) + + + + + + <_ProjectReferencesWithVersions Remove="@(_ProjectReferencesWithVersions)" /> + <_ProjectReferencesWithVersions Include="@(_ProjectReferencesWithVersionRanges)" /> + + + + + + @(PackageReference->Count()) + + + + + + + + + + + diff --git a/src/msbuild/ConvertToVersionRange.cs b/src/msbuild/ConvertToVersionRange.cs new file mode 100644 index 00000000..d9184784 --- /dev/null +++ b/src/msbuild/ConvertToVersionRange.cs @@ -0,0 +1,57 @@ +using System; +using System.Text.RegularExpressions; +using Microsoft.Build.Framework; +using Microsoft.Build.Utilities; + +public class ConvertToVersionRange : Task +{ + [Required] + public ITaskItem[] References { get; set; } = []; + + [Required] + public string VersionProperty { get; set; } = string.Empty; + + [Output] + public ITaskItem[] ReferencesWithVersionRanges { get; private set; } = []; + + public override bool Execute() + { + var success = true; + + foreach (var reference in References) + { + var automaticVersionRange = reference.GetMetadata("AutomaticVersionRange"); + + if (automaticVersionRange.Equals("false", StringComparison.OrdinalIgnoreCase)) + { + continue; + } + + var privateAssets = reference.GetMetadata("PrivateAssets"); + + if (privateAssets.Equals("All", StringComparison.OrdinalIgnoreCase)) + { + continue; + } + + var version = reference.GetMetadata(VersionProperty); + var match = Regex.Match(version, @"^\d+"); + + if (match.Value.Equals(string.Empty, StringComparison.Ordinal)) + { + Log.LogError("Reference '{0}' with version '{1}' is not valid for automatic version range conversion. Fix the version or exclude the reference from conversion by setting 'AutomaticVersionRange=\"false\"' on the reference.", reference.ItemSpec, version); + success = false; + continue; + } + + var nextMajor = Convert.ToInt32(match.Value) + 1; + + var versionRange = $"[{version}, {nextMajor}.0.0)"; + reference.SetMetadata(VersionProperty, versionRange); + } + + ReferencesWithVersionRanges = References; + + return success; + } +}