From cbedfe5d5d203f4e2e97a8935dc6e8fcd3b55a9f Mon Sep 17 00:00:00 2001 From: "naiyuantian@microsoft.com" Date: Tue, 12 Nov 2024 17:50:02 -0800 Subject: [PATCH] update CustomTestStorageAccountProvider to use IStorageServiceClientProviderFactory --- .../Common/CustomTestStorageAccountProvider.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/test/Common/CustomTestStorageAccountProvider.cs b/test/Common/CustomTestStorageAccountProvider.cs index 41337555a..6aa62e36e 100644 --- a/test/Common/CustomTestStorageAccountProvider.cs +++ b/test/Common/CustomTestStorageAccountProvider.cs @@ -2,12 +2,15 @@ // Licensed under the MIT License. See LICENSE in the project root for license information. using System; +using Azure.Data.Tables; +using Azure.Storage.Blobs; +using Azure.Storage.Queues; using DurableTask.AzureStorage; -using Microsoft.WindowsAzure.Storage; +using Microsoft.Azure.WebJobs.Extensions.DurableTask.Storage; namespace Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests { - internal class CustomTestStorageAccountProvider : IStorageAccountProvider + internal class CustomTestStorageAccountProvider : IStorageServiceClientProviderFactory { private readonly string customConnectionString; private readonly string customConnectionName; @@ -18,11 +21,14 @@ public CustomTestStorageAccountProvider(string connectionName) this.customConnectionString = $"DefaultEndpointsProtocol=https;AccountName=test;AccountKey={GenerateRandomKey()};EndpointSuffix=core.windows.net"; } - public CloudStorageAccount GetCloudStorageAccount(string name) => - CloudStorageAccount.Parse(name != this.customConnectionName ? TestHelpers.GetStorageConnectionString() : this.customConnectionString); + public IStorageServiceClientProvider GetBlobClientProvider(string connectionName) => + StorageServiceClientProvider.ForBlob(TestHelpers.GetStorageConnectionString()); - public StorageAccountDetails GetStorageAccountDetails(string name) => - new StorageAccountDetails { ConnectionString = name != this.customConnectionName ? TestHelpers.GetStorageConnectionString() : this.customConnectionString }; + public IStorageServiceClientProvider GetQueueClientProvider(string connectionName) => + StorageServiceClientProvider.ForQueue(TestHelpers.GetStorageConnectionString()); + + public IStorageServiceClientProvider GetTableClientProvider(string connectionName) => + StorageServiceClientProvider.ForTable(TestHelpers.GetStorageConnectionString()); private static string GenerateRandomKey() {