diff --git a/src/AcceptanceTests/ConfigureClaimCheckEndpoint.cs b/src/AcceptanceTests/ConfigureClaimCheckEndpoint.cs index 746bcb42..25d75bd4 100644 --- a/src/AcceptanceTests/ConfigureClaimCheckEndpoint.cs +++ b/src/AcceptanceTests/ConfigureClaimCheckEndpoint.cs @@ -1,6 +1,5 @@ using System.Threading.Tasks; using NServiceBus; -using NServiceBus.ClaimCheck; using NServiceBus.AcceptanceTesting.Support; using NServiceBus.ClaimCheck.AzureBlobStorage.AcceptanceTests; diff --git a/src/Custom.Build.props b/src/Custom.Build.props index 69bbf31e..17844b50 100644 --- a/src/Custom.Build.props +++ b/src/Custom.Build.props @@ -1,7 +1,7 @@ - 6.0 + 7.0 minor diff --git a/src/DataBus/AzureDataBus.cs b/src/DataBus/AzureDataBus.cs deleted file mode 100644 index 89940377..00000000 --- a/src/DataBus/AzureDataBus.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace NServiceBus -{ - using System; - using DataBus; - using NServiceBus.DataBus.AzureBlobStorage; - - /// - /// DataBus implementation that uses azure blob storage. - /// - [ObsoleteEx(Message = "AzureDataBus has been replaced by AzureClaimCheck.", RemoveInVersion = "8", TreatAsErrorFromVersion = "7", ReplacementTypeOrMember = "AzureClaimCheck")] -#pragma warning disable CS0618 // Type or member is obsolete - public class AzureDataBus : DataBusDefinition - { - /// The feature to enable when this databus is selected. -#pragma warning disable CS0672 // Member overrides obsolete member - protected override Type ProvidedByFeature() -#pragma warning restore CS0672 // Member overrides obsolete member - { - return typeof(AzureDataBusPersistence); - } - } -#pragma warning restore CS0618 // Type or member is obsolete -} \ No newline at end of file diff --git a/src/DataBus/AzureDataBusPersistence.cs b/src/DataBus/AzureDataBusPersistence.cs deleted file mode 100644 index 5097690a..00000000 --- a/src/DataBus/AzureDataBusPersistence.cs +++ /dev/null @@ -1,63 +0,0 @@ -namespace NServiceBus.DataBus.AzureBlobStorage -{ - using Azure.Core; - using Azure.Storage.Blobs; - using System; - using Microsoft.Extensions.DependencyInjection; - using NServiceBus.ClaimCheck.AzureBlobStorage; - using NServiceBus.ClaimCheck.AzureBlobStorage.Config; - using NServiceBus.Features; - - class AzureDataBusPersistence : Feature - { - public AzureDataBusPersistence() - { -#pragma warning disable CS0618 // Type or member is obsolete - DependsOn(); -#pragma warning restore CS0618 // Type or member is obsolete - } - - protected override void Setup(FeatureConfigurationContext context) - { - var claimCheckSettings = context.Settings.GetOrDefault() ?? new ClaimCheckSettings(); - - // If a service client has been registered in the container, it will added later in the configuration process and replace any client set here - if (!context.Settings.TryGet(out IProvideBlobServiceClient blobContainerClientProvider) && claimCheckSettings.ConnectionStringProvided) - { - var blobContainerClient = CreateBlobServiceClient(claimCheckSettings); - blobContainerClientProvider = new BlobServiceClientProvidedByConfiguration { Client = blobContainerClient }; - } - - context.Services.AddSingleton(blobContainerClientProvider ?? new ThrowIfNoBlobServiceClientProvider()); -#pragma warning disable CS0618 // Type or member is obsolete - context.Services.AddSingleton(serviceProvider => new BlobStorageDataBus(serviceProvider.GetRequiredService(), - claimCheckSettings)); -#pragma warning restore CS0618 // Type or member is obsolete - - context.Settings.AddStartupDiagnosticsSection( - typeof(AzureClaimCheck).FullName, - new - { - ConnectionMechanism = claimCheckSettings.ConnectionStringProvided ? "ConnectionString" : "BlobServiceClient", - ContainerName = claimCheckSettings.Container, - claimCheckSettings.MaxRetries, - claimCheckSettings.BackOffInterval, - claimCheckSettings.NumberOfIOThreads, - }); - } - - BlobServiceClient CreateBlobServiceClient(ClaimCheckSettings claimCheckSettings) - { - var clientOptions = new BlobClientOptions - { - Retry = - { - Delay = TimeSpan.FromSeconds(claimCheckSettings.BackOffInterval), - MaxRetries = claimCheckSettings.MaxRetries, - Mode = RetryMode.Fixed - } - }; - return new BlobServiceClient(claimCheckSettings.ConnectionString, clientOptions); - } - } -} diff --git a/src/DataBus/BlobStorageDataBus.cs b/src/DataBus/BlobStorageDataBus.cs deleted file mode 100644 index 39efd0ac..00000000 --- a/src/DataBus/BlobStorageDataBus.cs +++ /dev/null @@ -1,92 +0,0 @@ -namespace NServiceBus.DataBus.AzureBlobStorage -{ - using System; - using System.Collections.Generic; - using System.IO; - using System.Threading; - using System.Threading.Tasks; - using Azure.Storage; - using Azure.Storage.Blobs; - using Azure.Storage.Blobs.Models; - using ClaimCheck.AzureBlobStorage; - using Logging; - using DataBus; - using Microsoft.IO; - - [ObsoleteEx] -#pragma warning disable CS0618 // Type or member is obsolete - class BlobStorageDataBus : IDataBus, IDisposable -#pragma warning restore CS0618 // Type or member is obsolete - { - public BlobStorageDataBus(DataBus.AzureBlobStorage.IProvideBlobServiceClient blobServiceClientProvider, ClaimCheckSettings settings) - { - this.settings = settings; - - blobContainerClient = blobServiceClientProvider.Client.GetBlobContainerClient(settings.Container); - } - - public async Task Get(string key, CancellationToken cancellationToken = default) - { - var blobClient = blobContainerClient.GetBlobClient(Path.Combine(settings.BasePath, key)); - var properties = await blobClient.GetPropertiesAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - // core takes care of disposing - var stream = memoryStreamManager.GetStream(key, (int)properties.Value.ContentLength); - - var transferOptions = new StorageTransferOptions - { - MaximumConcurrency = settings.NumberOfIOThreads, - }; - - await blobClient.DownloadToAsync(stream, null, transferOptions, cancellationToken).ConfigureAwait(false); - stream.Seek(0, SeekOrigin.Begin); - return stream; - } - - public async Task Put(Stream stream, TimeSpan timeToBeReceived, CancellationToken cancellationToken = default) - { - var key = Guid.NewGuid().ToString(); - var blobClient = blobContainerClient.GetBlobClient(Path.Combine(settings.BasePath, key)); - - Dictionary metadata = null; - if (timeToBeReceived != TimeSpan.MaxValue) - { - var validUntil = DateTimeOffset.UtcNow + timeToBeReceived; - - metadata = new Dictionary - { - { "ValidUntilUtc", DateTimeOffsetHelper.ToWireFormattedString(validUntil) } - }; - } - var blobUploadOptions = new BlobUploadOptions - { - TransferOptions = new StorageTransferOptions - { - MaximumConcurrency = settings.NumberOfIOThreads - }, - Metadata = metadata - }; - await blobClient.UploadAsync(stream, blobUploadOptions, cancellationToken).ConfigureAwait(false); - - return key; - } - - public async Task Start(CancellationToken cancellationToken = default) - { - await blobContainerClient.CreateIfNotExistsAsync(cancellationToken: cancellationToken).ConfigureAwait(false); - - logger.Info("Blob storage data bus started. Location: " + Path.Combine(blobContainerClient.Uri.ToString(), settings.BasePath)); - } - - public void Dispose() - { - logger.Info("Blob storage data bus stopped"); - } - - BlobContainerClient blobContainerClient; - ClaimCheckSettings settings; -#pragma warning disable CS0618 // Type or member is obsolete - static ILog logger = LogManager.GetLogger(typeof(IDataBus)); -#pragma warning restore CS0618 // Type or member is obsolete - static readonly RecyclableMemoryStreamManager memoryStreamManager = new RecyclableMemoryStreamManager(); - } -} \ No newline at end of file diff --git a/src/DataBus/Config/IProvideBlobServiceClient.cs b/src/DataBus/Config/IProvideBlobServiceClient.cs index 8f9da663..63485c82 100644 --- a/src/DataBus/Config/IProvideBlobServiceClient.cs +++ b/src/DataBus/Config/IProvideBlobServiceClient.cs @@ -17,18 +17,3 @@ public interface IProvideBlobServiceClient } } -namespace NServiceBus.DataBus.AzureBlobStorage -{ - using Azure.Storage.Blobs; - - /// - /// Provides a via dependency injection. A custom implementation can be registered on the container and will be picked up by the persistence. - /// - /// The client provided will not be disposed by the persistence. It is the responsibility of the provider to take care of proper resource disposal if necessary. - /// - /// - [ObsoleteEx(Message = "NServiceBus.DataBus.AzureBlobStorage.IProvideBlobServiceClient has been replaced by NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient.", RemoveInVersion = "8", TreatAsErrorFromVersion = "7", ReplacementTypeOrMember = "NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient")] - public interface IProvideBlobServiceClient : NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient - { - } -} \ No newline at end of file diff --git a/src/DataBus/ConfigureAzureDataBus.cs b/src/DataBus/ConfigureAzureDataBus.cs deleted file mode 100644 index b686a206..00000000 --- a/src/DataBus/ConfigureAzureDataBus.cs +++ /dev/null @@ -1,134 +0,0 @@ -namespace NServiceBus -{ - using System; - using System.Text.RegularExpressions; - using Azure.Storage.Blobs; - using Configuration.AdvancedExtensibility; - using DataBus; - using NServiceBus.ClaimCheck.AzureBlobStorage; - using NServiceBus.ClaimCheck.AzureBlobStorage.Config; - - /// - /// Configuration options for the Azure BlobStorage DataBus. - /// -#pragma warning disable CS0618 // Type or member is obsolete - [ObsoleteEx(Message = "AzureDataBus has been replaced by AzureClaimCheck. These extension methods are replaced by the ones on the AzureClaimCheck type.", RemoveInVersion = "8", TreatAsErrorFromVersion = "7", ReplacementTypeOrMember = "AzureClaimCheck")] - public static class ConfigureAzureDataBus - { - /// - /// Sets the number of retries used by the blob storage client. Default is 5. - /// - public static DataBusExtensions MaxRetries(this DataBusExtensions config, int maxRetries) - { - ArgumentOutOfRangeException.ThrowIfNegative(maxRetries); - - GetSettings(config).MaxRetries = maxRetries; - return config; - } - - /// - /// Sets backoff interval used by the blob storage client. Default is 30 seconds. - /// - public static DataBusExtensions BackOffInterval(this DataBusExtensions config, int backOffInterval) - { - ArgumentOutOfRangeException.ThrowIfNegative(backOffInterval); - - GetSettings(config).BackOffInterval = backOffInterval; - return config; - } - - /// - /// Sets the number threads used the blob storage client. Default is 5. - /// - public static DataBusExtensions NumberOfIOThreads(this DataBusExtensions config, int numberOfIOThreads) - { - ArgumentOutOfRangeException.ThrowIfNegativeOrZero(numberOfIOThreads); - - GetSettings(config).NumberOfIOThreads = numberOfIOThreads; - return config; - } - - /// - /// The connection string to use. Default is `UseDevelopmentStorage=true`. - /// - public static DataBusExtensions ConnectionString(this DataBusExtensions config, string connectionString) - { - ArgumentException.ThrowIfNullOrWhiteSpace(connectionString); - - var dataBusSettings = GetSettings(config); - - dataBusSettings.ConnectionString = connectionString; - dataBusSettings.ConnectionStringProvided = true; - - return config; - } - - /// - /// The blob container name to use. Default is ``. - /// - public static DataBusExtensions Container(this DataBusExtensions config, string containerName) - { - if (!IsValidBlobContainerName(containerName)) - { - const string errorMessage = - "Invalid container name. The container name must be confirming to the following naming rules:" + - "1. Must start with a letter or number, and can contain only letters, numbers, and the dash (-) character." + - "2. Every dash (-) character must be immediately preceded and followed by a letter or number." + - "3. All letters must be lowercase." + - "4. Container name must be from 3 through 63 characters long."; - - throw new ArgumentException(errorMessage, nameof(containerName)); - } - - GetSettings(config).Container = containerName; - return config; - } - - /// - /// The base path within the container. Default is ``. - /// - public static DataBusExtensions BasePath(this DataBusExtensions config, string basePath) - { - var value = basePath ?? " "; - var spacesOnly = value.Trim().Length == 0 && value.Length != 0; - - if (spacesOnly) - { - throw new ArgumentException("Should not be null or spaces only.", nameof(basePath)); - } - - GetSettings(config).BasePath = basePath; - return config; - } - - /// - /// Set the custom to be used by the persistence, enabling the necessary customizations to the client. - /// - public static DataBusExtensions UseBlobServiceClient(this DataBusExtensions config, - BlobServiceClient blobServiceClient) - { - ArgumentNullException.ThrowIfNull(blobServiceClient); - - config.GetSettings().Set(new BlobServiceClientProvidedByConfiguration { Client = blobServiceClient }); - return config; - } - - static bool IsValidBlobContainerName(object containerName) - { - return !string.IsNullOrWhiteSpace((string)containerName) && - Regex.IsMatch((string)containerName, @"^(([a-z\d]((-(?=[a-z\d]))|([a-z\d])){2,62})|(\$root))$"); - } - - static ClaimCheckSettings GetSettings(DataBusExtensions config) - { - if (!config.GetSettings().TryGet(out var settings)) - { - settings = new ClaimCheckSettings(); - config.GetSettings().Set(settings); - } - - return settings; - } - } -#pragma warning restore CS0618 // Type or member is obsolete -} diff --git a/src/DataBus/obsolete_v7.cs b/src/DataBus/obsolete_v7.cs new file mode 100644 index 00000000..a71f5fab --- /dev/null +++ b/src/DataBus/obsolete_v7.cs @@ -0,0 +1,144 @@ +#pragma warning disable CS0618 // Type or member is obsolete +#pragma warning disable CS0672 // Member overrides + +namespace NServiceBus.DataBus.AzureBlobStorage +{ + using System; + using System.IO; + using System.Threading; + using System.Threading.Tasks; + using Azure.Storage.Blobs; + using ClaimCheck.AzureBlobStorage; + using Features; + + /// + /// Provides a via dependency injection. A custom implementation can be registered on the container and will be picked up by the persistence. + /// + /// The client provided will not be disposed by the persistence. It is the responsibility of the provider to take care of proper resource disposal if necessary. + /// + /// + [ObsoleteEx(Message = "NServiceBus.DataBus.AzureBlobStorage.IProvideBlobServiceClient has been replaced by NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient.", RemoveInVersion = "8", TreatAsErrorFromVersion = "7", ReplacementTypeOrMember = "NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient")] + public interface IProvideBlobServiceClient : NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient + { + } + + class AzureDataBusPersistence : Feature + { + protected override void Setup(FeatureConfigurationContext context) + { + throw new NotImplementedException(); + } + } + + [ObsoleteEx] + class BlobStorageDataBus : IDataBus, IDisposable + { + public BlobStorageDataBus(IProvideBlobServiceClient blobServiceClientProvider, ClaimCheckSettings settings) + { + throw new NotImplementedException(); + } + + public Task Get(string key, CancellationToken cancellationToken = default) + { + throw new NotImplementedException(); + } + + public Task Put(Stream stream, TimeSpan timeToBeReceived, CancellationToken cancellationToken = default) + { + throw new NotImplementedException(); + } + + public Task Start(CancellationToken cancellationToken = default) + { + throw new NotImplementedException(); + } + + public void Dispose() + { + throw new NotImplementedException(); + } + } +} + +namespace NServiceBus +{ + using System; + using Azure.Storage.Blobs; + using DataBus; + + /// + /// DataBus implementation that uses azure blob storage. + /// + [ObsoleteEx(Message = "AzureDataBus has been replaced by AzureClaimCheck.", RemoveInVersion = "8", TreatAsErrorFromVersion = "7", ReplacementTypeOrMember = "AzureClaimCheck")] + public class AzureDataBus : DataBusDefinition + { + /// The feature to enable when this databus is selected. + protected override Type ProvidedByFeature() => throw new NotImplementedException(); + } + + /// + /// Configuration options for the Azure BlobStorage DataBus. + /// + [ObsoleteEx(Message = "AzureDataBus has been replaced by AzureClaimCheck. These extension methods are replaced by the ones on the AzureClaimCheck type.", RemoveInVersion = "8", TreatAsErrorFromVersion = "7", ReplacementTypeOrMember = "AzureClaimCheck")] + public static class ConfigureAzureDataBus + { + /// + /// Sets the number of retries used by the blob storage client. Default is 5. + /// + public static DataBusExtensions MaxRetries(this DataBusExtensions config, int maxRetries) + { + throw new NotImplementedException(); + } + + /// + /// Sets backoff interval used by the blob storage client. Default is 30 seconds. + /// + public static DataBusExtensions BackOffInterval(this DataBusExtensions config, int backOffInterval) + { + throw new NotImplementedException(); + } + + /// + /// Sets the number threads used the blob storage client. Default is 5. + /// + public static DataBusExtensions NumberOfIOThreads(this DataBusExtensions config, int numberOfIOThreads) + { + throw new NotImplementedException(); + } + + /// + /// The connection string to use. Default is `UseDevelopmentStorage=true`. + /// + public static DataBusExtensions ConnectionString(this DataBusExtensions config, string connectionString) + { + throw new NotImplementedException(); + } + + /// + /// The blob container name to use. Default is ``. + /// + public static DataBusExtensions Container(this DataBusExtensions config, string containerName) + { + throw new NotImplementedException(); + } + + /// + /// The base path within the container. Default is ``. + /// + public static DataBusExtensions BasePath(this DataBusExtensions config, string basePath) + { + throw new NotImplementedException(); + } + + /// + /// Set the custom to be used by the persistence, enabling the necessary customizations to the client. + /// + public static DataBusExtensions UseBlobServiceClient(this DataBusExtensions config, + BlobServiceClient blobServiceClient) + { + throw new NotImplementedException(); + } + } +} +#pragma warning restore CS0618 // Type or member is obsolete +#pragma warning restore CS0672 // Member overrides \ No newline at end of file diff --git a/src/DataBusAcceptanceTests/.editorconfig b/src/DataBusAcceptanceTests/.editorconfig deleted file mode 100644 index af187110..00000000 --- a/src/DataBusAcceptanceTests/.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -[*.cs] - -# Justification: Test project -dotnet_diagnostic.CA2007.severity = none - -# may be enabled in future -dotnet_diagnostic.PS0018.severity = none # A task-returning method should have a CancellationToken parameter unless it has a parameter implementing ICancellableContext - -# Justification: Tests don't support cancellation and don't need to forward IMessageHandlerContext.CancellationToken -dotnet_diagnostic.NSB0002.severity = suggestion diff --git a/src/DataBusAcceptanceTests/ConfigureDatabusEndpoint.cs b/src/DataBusAcceptanceTests/ConfigureDatabusEndpoint.cs deleted file mode 100644 index 4f94b859..00000000 --- a/src/DataBusAcceptanceTests/ConfigureDatabusEndpoint.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.Threading.Tasks; -using NServiceBus; -using NServiceBus.AcceptanceTesting.Support; -using NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests; - -public class ConfigureDatabusEndpoint : IConfigureEndpointTestExecution -{ - public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata) - { - configuration.UsePersistence(); -#pragma warning disable CS0618 // Type or member is obsolete - configuration.UseDataBus().Container(SetupFixture.ContainerName); -#pragma warning restore CS0618 // Type or member is obsolete - - return Task.FromResult(0); - } - - public Task Cleanup() - { - // Nothing required for in-memory persistence - return Task.FromResult(0); - } -} diff --git a/src/DataBusAcceptanceTests/NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests.csproj b/src/DataBusAcceptanceTests/NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests.csproj deleted file mode 100644 index 694d29cb..00000000 --- a/src/DataBusAcceptanceTests/NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - net8.0 - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/DataBusAcceptanceTests/SetupFixture.cs b/src/DataBusAcceptanceTests/SetupFixture.cs deleted file mode 100644 index 62be7f24..00000000 --- a/src/DataBusAcceptanceTests/SetupFixture.cs +++ /dev/null @@ -1,52 +0,0 @@ -namespace NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests -{ - using Azure.Storage.Blobs; - using System; - using System.IO; - using System.Threading.Tasks; - using NUnit.Framework; - - [SetUpFixture] - public class SetupFixture - { - [OneTimeSetUp] - public async Task OneTimeSetUp() - { - var connectionString = GetEnvConfiguredConnectionString(); - - ContainerName = $"{Path.GetFileNameWithoutExtension(Path.GetTempFileName())}{DateTime.UtcNow.Ticks}".ToLowerInvariant(); - - BlobServiceClient = new BlobServiceClient(connectionString); - BlobContainerClient = BlobServiceClient.GetBlobContainerClient(ContainerName); - await BlobContainerClient.CreateIfNotExistsAsync(); - } - - [OneTimeTearDown] - public Task OneTimeTearDown() - { - return BlobContainerClient.DeleteIfExistsAsync(); - } - - public static string GetEnvConfiguredConnectionString() - { - var environmentVartiableName = "NServiceBus_DataBus_AzureBlobStorage_ConnectionString"; - var connectionString = GetEnvironmentVariable(environmentVartiableName); - if (string.IsNullOrEmpty(connectionString)) - { - throw new Exception($"Oh no! We couldn't find an environment variable '{environmentVartiableName}' with Azure Storage connection string."); - } - - return connectionString; - } - - static string GetEnvironmentVariable(string variable) - { - var candidate = Environment.GetEnvironmentVariable(variable, EnvironmentVariableTarget.User); - return string.IsNullOrWhiteSpace(candidate) ? Environment.GetEnvironmentVariable(variable) : candidate; - } - - public static string ContainerName; - public static BlobContainerClient BlobContainerClient; - public static BlobServiceClient BlobServiceClient; - } -} \ No newline at end of file diff --git a/src/DataBusAcceptanceTests/TestSuiteConstraints.cs b/src/DataBusAcceptanceTests/TestSuiteConstraints.cs deleted file mode 100644 index c649dfe6..00000000 --- a/src/DataBusAcceptanceTests/TestSuiteConstraints.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace NServiceBus.AcceptanceTests -{ - using AcceptanceTesting.Support; - - public partial class TestSuiteConstraints - { - public bool SupportsDtc => false; - public bool SupportsCrossQueueTransactions => true; - public bool SupportsNativePubSub => true; - public bool SupportsNativeDeferral => true; - public bool SupportsOutbox => true; - public bool SupportsDelayedDelivery => true; - public bool SupportsPurgeOnStartup => true; - - public IConfigureEndpointTestExecution CreateTransportConfiguration() - { - return new ConfigureEndpointAcceptanceTestingTransport(SupportsNativePubSub, SupportsNativeDeferral); - } - - public IConfigureEndpointTestExecution CreatePersistenceConfiguration() - { - return new ConfigureDatabusEndpoint(); - } - } -} \ No newline at end of file diff --git a/src/DataBusAcceptanceTests/When_using_databus_with_client.cs b/src/DataBusAcceptanceTests/When_using_databus_with_client.cs deleted file mode 100644 index dfa5e7f3..00000000 --- a/src/DataBusAcceptanceTests/When_using_databus_with_client.cs +++ /dev/null @@ -1,73 +0,0 @@ -namespace NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests -{ - using System; - using System.Threading.Tasks; - using AcceptanceTesting; - using NServiceBus; - using NServiceBus.AcceptanceTests; - using NServiceBus.AcceptanceTests.EndpointTemplates; - using NUnit.Framework; - using NUnit.Framework.Legacy; - -#pragma warning disable CS0618 // Type or member is obsolete - public class When_using_databus_with_client : NServiceBusAcceptanceTest - { - [Test] - public async Task Should_work() - { - var payloadToSend = new byte[1024 * 1024]; - new Random().NextBytes(payloadToSend); - - var context = await Scenario.Define() - .WithEndpoint(b => b.When(session => - session.SendLocal(new MyMessageWithLargePayload - { - Payload = new DataBusProperty(payloadToSend) - }))) - .Done(c => c.MessageReceived) - .Run(); - - Assert.That(context.PayloadReceived, Is.EqualTo(payloadToSend).AsCollection); - } - - public class Context : ScenarioContext - { - public byte[] PayloadReceived { get; set; } - public bool MessageReceived { get; set; } - } - - public class EndpointWithCustomClient : EndpointConfigurationBuilder - { - public EndpointWithCustomClient() - { - EndpointSetup(config => - { - config.UseDataBus().UseBlobServiceClient(SetupFixture.BlobServiceClient); - }); - } - - public class DataBusMessageHandler : IHandleMessages - { - public DataBusMessageHandler(Context testContext) - { - this.testContext = testContext; - } - - public Task Handle(MyMessageWithLargePayload message, IMessageHandlerContext context) - { - testContext.PayloadReceived = message.Payload.Value; - testContext.MessageReceived = true; - return Task.CompletedTask; - } - - readonly Context testContext; - } - } - - public class MyMessageWithLargePayload : ICommand - { - public DataBusProperty Payload { get; set; } - } - } -#pragma warning restore CS0618 // Type or member is obsolete -} \ No newline at end of file diff --git a/src/DataBusAcceptanceTests/When_using_databus_with_connection_string.cs b/src/DataBusAcceptanceTests/When_using_databus_with_connection_string.cs deleted file mode 100644 index c461e1ad..00000000 --- a/src/DataBusAcceptanceTests/When_using_databus_with_connection_string.cs +++ /dev/null @@ -1,70 +0,0 @@ -namespace NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests -{ - using System; - using System.Threading.Tasks; - using AcceptanceTesting; - using NServiceBus; - using NServiceBus.AcceptanceTests; - using NServiceBus.AcceptanceTests.EndpointTemplates; - using NUnit.Framework; - using NUnit.Framework.Legacy; - -#pragma warning disable CS0618 // Type or member is obsolete - public class When_using_databus_with_connection_string : NServiceBusAcceptanceTest - { - [Test] - public async Task Should_work() - { - var payloadToSend = new byte[1024 * 1024]; - new Random().NextBytes(payloadToSend); - - var context = await Scenario.Define() - .WithEndpoint(b => b.When(session => - session.SendLocal(new MyMessageWithLargePayload { Payload = new DataBusProperty(payloadToSend) }))) - .Done(c => c.MessageReceived) - .Run(); - - Assert.That(context.PayloadReceived, Is.EqualTo(payloadToSend).AsCollection); - } - - public class Context : ScenarioContext - { - public byte[] PayloadReceived { get; set; } - public bool MessageReceived { get; set; } - } - - public class EndpointWithDatabusUsingConnection : EndpointConfigurationBuilder - { - public EndpointWithDatabusUsingConnection() - { - EndpointSetup(config => - { - config.UseDataBus().ConnectionString(SetupFixture.GetEnvConfiguredConnectionString()); - }); - } - - public class DataBusMessageHandler : IHandleMessages - { - public DataBusMessageHandler(Context testContext) - { - this.testContext = testContext; - } - - public Task Handle(MyMessageWithLargePayload message, IMessageHandlerContext context) - { - testContext.PayloadReceived = message.Payload.Value; - testContext.MessageReceived = true; - return Task.CompletedTask; - } - - readonly Context testContext; - } - } - - public class MyMessageWithLargePayload : ICommand - { - public DataBusProperty Payload { get; set; } - } - } -#pragma warning restore CS0618 // Type or member is obsolete -} \ No newline at end of file diff --git a/src/DataBusAcceptanceTests/When_using_databus_with_custom_provider.cs b/src/DataBusAcceptanceTests/When_using_databus_with_custom_provider.cs deleted file mode 100644 index 394ef8bd..00000000 --- a/src/DataBusAcceptanceTests/When_using_databus_with_custom_provider.cs +++ /dev/null @@ -1,94 +0,0 @@ -namespace NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests -{ - using System; - using System.Threading.Tasks; - using AcceptanceTesting; - using NUnit.Framework; - using Azure.Storage.Blobs; - using Microsoft.Extensions.DependencyInjection; - using NServiceBus.AcceptanceTests; - using NServiceBus.AcceptanceTests.EndpointTemplates; - using NUnit.Framework.Legacy; - -#pragma warning disable CS0618 // Type or member is obsolete - public class When_using_databus_with_custom_provider : NServiceBusAcceptanceTest - { - [Test] - public async Task Should_work() - { - var payloadToSend = new byte[1024 * 1024]; - new Random().NextBytes(payloadToSend); - - var context = await Scenario.Define() - .WithEndpoint(b => b.When(session => session.SendLocal(new MessageWithLargePayload - { - Payload = new DataBusProperty(payloadToSend) - }))) - .Done(c => c.MessageReceived) - .Run(); - - Assert.That(context.ProviderWasCalled); - Assert.That(context.PayloadReceived, Is.EqualTo(payloadToSend).AsCollection); - } - - public class Context : ScenarioContext - { - public byte[] PayloadReceived { get; set; } - public bool MessageReceived { get; set; } - public bool ProviderWasCalled { get; set; } - } - - public class EndpointWithCustomProvider : EndpointConfigurationBuilder - { - public EndpointWithCustomProvider() - { - EndpointSetup(config => - { - config.RegisterComponents(services => services.AddSingleton()); - }); - } - - public class DataBusMessageHandler : IHandleMessages - { - public DataBusMessageHandler(Context testContext) - { - this.testContext = testContext; - } - - public Task Handle(MessageWithLargePayload messageWithLargePayload, IMessageHandlerContext context) - { - testContext.PayloadReceived = messageWithLargePayload.Payload.Value; - testContext.MessageReceived = true; - return Task.CompletedTask; - } - - readonly Context testContext; - } - - public class CustomProvider : IProvideBlobServiceClient - { - public CustomProvider(Context testContext) - { - this.testContext = testContext; - } - - public BlobServiceClient Client - { - get - { - testContext.ProviderWasCalled = true; - return SetupFixture.BlobServiceClient; - } - } - - readonly Context testContext; - } - } - - public class MessageWithLargePayload : ICommand - { - public DataBusProperty Payload { get; set; } - } - } -#pragma warning restore CS0618 // Type or member is obsolete -} \ No newline at end of file diff --git a/src/DataBusAcceptanceTests/When_using_databus_with_expiry.cs b/src/DataBusAcceptanceTests/When_using_databus_with_expiry.cs deleted file mode 100644 index 64b76fdf..00000000 --- a/src/DataBusAcceptanceTests/When_using_databus_with_expiry.cs +++ /dev/null @@ -1,72 +0,0 @@ -namespace NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests -{ - using System; - using System.Threading.Tasks; - using AcceptanceTesting; - using NServiceBus; - using NServiceBus.AcceptanceTests; - using NServiceBus.AcceptanceTests.EndpointTemplates; - using NUnit.Framework; - using NUnit.Framework.Legacy; - -#pragma warning disable CS0618 // Type or member is obsolete - public class When_using_databus_with_expiry : NServiceBusAcceptanceTest - { - [Test] - public async Task Should_work() - { - var payloadToSend = new byte[1024 * 1024]; - new Random().NextBytes(payloadToSend); - - var context = await Scenario.Define() - .WithEndpoint(b => b.When(session => - session.SendLocal(new MyMessageWithLargePayloadAndExpiry { Payload = new DataBusProperty(payloadToSend) }))) - .Done(c => c.MessageReceived) - .Run(); - - Assert.That(context.PayloadReceived, Is.EqualTo(payloadToSend).AsCollection); - } - - public class Context : ScenarioContext - { - public byte[] PayloadReceived { get; set; } - public bool MessageReceived { get; set; } - } - - public class EndpointReceivingMessageWithExpiry : EndpointConfigurationBuilder - { - public EndpointReceivingMessageWithExpiry() - { - EndpointSetup(config => - { - config.UseDataBus().UseBlobServiceClient(SetupFixture.BlobServiceClient); - }); - } - - public class DataBusMessageHandler : IHandleMessages - { - public DataBusMessageHandler(Context testContext) - { - this.testContext = testContext; - } - - public Task Handle(MyMessageWithLargePayloadAndExpiry message, IMessageHandlerContext context) - { - testContext.PayloadReceived = message.Payload.Value; - testContext.MessageReceived = true; - return Task.CompletedTask; - } - - readonly Context testContext; - } - } - - // Discard after thirty seconds - [TimeToBeReceived("00:00:30")] - public class MyMessageWithLargePayloadAndExpiry : ICommand - { - public DataBusProperty Payload { get; set; } - } - } -#pragma warning restore CS0618 // Type or member is obsolete -} \ No newline at end of file diff --git a/src/NServiceBus.DataBus.AzureBlobStorage.sln b/src/NServiceBus.DataBus.AzureBlobStorage.sln index 99d18b96..ad09c6ae 100644 --- a/src/NServiceBus.DataBus.AzureBlobStorage.sln +++ b/src/NServiceBus.DataBus.AzureBlobStorage.sln @@ -14,8 +14,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Custom.Build.props = Custom.Build.props EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests", "DataBusAcceptanceTests\NServiceBus.DataBus.AzureBlobStorage.AcceptanceTests.csproj", "{559FF0FD-5410-4FE5-8F82-0E8BC51CB30E}" -EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -34,10 +32,6 @@ Global {30D8D310-671A-4C18-B0D7-1F16F46A5C83}.Debug|Any CPU.Build.0 = Debug|Any CPU {30D8D310-671A-4C18-B0D7-1F16F46A5C83}.Release|Any CPU.ActiveCfg = Release|Any CPU {30D8D310-671A-4C18-B0D7-1F16F46A5C83}.Release|Any CPU.Build.0 = Release|Any CPU - {559FF0FD-5410-4FE5-8F82-0E8BC51CB30E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {559FF0FD-5410-4FE5-8F82-0E8BC51CB30E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {559FF0FD-5410-4FE5-8F82-0E8BC51CB30E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {559FF0FD-5410-4FE5-8F82-0E8BC51CB30E}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Tests/ApprovalFiles/APIApprovals.Approve.approved.txt b/src/Tests/ApprovalFiles/APIApprovals.Approve.approved.txt index 035bfca7..0343e1a6 100644 --- a/src/Tests/ApprovalFiles/APIApprovals.Approve.approved.txt +++ b/src/Tests/ApprovalFiles/APIApprovals.Approve.approved.txt @@ -8,8 +8,7 @@ namespace NServiceBus protected override System.Type ProvidedByFeature() { } } [System.Obsolete("AzureDataBus has been replaced by AzureClaimCheck. Use `AzureClaimCheck` instead." + - " Will be treated as an error from version 7.0.0. Will be removed in version 8.0." + - "0.", false)] + " Will be removed in version 8.0.0.", true)] public class AzureDataBus : NServiceBus.DataBus.DataBusDefinition { public AzureDataBus() { } @@ -27,8 +26,7 @@ namespace NServiceBus } [System.Obsolete("AzureDataBus has been replaced by AzureClaimCheck. These extension methods are re" + "placed by the ones on the AzureClaimCheck type. Use `AzureClaimCheck` instead. W" + - "ill be treated as an error from version 7.0.0. Will be removed in version 8.0.0." + - "", false)] + "ill be removed in version 8.0.0.", true)] public static class ConfigureAzureDataBus { public static NServiceBus.DataBus.DataBusExtensions BackOffInterval(this NServiceBus.DataBus.DataBusExtensions config, int backOffInterval) { } @@ -49,6 +47,6 @@ namespace NServiceBus.ClaimCheck.AzureBlobStorage } namespace NServiceBus.DataBus.AzureBlobStorage { - [System.Obsolete(@"NServiceBus.DataBus.AzureBlobStorage.IProvideBlobServiceClient has been replaced by NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient. Use `NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient` instead. Will be treated as an error from version 7.0.0. Will be removed in version 8.0.0.", false)] + [System.Obsolete(@"NServiceBus.DataBus.AzureBlobStorage.IProvideBlobServiceClient has been replaced by NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient. Use `NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient` instead. Will be removed in version 8.0.0.", true)] public interface IProvideBlobServiceClient : NServiceBus.ClaimCheck.AzureBlobStorage.IProvideBlobServiceClient { } } \ No newline at end of file diff --git a/src/Tests/When_using_AzureDataBusGuard.cs b/src/Tests/When_using_AzureDataBusGuard.cs deleted file mode 100644 index a13d52d2..00000000 --- a/src/Tests/When_using_AzureDataBusGuard.cs +++ /dev/null @@ -1,75 +0,0 @@ -namespace NServiceBus.Azure.Tests.DataBus -{ - using System; - using NUnit.Framework; - using Settings; - using NServiceBus.DataBus; - - [TestFixture] - public class When_using_AzureDataBusGuard - { - [Test] - public void Should_not_allow_negative_maximum_retries() - { - Assert.Throws(() => config.MaxRetries(-1)); - } - - [Test] - public void Should_not_allow_negative_backoff_interval() - { - Assert.Throws(() => config.BackOffInterval(-1)); - } - - [Test] - public void Should_not_allow_invalid_number_of_threads() - { - Assert.Throws(() => config.NumberOfIOThreads(0)); - } - - [Test] - public void Should_not_allow_empty_connection_string() - { - Assert.Throws(() => config.ConnectionString(string.Empty)); - } - - [Test] - public void Should_not_allow_null_connection_string() - { - Assert.Throws(() => config.ConnectionString(null)); - } - - [TestCase("con")] - [TestCase("co-ntainer")] - [TestCase("container-name-with-0")] - [TestCase("6-3-letters-long-container-name-aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")] - [TestCase("$root")] - public void Should_allow_valid_container_name(string containerName) - { - config.Container(containerName); - } - - [TestCase("")] - [TestCase("-conta")] - [TestCase("co--ntainer")] - [TestCase("Container")] - [TestCase("container-")] - [TestCase("co$ntainer")] - [TestCase("over-63-letters-long-container-name-AAAAAAAAAAAAAAAAAAAAAAAAAAAB")] - [TestCase(null)] - public void Should_not_allow_invalid_container_name(string containerName) - { - Assert.Throws(() => config.Container(containerName)); - } - - [TestCase(null)] - [TestCase(" ")] - public void Should_not_allow_null_or_whitespace_base_path(string basePath) - { - Assert.Throws(() => config.BasePath(basePath)); - } - -#pragma warning disable CS0618 // Type or member is obsolete - DataBusExtensions config = new DataBusExtensions(new SettingsHolder()); -#pragma warning restore CS0618 // Type or member is obsolete - } -} \ No newline at end of file