Skip to content

Commit

Permalink
Prepare rtm (#382)
Browse files Browse the repository at this point in the history
* Cleanup

* Prepare for RTM

* Set serializer

* Tweaks

* Explicit ref

* Tweaks

* Add license notice

---------

Co-authored-by: Brandon Ording <bording@gmail.com>
  • Loading branch information
andreasohlund and bording authored Mar 7, 2024
1 parent 166a610 commit 5fdaf6c
Show file tree
Hide file tree
Showing 30 changed files with 104 additions and 100 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,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
53 changes: 53 additions & 0 deletions THIRD-PARTY-NOTICES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
License notice for .NET Reference Source
----------------------------------------

https://github.com/microsoft/referencesource/blob/master/LICENSE.txt

The MIT License (MIT)

Copyright (c) Microsoft Corporation

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

License notice for Fastenshtein
----------------------------------------

https://github.com/DanHarltey/Fastenshtein/blob/master/LICENSE

The MIT License (MIT)

Copyright (c) 2017 DanHartley

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions src/AcceptanceTesting/AcceptanceTestLoggerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ public class AcceptanceTestLoggerFactory : ILoggerFactory
public AcceptanceTestLoggerFactory(ScenarioContext scenarioContext) => this.scenarioContext = scenarioContext;

public void AddProvider(ILoggerProvider provider) => throw new System.NotImplementedException();

public ILogger CreateLogger(string categoryName)
{
return new ScenarioContextLogger(categoryName, scenarioContext);
Expand Down
3 changes: 1 addition & 2 deletions src/AcceptanceTesting/AcceptanceTesting.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="9.0.0-alpha.9" />
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.6" />
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0" />
</ItemGroup>

</Project>
15 changes: 12 additions & 3 deletions src/AcceptanceTesting/BridgeComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,20 @@ public override async Task Start(CancellationToken cancellationToken = default)
await host.StartAsync(cancellationToken).ConfigureAwait(false);
}

public override async Task Stop()
public override async Task Stop(CancellationToken cancellationToken = default)
{
if (host != null)
if (host is null)
{
await host.StopAsync().ConfigureAwait(false);
return;
}

try
{
await host.StopAsync(cancellationToken).ConfigureAwait(false);
}
finally
{
host.Dispose();
}
}

Expand Down
4 changes: 1 addition & 3 deletions src/AcceptanceTests.ASB/AcceptanceTests.ASB.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

<ItemGroup>
<ProjectReference Include="..\AcceptanceTesting\AcceptanceTesting.csproj" />
<ProjectReference Include="..\NServiceBus.MessagingBridge\NServiceBus.MessagingBridge.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.6" />
<PackageReference Include="NServiceBus.Transport.AzureServiceBus" Version="4.0.0-alpha.2" />
<PackageReference Include="NServiceBus.Transport.AzureServiceBus" Version="4.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 1 addition & 3 deletions src/AcceptanceTests.ASQ/AcceptanceTests.ASQ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

<ItemGroup>
<ProjectReference Include="..\AcceptanceTesting\AcceptanceTesting.csproj" />
<ProjectReference Include="..\NServiceBus.MessagingBridge\NServiceBus.MessagingBridge.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.6" />
<PackageReference Include="NServiceBus.Transport.AzureStorageQueues" Version="13.0.0-alpha.1" />
<PackageReference Include="NServiceBus.Transport.AzureStorageQueues" Version="13.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 0 additions & 5 deletions src/AcceptanceTests.Learning/AcceptanceTests.Learning.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

<ItemGroup>
<ProjectReference Include="..\AcceptanceTesting\AcceptanceTesting.csproj" />
<ProjectReference Include="..\NServiceBus.MessagingBridge\NServiceBus.MessagingBridge.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.6" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 3 additions & 6 deletions src/AcceptanceTests.Msmq/AcceptanceTests.Msmq.csproj
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\NServiceBusTests.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\AcceptanceTesting\AcceptanceTesting.csproj" />
<ProjectReference Include="..\NServiceBus.MessagingBridge\NServiceBus.MessagingBridge.csproj" />
<ProjectReference Include="..\NServiceBus.MessagingBridge.Msmq\NServiceBus.MessagingBridge.Msmq.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.6" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
Expand Down
4 changes: 1 addition & 3 deletions src/AcceptanceTests.RabbitMQ/AcceptanceTests.RabbitMQ.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

<ItemGroup>
<ProjectReference Include="..\AcceptanceTesting\AcceptanceTesting.csproj" />
<ProjectReference Include="..\NServiceBus.MessagingBridge\NServiceBus.MessagingBridge.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.6" />
<PackageReference Include="NServiceBus.RabbitMQ" Version="9.0.0-alpha.1" />
<PackageReference Include="NServiceBus.RabbitMQ" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/AcceptanceTests.RabbitMQ/ConnectionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class ConnectionHelper
var factory = new ConnectionFactory
{
AutomaticRecoveryEnabled = true,
UseBackgroundThreadsForIO = true,
HostName = connectionStringParser.HostName,
UserName = connectionStringParser.UserName ?? "guest",
Password = connectionStringParser.Password ?? "guest",
Expand Down
4 changes: 1 addition & 3 deletions src/AcceptanceTests.SQS/AcceptanceTests.SQS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

<ItemGroup>
<ProjectReference Include="..\AcceptanceTesting\AcceptanceTesting.csproj" />
<ProjectReference Include="..\NServiceBus.MessagingBridge\NServiceBus.MessagingBridge.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.6" />
<PackageReference Include="NServiceBus.AmazonSQS" Version="7.0.0-alpha.2" />
<PackageReference Include="NServiceBus.AmazonSQS" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@

<ItemGroup>
<ProjectReference Include="..\AcceptanceTesting\AcceptanceTesting.csproj" />
<ProjectReference Include="..\NServiceBus.MessagingBridge\NServiceBus.MessagingBridge.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.6" />
<PackageReference Include="NServiceBus.Transport.SqlServer" Version="8.0.0-alpha.1" />
<PackageReference Include="NServiceBus.Transport.SqlServer" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/AcceptanceTests/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Justification: Test project
dotnet_diagnostic.CA2007.severity = none
dotnet_diagnostic.PS0004.severity = none # A parameter of type CancellationToken on a private delegate or method should be required
dotnet_diagnostic.PS0014.severity = none # Add a CancellationToken parameter type argument
dotnet_diagnostic.PS0018.severity = none # Add a CancellationToken parameter

# Justification: Tests don't support cancellation and don't need to forward IMessageHandlerContext.CancellationToken
Expand Down
5 changes: 0 additions & 5 deletions src/AcceptanceTests/AcceptanceTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

<ItemGroup>
<ProjectReference Include="..\AcceptanceTesting\AcceptanceTesting.csproj" />
<ProjectReference Include="..\NServiceBus.MessagingBridge\NServiceBus.MessagingBridge.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="NServiceBus.AcceptanceTesting" Version="9.0.0-alpha.6" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion src/AcceptanceTests/Shared/Support/BridgeAcceptanceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using NServiceBus.AcceptanceTesting;
using NServiceBus.Transport;
using NUnit.Framework;

Expand Down
1 change: 1 addition & 0 deletions src/AcceptanceTests/Shared/Support/DefaultServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public virtual async Task<EndpointConfiguration> GetConfiguration(RunDescriptor

configuration.TypesToIncludeInScan(endpointConfiguration.GetTypesScopedByTestClass());
configuration.EnableInstallers();
configuration.UseSerialization<SystemJsonSerializer>();

var recoverability = configuration.Recoverability();
recoverability.Delayed(delayed => delayed.NumberOfRetries(0));
Expand Down
1 change: 1 addition & 0 deletions src/AcceptanceTests/Shared/Support/DefaultTestServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public virtual async Task<EndpointConfiguration> GetConfiguration(RunDescriptor

configuration.TypesToIncludeInScan(endpointConfiguration.GetTypesScopedByTestClass());
configuration.EnableInstallers();
configuration.UseSerialization<SystemJsonSerializer>();

var recoverability = configuration.Recoverability();
recoverability.Delayed(delayed => delayed.NumberOfRetries(0));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0-windows</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\NServiceBus.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NServiceBus" Version="9.0.0-alpha.9" />
<PackageReference Include="NServiceBus.Transport.Msmq.Sources" Version="3.0.0-alpha.2" PrivateAssets="All" />
<PackageReference Include="NServiceBus" Version="[9.0.0, 10.0.0)" />
<PackageReference Include="NServiceBus.Transport.Msmq.Sources" Version="3.0.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Particular.Packaging" Version="4.1.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<InternalsVisibleTo Include="AcceptanceTests.Msmq" />
<InternalsVisibleTo Include="AcceptanceTests.Msmq" Key="$(NServiceBusTestsKey)"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace NServiceBus;

using System;
using Logging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Logging;

/// <summary>
/// Extension methods to configure the bridge for the .NET hosted applications builder.
Expand All @@ -14,17 +14,15 @@ public static class HostApplicationBuilderExtensions
/// <summary>
/// Configures the host to start the bridge.
/// </summary>
public static IHostApplicationBuilder UseNServiceBusBridge(this IHostApplicationBuilder builder,
BridgeConfiguration bridgeConfiguration)
public static IHostApplicationBuilder UseNServiceBusBridge(this IHostApplicationBuilder builder, BridgeConfiguration bridgeConfiguration)
{
ArgumentNullException.ThrowIfNull(builder);
ArgumentNullException.ThrowIfNull(bridgeConfiguration);

var deferredLoggerFactory = new DeferredLoggerFactory();
LogManager.UseFactory(deferredLoggerFactory);

_ = builder.Services.AddSingleton(sp =>
bridgeConfiguration.FinalizeConfiguration(sp.GetRequiredService<ILogger<BridgeConfiguration>>()))
_ = builder.Services.AddSingleton(sp => bridgeConfiguration.FinalizeConfiguration(sp.GetRequiredService<ILogger<BridgeConfiguration>>()))
.AddSingleton(deferredLoggerFactory)
.AddHostedService<BridgeHostedService>()
.AddSingleton<IStartableBridge, StartableBridge>()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
namespace NServiceBus;

using System;
using Logging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Logging;

/// <summary>
/// Extension methods to configure the bridge for the .NET generic host.
Expand All @@ -14,8 +14,7 @@ public static class HostBuilderExtensions
/// <summary>
/// Configures the host to start the bridge.
/// </summary>
public static IHostBuilder UseNServiceBusBridge(this IHostBuilder hostBuilder,
Action<BridgeConfiguration> bridgeConfigurationAction)
public static IHostBuilder UseNServiceBusBridge(this IHostBuilder hostBuilder, Action<BridgeConfiguration> bridgeConfigurationAction)
{
ArgumentNullException.ThrowIfNull(hostBuilder);
ArgumentNullException.ThrowIfNull(bridgeConfigurationAction);
Expand All @@ -26,8 +25,7 @@ public static IHostBuilder UseNServiceBusBridge(this IHostBuilder hostBuilder,
/// <summary>
/// Configures the host to start the bridge.
/// </summary>
public static IHostBuilder UseNServiceBusBridge(this IHostBuilder hostBuilder,
Action<HostBuilderContext, BridgeConfiguration> bridgeConfigurationAction)
public static IHostBuilder UseNServiceBusBridge(this IHostBuilder hostBuilder, Action<HostBuilderContext, BridgeConfiguration> bridgeConfigurationAction)
{
ArgumentNullException.ThrowIfNull(hostBuilder);
ArgumentNullException.ThrowIfNull(bridgeConfigurationAction);
Expand All @@ -41,8 +39,7 @@ public static IHostBuilder UseNServiceBusBridge(this IHostBuilder hostBuilder,

bridgeConfigurationAction(hostBuilderContext, bridgeConfiguration);

serviceCollection.AddSingleton(sp => bridgeConfiguration.FinalizeConfiguration(
sp.GetRequiredService<ILogger<BridgeConfiguration>>()))
serviceCollection.AddSingleton(sp => bridgeConfiguration.FinalizeConfiguration(sp.GetRequiredService<ILogger<BridgeConfiguration>>()))
.AddSingleton(deferredLoggerFactory)
.AddHostedService<BridgeHostedService>()
.AddSingleton<IStartableBridge, StartableBridge>()
Expand Down
Loading

0 comments on commit 5fdaf6c

Please sign in to comment.