Skip to content

Commit

Permalink
Prepare RTM (#668)
Browse files Browse the repository at this point in the history
* Prepare RTM

* Remove guard

* Tweaks

---------

Co-authored-by: Brandon Ording <bording@gmail.com>
  • Loading branch information
andreasohlund and bording authored Mar 7, 2024
1 parent dc63a45 commit 21f2e33
Show file tree
Hide file tree
Showing 29 changed files with 96 additions and 122 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ jobs:
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.0.x
dotnet-quality: 'preview'
- name: Build
run: dotnet build src --configuration Release
- name: Upload packages
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ jobs:
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 8.0.x
dotnet-quality: 'preview'
- name: Build
run: dotnet build src --configuration Release
- name: Sign NuGet packages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.37.1" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.38.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="9.0.0-alpha.4" GeneratePathProperty="true" />
<PackageReference Include="NServiceBus.Testing" Version="9.0.0-alpha.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="9.0.0" GeneratePathProperty="true" />
<PackageReference Include="Nunit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.37.1" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.38.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="9.0.0-alpha.4" GeneratePathProperty="true" />
<PackageReference Include="NServiceBus.Testing" Version="9.0.0-alpha.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="9.0.0" GeneratePathProperty="true" />
<PackageReference Include="Nunit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.37.1" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.38.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NServiceBus.PersistenceTests.Sources" Version="9.0.0-alpha.4" GeneratePathProperty="true" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NServiceBus.PersistenceTests.Sources" Version="9.0.0" GeneratePathProperty="true" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.37.1" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.38.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="9.0.0-alpha.4" GeneratePathProperty="true" />
<PackageReference Include="NServiceBus.Testing" Version="9.0.0-alpha.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="9.0.0" GeneratePathProperty="true" />
<PackageReference Include="Nunit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.37.1" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.38.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="9.0.0-alpha.4" GeneratePathProperty="true" />
<PackageReference Include="NServiceBus.Testing" Version="9.0.0-alpha.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NServiceBus.AcceptanceTests.Sources" Version="9.0.0" GeneratePathProperty="true" />
<PackageReference Include="Nunit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void Approve()
{
var publicApi = typeof(CosmosPersistence).Assembly.GeneratePublicApi(new ApiGeneratorOptions
{
ExcludeAttributes = new[] { "System.Runtime.Versioning.TargetFrameworkAttribute", "System.Reflection.AssemblyMetadataAttribute" }
ExcludeAttributes = ["System.Runtime.Versioning.TargetFrameworkAttribute", "System.Reflection.AssemblyMetadataAttribute"]
});
Approver.Verify(publicApi);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.37.1" />
<PackageReference Include="NServiceBus" Version="9.0.0-alpha.4" />
<PackageReference Include="NServiceBus.Testing" Version="9.0.0-alpha.1" />
<PackageReference Include="Particular.Approvals" Version="0.6.0" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.38.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NServiceBus" Version="9.0.0" />
<PackageReference Include="NServiceBus.Testing" Version="9.0.0" />
<PackageReference Include="Particular.Approvals" Version="1.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace NServiceBus.Persistence.CosmosDB.Tests
{
using System;
using System.Collections.Generic;
using NUnit.Framework;
using Routing;
using Transport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,47 +14,48 @@ namespace NServiceBus.TransactionalSession.AcceptanceTests

public class TransactionSessionDefaultServer : IEndpointSetupTemplate
{
public virtual async Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointConfiguration,
public virtual async Task<EndpointConfiguration> GetConfiguration(RunDescriptor runDescriptor, EndpointCustomizationConfiguration endpointCustomization,
Func<EndpointConfiguration, Task> configurationBuilderCustomization)
{
var builder = new EndpointConfiguration(endpointConfiguration.EndpointName);
builder.EnableInstallers();
var endpointConfiguration = new EndpointConfiguration(endpointCustomization.EndpointName);

builder.Recoverability()
endpointConfiguration.EnableInstallers();
endpointConfiguration.UseSerialization<SystemJsonSerializer>();

endpointConfiguration.Recoverability()
.Delayed(delayed => delayed.NumberOfRetries(0))
.Immediate(immediate => immediate.NumberOfRetries(0));
builder.SendFailedMessagesTo("error");
endpointConfiguration.SendFailedMessagesTo("error");

var storageDir = Path.Combine(Path.GetTempPath(), "learn", TestContext.CurrentContext.Test.ID);

builder.UseTransport(new AcceptanceTestingTransport
endpointConfiguration.UseTransport(new AcceptanceTestingTransport
{
StorageLocation = storageDir
});

var persistence = builder.UsePersistence<CosmosPersistence>();
var persistence = endpointConfiguration.UsePersistence<CosmosPersistence>();
persistence.EnableTransactionalSession();
persistence.DisableContainerCreation();
persistence.CosmosClient(SetupFixture.CosmosDbClient);
persistence.DatabaseName(SetupFixture.DatabaseName);

persistence.DefaultContainer(SetupFixture.ContainerName, SetupFixture.PartitionPathKey);

builder.RegisterComponents(services => services.AddSingleton<IPartitionKeyFromHeadersExtractor, PartitionKeyProvider>());
endpointConfiguration.RegisterComponents(services => services.AddSingleton<IPartitionKeyFromHeadersExtractor, PartitionKeyProvider>());

builder.RegisterStartupTask(sp => new CaptureServiceProviderStartupTask(sp, runDescriptor.ScenarioContext));
endpointConfiguration.RegisterStartupTask(sp => new CaptureServiceProviderStartupTask(sp, runDescriptor.ScenarioContext));

await configurationBuilderCustomization(builder).ConfigureAwait(false);
await configurationBuilderCustomization(endpointConfiguration).ConfigureAwait(false);

// scan types at the end so that all types used by the configuration have been loaded into the AppDomain
builder.TypesToIncludeInScan(endpointConfiguration.GetTypesScopedByTestClass());
endpointConfiguration.TypesToIncludeInScan(endpointCustomization.GetTypesScopedByTestClass());

return builder;
return endpointConfiguration;
}

class PartitionKeyProvider : IPartitionKeyFromHeadersExtractor
{

public PartitionKeyProvider(ScenarioContext scenarioContext) => this.scenarioContext = scenarioContext;

public bool TryExtract(IReadOnlyDictionary<string, string> headers, out PartitionKey? partitionKey)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.37.1" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.38.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.4" />
<PackageReference Include="NServiceBus.TransactionalSession" Version="3.0.0-alpha.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0" />
<PackageReference Include="NServiceBus.TransactionalSession" Version="3.0.0" />
<PackageReference Include="Nunit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public void Approve()
{
var publicApi = typeof(CosmosOpenSessionOptions).Assembly.GeneratePublicApi(new ApiGeneratorOptions
{
ExcludeAttributes = new[] { "System.Runtime.Versioning.TargetFrameworkAttribute", "System.Reflection.AssemblyMetadataAttribute" }
ExcludeAttributes = ["System.Runtime.Versioning.TargetFrameworkAttribute", "System.Reflection.AssemblyMetadataAttribute"]
});
Approver.Verify(publicApi);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
Expand All @@ -18,8 +18,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.TransactionalSession" Version="3.0.0-alpha.1" />
<PackageReference Include="Particular.Approvals" Version="0.6.0" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.38.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NServiceBus" Version="9.0.0" />
<PackageReference Include="NServiceBus.TransactionalSession" Version="3.0.0" />
<PackageReference Include="Particular.Approvals" Version="1.0.0" />
<PackageReference Include="PublicApiGenerator" Version="11.1.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.TransactionalSession" Version="3.0.0-alpha.1" />
<PackageReference Include="Particular.Packaging" Version="4.0.0" PrivateAssets="All" />
<PackageReference Include="Newtonsoft.Json" Version="[13.0.3, 14.0.0)" />
<PackageReference Include="NServiceBus.TransactionalSession" Version="[3.0.0, 4.0.0)" />
<PackageReference Include="Particular.Packaging" Version="4.1.0" PrivateAssets="All" />
</ItemGroup>

</Project>
8 changes: 5 additions & 3 deletions src/NServiceBus.Persistence.CosmosDB.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.Persistence.Cos
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C4C88BE6-36A9-4F37-B9C6-3FEAD151C836}"
ProjectSection(SolutionItems) = preProject
..\.github\workflows\ci.yml = ..\.github\workflows\ci.yml
Custom.Build.props = Custom.Build.props
..\.github\workflows\release.yml = ..\.github\workflows\release.yml
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus.Persistence.CosmosDB.TransactionalSession", "NServiceBus.Persistence.CosmosDB.TransactionalSession\NServiceBus.Persistence.CosmosDB.TransactionalSession.csproj", "{EAE3490D-346E-4700-BE06-3F706BE8A510}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.Persistence.CosmosDB.TransactionalSession", "NServiceBus.Persistence.CosmosDB.TransactionalSession\NServiceBus.Persistence.CosmosDB.TransactionalSession.csproj", "{EAE3490D-346E-4700-BE06-3F706BE8A510}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus.Persistence.CosmosDB.TransactionalSession.AcceptanceTests", "NServiceBus.Persistence.CosmosDB.TransactionalSession.AcceptanceTests\NServiceBus.Persistence.CosmosDB.TransactionalSession.AcceptanceTests.csproj", "{5DC54F36-FB1B-410A-8711-75A5496F3869}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.Persistence.CosmosDB.TransactionalSession.AcceptanceTests", "NServiceBus.Persistence.CosmosDB.TransactionalSession.AcceptanceTests\NServiceBus.Persistence.CosmosDB.TransactionalSession.AcceptanceTests.csproj", "{5DC54F36-FB1B-410A-8711-75A5496F3869}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus.Persistence.CosmosDB.TransactionalSession.Tests", "NServiceBus.Persistence.CosmosDB.TransactionalSession.Tests\NServiceBus.Persistence.CosmosDB.TransactionalSession.Tests.csproj", "{5043C20C-6C60-40A9-9201-0C557F820833}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.Persistence.CosmosDB.TransactionalSession.Tests", "NServiceBus.Persistence.CosmosDB.TransactionalSession.Tests\NServiceBus.Persistence.CosmosDB.TransactionalSession.Tests.csproj", "{5043C20C-6C60-40A9-9201-0C557F820833}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace NServiceBus
{
using Persistence.CosmosDB;
using System;

/// <summary>
/// Represents the container name and the partition key path when the container information is provided at runtime through the pipeline.
Expand All @@ -14,7 +14,7 @@ public readonly struct ContainerInformation
/// <param name="partitionKeyPath">The partition key path matching the container in use.</param>
public ContainerInformation(string containerName, PartitionKeyPath partitionKeyPath)
{
Guard.AgainstNullAndEmpty(nameof(containerName), containerName);
ArgumentException.ThrowIfNullOrWhiteSpace(containerName);

ContainerName = containerName;
PartitionKeyPath = partitionKeyPath;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace NServiceBus
{
using System;
using Configuration.AdvancedExtensibility;
using Microsoft.Azure.Cosmos;
using Persistence.CosmosDB;
Expand All @@ -15,8 +16,8 @@ public static class CosmosPersistenceConfig
/// <remarks>The lifetime of the provided client is assumed to be controlled by the caller of this method and thus the client will not be disposed.</remarks>
public static PersistenceExtensions<CosmosPersistence> CosmosClient(this PersistenceExtensions<CosmosPersistence> persistenceExtensions, CosmosClient cosmosClient)
{
Guard.AgainstNull(nameof(persistenceExtensions), persistenceExtensions);
Guard.AgainstNull(nameof(cosmosClient), cosmosClient);
ArgumentNullException.ThrowIfNull(persistenceExtensions);
ArgumentNullException.ThrowIfNull(cosmosClient);

persistenceExtensions.GetSettings().Set<IProvideCosmosClient>(new CosmosClientProvidedByConfiguration { Client = cosmosClient });
return persistenceExtensions;
Expand All @@ -27,7 +28,7 @@ public static PersistenceExtensions<CosmosPersistence> CosmosClient(this Persist
/// </summary>
public static PersistenceExtensions<CosmosPersistence> DatabaseName(this PersistenceExtensions<CosmosPersistence> persistenceExtensions, string databaseName)
{
Guard.AgainstNullAndEmpty(nameof(databaseName), databaseName);
ArgumentException.ThrowIfNullOrWhiteSpace(databaseName);

persistenceExtensions.GetSettings().Set(SettingsKeys.DatabaseName, databaseName);

Expand All @@ -40,7 +41,7 @@ public static PersistenceExtensions<CosmosPersistence> DatabaseName(this Persist
/// <remarks>When the default container is not set the container information needs to be provided as part of the message handling pipeline.</remarks>
public static PersistenceExtensions<CosmosPersistence> DefaultContainer(this PersistenceExtensions<CosmosPersistence> persistenceExtensions, string containerName, string partitionKeyPath)
{
Guard.AgainstNull(nameof(persistenceExtensions), persistenceExtensions);
ArgumentNullException.ThrowIfNull(persistenceExtensions);

persistenceExtensions.GetSettings().Set(new ContainerInformation(containerName, new PartitionKeyPath(partitionKeyPath)));

Expand All @@ -52,7 +53,7 @@ public static PersistenceExtensions<CosmosPersistence> DefaultContainer(this Per
/// </summary>
public static void DisableContainerCreation(this PersistenceExtensions<CosmosPersistence> persistenceExtensions)
{
Guard.AgainstNull(nameof(persistenceExtensions), persistenceExtensions);
ArgumentNullException.ThrowIfNull(persistenceExtensions);

var installerSettings = persistenceExtensions.GetSettings().GetOrCreate<InstallerSettings>();
installerSettings.Disabled = true;
Expand All @@ -69,7 +70,7 @@ public static SagaPersistenceConfiguration Sagas(this PersistenceExtensions<Cosm
/// </summary>
public static TransactionInformationConfiguration TransactionInformation(this PersistenceExtensions<CosmosPersistence> persistenceExtensions)
{
Guard.AgainstNull(nameof(persistenceExtensions), persistenceExtensions);
ArgumentNullException.ThrowIfNull(persistenceExtensions);

return persistenceExtensions.GetSettings().GetOrCreate<TransactionInformationConfiguration>();
}
Expand Down
Loading

0 comments on commit 21f2e33

Please sign in to comment.