From 13a80e0fb2aa964089bfd0b583dca600e5afdd1a Mon Sep 17 00:00:00 2001 From: Jocelyn <41338290+jaschrep-msft@users.noreply.github.com> Date: Tue, 18 Jul 2023 13:57:42 -0400 Subject: [PATCH] `DataMovementTestBase` pull out shared functionality (#37493) * move job part plan file utility out of testbase * file util * remove empty setup method * pull out and rename enum * remove dmlibtestbase from rehydrate tests * remove recordings --- .../tests/Shared/DataProvider.cs | 38 +++ .../tests/Shared/FileUtil.cs | 62 +++++ .../tests/Shared/StorageTestBase.cs | 19 +- ...re.Storage.DataMovement.Blobs.Tests.csproj | 3 + .../tests/RehydrateBlobResourceTests.cs | 29 +- ...ateAppendBlob(False,ProviderInstance).json | 4 - ...pendBlob(False,ProviderInstance)Async.json | 4 - ...rateAppendBlob(False,PublicStaticApi).json | 4 - ...ppendBlob(False,PublicStaticApi)Async.json | 4 - ...teAppendBlob(False,ResourceStaticApi).json | 4 - ...endBlob(False,ResourceStaticApi)Async.json | 4 - ...rateAppendBlob(True,ProviderInstance).json | 4 - ...ppendBlob(True,ProviderInstance)Async.json | 4 - ...drateAppendBlob(True,PublicStaticApi).json | 4 - ...AppendBlob(True,PublicStaticApi)Async.json | 4 - ...ateAppendBlob(True,ResourceStaticApi).json | 4 - ...pendBlob(True,ResourceStaticApi)Async.json | 4 - ...BlobContainer(False,ProviderInstance).json | 6 - ...ontainer(False,ProviderInstance)Async.json | 6 - ...eBlobContainer(False,PublicStaticApi).json | 6 - ...Container(False,PublicStaticApi)Async.json | 6 - ...lobContainer(False,ResourceStaticApi).json | 6 - ...ntainer(False,ResourceStaticApi)Async.json | 6 - ...eBlobContainer(True,ProviderInstance).json | 6 - ...Container(True,ProviderInstance)Async.json | 6 - ...teBlobContainer(True,PublicStaticApi).json | 6 - ...bContainer(True,PublicStaticApi)Async.json | 6 - ...BlobContainer(True,ResourceStaticApi).json | 6 - ...ontainer(True,ResourceStaticApi)Async.json | 6 - ...rateBlockBlob(False,ProviderInstance).json | 4 - ...lockBlob(False,ProviderInstance)Async.json | 4 - ...drateBlockBlob(False,PublicStaticApi).json | 4 - ...BlockBlob(False,PublicStaticApi)Async.json | 4 - ...ateBlockBlob(False,ResourceStaticApi).json | 4 - ...ockBlob(False,ResourceStaticApi)Async.json | 4 - ...drateBlockBlob(True,ProviderInstance).json | 4 - ...BlockBlob(True,ProviderInstance)Async.json | 4 - ...ydrateBlockBlob(True,PublicStaticApi).json | 4 - ...eBlockBlob(True,PublicStaticApi)Async.json | 4 - ...rateBlockBlob(True,ResourceStaticApi).json | 4 - ...lockBlob(True,ResourceStaticApi)Async.json | 4 - ...dratePageBlob(False,ProviderInstance).json | 4 - ...PageBlob(False,ProviderInstance)Async.json | 4 - ...ydratePageBlob(False,PublicStaticApi).json | 4 - ...ePageBlob(False,PublicStaticApi)Async.json | 4 - ...ratePageBlob(False,ResourceStaticApi).json | 4 - ...ageBlob(False,ResourceStaticApi)Async.json | 4 - ...ydratePageBlob(True,ProviderInstance).json | 4 - ...ePageBlob(True,ProviderInstance)Async.json | 4 - ...hydratePageBlob(True,PublicStaticApi).json | 4 - ...tePageBlob(True,PublicStaticApi)Async.json | 4 - ...dratePageBlob(True,ResourceStaticApi).json | 4 - ...PageBlob(True,ResourceStaticApi)Async.json | 4 - .../tests/JobPartPlanFileTests.cs | 2 +- .../tests/JobPartPlanHeaderTests.cs | 260 +++++++++--------- .../tests/LocalTransferCheckpointerTests.cs | 75 ++--- .../tests/PauseResumeTransferTests.cs | 106 +++---- .../tests/ProgressHandlerTests.cs | 12 +- .../tests/RehydrateStorageResourceTests.cs | 3 +- .../tests/Shared/CheckpointerTesting.cs | 191 +++++++++++++ .../tests/Shared/DataMovementTestBase.cs | 247 ----------------- .../tests/Shared/TransferDirection.cs | 12 + .../tests/Shared/TransferUtility.cs | 12 + .../StartTransferDownloadDirectoryTests.cs | 5 +- 64 files changed, 569 insertions(+), 723 deletions(-) create mode 100644 sdk/storage/Azure.Storage.Common/tests/Shared/DataProvider.cs create mode 100644 sdk/storage/Azure.Storage.Common/tests/Shared/FileUtil.cs delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ProviderInstance).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ProviderInstance)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,PublicStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,PublicStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ResourceStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ResourceStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ProviderInstance).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ProviderInstance)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,PublicStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,PublicStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ResourceStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ResourceStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ProviderInstance).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ProviderInstance)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,PublicStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,PublicStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ResourceStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ResourceStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ProviderInstance).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ProviderInstance)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,PublicStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,PublicStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ResourceStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ResourceStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ProviderInstance).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ProviderInstance)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,PublicStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,PublicStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ResourceStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ResourceStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ProviderInstance).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ProviderInstance)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,PublicStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,PublicStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ResourceStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ResourceStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ProviderInstance).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ProviderInstance)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,PublicStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,PublicStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ResourceStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ResourceStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ProviderInstance).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ProviderInstance)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,PublicStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,PublicStaticApi)Async.json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ResourceStaticApi).json delete mode 100644 sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ResourceStaticApi)Async.json create mode 100644 sdk/storage/Azure.Storage.DataMovement/tests/Shared/CheckpointerTesting.cs create mode 100644 sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferDirection.cs create mode 100644 sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferUtility.cs diff --git a/sdk/storage/Azure.Storage.Common/tests/Shared/DataProvider.cs b/sdk/storage/Azure.Storage.Common/tests/Shared/DataProvider.cs new file mode 100644 index 0000000000000..9d0d03b2fbb4e --- /dev/null +++ b/sdk/storage/Azure.Storage.Common/tests/Shared/DataProvider.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; + +namespace Azure.Storage.Test +{ + public static class DataProvider + { + public static Dictionary BuildTags() + => new() + { + { "tagKey0", "tagValue0" }, + { "tagKey1", "tagValue1" } + }; + + public static Dictionary BuildMetadata() + => new(StringComparer.OrdinalIgnoreCase) + { + { "foo", "bar" }, + { "meta", "data" }, + { "Capital", "letter" }, + { "UPPER", "case" } + }; + + public static string GetNewString(int length = 20, Random random = null) + { + random ??= new Random(); + var buffer = new char[length]; + for (var i = 0; i < length; i++) + { + buffer[i] = (char)('a' + random.Next(0, 25)); + } + return new string(buffer); + } + } +} diff --git a/sdk/storage/Azure.Storage.Common/tests/Shared/FileUtil.cs b/sdk/storage/Azure.Storage.Common/tests/Shared/FileUtil.cs new file mode 100644 index 0000000000000..af400e9b75c79 --- /dev/null +++ b/sdk/storage/Azure.Storage.Common/tests/Shared/FileUtil.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; +using System.IO; + +namespace Azure.Storage.Test.Shared +{ + internal static class FileUtil + { + public static List ListFileNamesRecursive(string directory) + { + List files = new List(); + + // Create a queue of folders to enumerate files from, starting with provided path + Queue folders = new(); + folders.Enqueue(directory); + + while (folders.Count > 0) + { + // Grab a folder from the queue + string dir = folders.Dequeue(); + + // Try to enumerate and queue all subdirectories of the current folder + try + { + foreach (string subdir in Directory.EnumerateDirectories(dir)) + { + folders.Enqueue(subdir); + } + } + catch + { + // If we lack permissions to enumerate, throw if the caller specifies + // that we shouldn't continue on error. + // + // TODO: Logging for missing permissions to enumerate folder + // + // Afterthought: once logging is implemented, we can just log any problems + // (whether with given dir or subdir), and skip if told to/throw if not. No need for + // the `dir == _basePath` check (which right now is just a filler signal + // for something going wrong, as opposed to an "success" with an empty list). + if (dir == directory) + { + throw; + } + + // Otherwise, just log the failed subdirectory and continue to list as many + // files as accessible. + continue; + } + + // Send all files in the directory to the scan results + foreach (string file in Directory.EnumerateFiles(dir)) + { + files.Add(file); + } + } + return files; + } + } +} diff --git a/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs b/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs index dc62c1c71fe10..15f71f1b63c02 100644 --- a/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs +++ b/sdk/storage/Azure.Storage.Common/tests/Shared/StorageTestBase.cs @@ -107,26 +107,11 @@ public virtual void ClearCaches() => public byte[] GetRandomBuffer(long size) => TestHelper.GetRandomBuffer(size, Recording.Random); - public string GetNewString(int length = 20) - { - var buffer = new char[length]; - for (var i = 0; i < length; i++) - { - buffer[i] = (char)('a' + Recording.Random.Next(0, 25)); - } - return new string(buffer); - } + public string GetNewString(int length = 20) => DataProvider.GetNewString(length, Recording.Random); public string GetNewMetadataName() => $"test_metadata_{Recording.Random.NewGuid().ToString().Replace("-", "_")}"; - public IDictionary BuildMetadata() - => new Dictionary(StringComparer.OrdinalIgnoreCase) - { - { "foo", "bar" }, - { "meta", "data" }, - { "Capital", "letter" }, - { "UPPER", "case" } - }; + public IDictionary BuildMetadata() => DataProvider.BuildMetadata(); public IPAddress GetIPAddress() { diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/Azure.Storage.DataMovement.Blobs.Tests.csproj b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/Azure.Storage.DataMovement.Blobs.Tests.csproj index 21f54169b1b00..9ea474f9c840d 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/Azure.Storage.DataMovement.Blobs.Tests.csproj +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/Azure.Storage.DataMovement.Blobs.Tests.csproj @@ -10,8 +10,11 @@ + + + diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/RehydrateBlobResourceTests.cs b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/RehydrateBlobResourceTests.cs index 65b0f0ad0fcdd..b854b95082340 100644 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/RehydrateBlobResourceTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/RehydrateBlobResourceTests.cs @@ -10,12 +10,14 @@ using Azure.Storage.DataMovement.Blobs; using Azure.Storage.DataMovement.Models; using Azure.Storage.DataMovement.Models.JobPlan; +using Azure.Storage.Test; using Moq; using NUnit.Framework; +using static Azure.Storage.DataMovement.Tests.TransferUtility; namespace Azure.Storage.DataMovement.Tests { - public class RehydrateBlobResourceTests : DataMovementTestBase + public class RehydrateBlobResourceTests { public enum RehydrateApi { @@ -36,8 +38,7 @@ public enum RehydrateApi } public static IEnumerable GetRehydrateApis() => Enum.GetValues(typeof(RehydrateApi)).Cast(); - public RehydrateBlobResourceTests(bool async) - : base(async, null /* RecordedTestMode.Record /* to re-record */) + public RehydrateBlobResourceTests() { } private enum StorageResourceType @@ -132,7 +133,7 @@ private async Task AddJobPartToCheckpointer( for (int currentPart = 0; currentPart < partCount; currentPart++) { - header ??= CreateDefaultJobPartHeader( + header ??= CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: currentPart, sourcePath: sourcePaths[currentPart], @@ -236,10 +237,10 @@ public async Task RehydrateBlockBlob_Options( ToResourceId(destinationType), isContainer: false).Object; - IDictionary metadata = BuildMetadata(); - IDictionary blobTags = BuildTags(); + IDictionary metadata = DataProvider.BuildMetadata(); + IDictionary blobTags = DataProvider.BuildTags(); - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 0, sourcePath: sourcePath, @@ -343,10 +344,10 @@ public async Task RehydratePageBlob_Options( ToResourceId(destinationType), isContainer: false).Object; - IDictionary metadata = BuildMetadata(); - IDictionary blobTags = BuildTags(); + IDictionary metadata = DataProvider.BuildMetadata(); + IDictionary blobTags = DataProvider.BuildTags(); - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 0, sourcePath: sourcePath, @@ -450,10 +451,10 @@ public async Task RehydrateAppendBlob_Options( ToResourceId(destinationType), isContainer: false).Object; - IDictionary metadata = BuildMetadata(); - IDictionary blobTags = BuildTags(); + IDictionary metadata = DataProvider.BuildMetadata(); + IDictionary blobTags = DataProvider.BuildTags(); - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 0, sourcePath: sourcePath, @@ -502,7 +503,7 @@ public async Task RehydrateBlobContainer( int jobPartCount = 10; for (int i = 0; i < jobPartCount; i++) { - string childPath = GetNewString(5); + string childPath = DataProvider.GetNewString(5); sourcePaths.Add(string.Join("/", sourceParentPath, childPath)); destinationPaths.Add(string.Join("/", destinationParentPath, childPath)); } diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ProviderInstance).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ProviderInstance).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ProviderInstance).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ProviderInstance)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ProviderInstance)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ProviderInstance)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,PublicStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,PublicStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,PublicStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,PublicStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,PublicStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,PublicStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ResourceStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ResourceStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ResourceStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ResourceStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ResourceStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(False,ResourceStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ProviderInstance).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ProviderInstance).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ProviderInstance).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ProviderInstance)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ProviderInstance)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ProviderInstance)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,PublicStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,PublicStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,PublicStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,PublicStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,PublicStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,PublicStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ResourceStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ResourceStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ResourceStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ResourceStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ResourceStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateAppendBlob(True,ResourceStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ProviderInstance).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ProviderInstance).json deleted file mode 100644 index 4505d7c762048..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ProviderInstance).json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "420323756" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ProviderInstance)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ProviderInstance)Async.json deleted file mode 100644 index 22ad8ce508d38..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ProviderInstance)Async.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "925785122" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,PublicStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,PublicStaticApi).json deleted file mode 100644 index 72ad7852c347a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,PublicStaticApi).json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "519514965" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,PublicStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,PublicStaticApi)Async.json deleted file mode 100644 index c1e945f19c876..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,PublicStaticApi)Async.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "2047135555" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ResourceStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ResourceStaticApi).json deleted file mode 100644 index 6412d83853240..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ResourceStaticApi).json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "440705525" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ResourceStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ResourceStaticApi)Async.json deleted file mode 100644 index 26422f3b69746..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(False,ResourceStaticApi)Async.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "1779602989" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ProviderInstance).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ProviderInstance).json deleted file mode 100644 index 9368c22457f68..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ProviderInstance).json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "1521620432" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ProviderInstance)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ProviderInstance)Async.json deleted file mode 100644 index 9daaf1f0ea2c5..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ProviderInstance)Async.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "1706713860" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,PublicStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,PublicStaticApi).json deleted file mode 100644 index ab0edf947265b..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,PublicStaticApi).json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "1077268215" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,PublicStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,PublicStaticApi)Async.json deleted file mode 100644 index 71cd97fa84347..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,PublicStaticApi)Async.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "1942784408" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ResourceStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ResourceStaticApi).json deleted file mode 100644 index 43e3dee14f5bc..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ResourceStaticApi).json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "923485033" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ResourceStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ResourceStaticApi)Async.json deleted file mode 100644 index e159496e3afa1..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlobContainer(True,ResourceStaticApi)Async.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "Entries": [], - "Variables": { - "RandomSeed": "284760760" - } -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ProviderInstance).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ProviderInstance).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ProviderInstance).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ProviderInstance)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ProviderInstance)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ProviderInstance)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,PublicStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,PublicStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,PublicStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,PublicStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,PublicStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,PublicStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ResourceStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ResourceStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ResourceStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ResourceStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ResourceStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(False,ResourceStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ProviderInstance).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ProviderInstance).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ProviderInstance).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ProviderInstance)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ProviderInstance)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ProviderInstance)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,PublicStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,PublicStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,PublicStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,PublicStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,PublicStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,PublicStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ResourceStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ResourceStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ResourceStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ResourceStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ResourceStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydrateBlockBlob(True,ResourceStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ProviderInstance).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ProviderInstance).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ProviderInstance).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ProviderInstance)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ProviderInstance)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ProviderInstance)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,PublicStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,PublicStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,PublicStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,PublicStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,PublicStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,PublicStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ResourceStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ResourceStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ResourceStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ResourceStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ResourceStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(False,ResourceStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ProviderInstance).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ProviderInstance).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ProviderInstance).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ProviderInstance)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ProviderInstance)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ProviderInstance)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,PublicStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,PublicStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,PublicStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,PublicStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,PublicStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,PublicStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ResourceStaticApi).json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ResourceStaticApi).json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ResourceStaticApi).json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ResourceStaticApi)Async.json b/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ResourceStaticApi)Async.json deleted file mode 100644 index f721723386d8a..0000000000000 --- a/sdk/storage/Azure.Storage.DataMovement.Blobs/tests/SessionRecords/RehydrateBlobResourceTests/RehydratePageBlob(True,ResourceStaticApi)Async.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "Entries": [], - "Variables": {} -} diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanFileTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanFileTests.cs index a6a12afc81b69..8f6ba6ab7ce30 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanFileTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanFileTests.cs @@ -4,8 +4,8 @@ using System.IO; using System.Threading.Tasks; using NUnit.Framework; -using Azure.Core.TestFramework; using Azure.Storage.DataMovement.Models.JobPlan; +using static Azure.Storage.DataMovement.Tests.TransferUtility; namespace Azure.Storage.DataMovement.Tests { diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanHeaderTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanHeaderTests.cs index 15b140bff8b49..b5079101b4eb3 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanHeaderTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/JobPartPlanHeaderTests.cs @@ -6,7 +6,9 @@ using System.IO; using System.Threading.Tasks; using Azure.Storage.DataMovement.Models.JobPlan; +using Azure.Storage.Test; using NUnit.Framework; +using static Azure.Storage.DataMovement.Tests.CheckpointerTesting; namespace Azure.Storage.DataMovement.Tests { @@ -30,50 +32,50 @@ public JobPartPlanHeaderTests(bool async) : base(async, default) [Test] public void Ctor() { - IDictionary metadata = BuildMetadata(); - IDictionary blobTags = BuildTags(); + IDictionary metadata = DataProvider.BuildMetadata(); + IDictionary blobTags = DataProvider.BuildTags(); JobPartPlanHeader header = CreateDefaultJobPartHeader( metadata: metadata, blobTags: blobTags); Assert.AreEqual(header.Version, DataMovementConstants.PlanFile.SchemaVersion); - Assert.AreEqual(header.StartTime, _testStartTime); - Assert.AreEqual(header.TransferId, _testTransferId); - Assert.AreEqual(header.PartNumber, _testPartNumber); - Assert.AreEqual(header.SourceResourceId, _testSourceResourceId); - Assert.AreEqual(header.SourcePath, _testSourcePath); - Assert.AreEqual(header.SourcePathLength, _testSourcePath.Length); - Assert.AreEqual(header.SourceExtraQuery, _testSourceQuery); - Assert.AreEqual(header.SourceExtraQueryLength, _testSourceQuery.Length); - Assert.AreEqual(header.DestinationResourceId, _testDestinationResourceId); - Assert.AreEqual(header.DestinationPath, _testDestinationPath); - Assert.AreEqual(header.DestinationPathLength, _testDestinationPath.Length); - Assert.AreEqual(header.DestinationExtraQuery, _testDestinationQuery); - Assert.AreEqual(header.DestinationExtraQueryLength, _testDestinationQuery.Length); + Assert.AreEqual(header.StartTime, DefaultStartTime); + Assert.AreEqual(header.TransferId, DefaultTransferId); + Assert.AreEqual(header.PartNumber, DefaultPartNumber); + Assert.AreEqual(header.SourceResourceId, DefaultSourceResourceId); + Assert.AreEqual(header.SourcePath, DefaultSourcePath); + Assert.AreEqual(header.SourcePathLength, DefaultSourcePath.Length); + Assert.AreEqual(header.SourceExtraQuery, DefaultSourceQuery); + Assert.AreEqual(header.SourceExtraQueryLength, DefaultSourceQuery.Length); + Assert.AreEqual(header.DestinationResourceId, DefaultDestinationResourceId); + Assert.AreEqual(header.DestinationPath, DefaultDestinationPath); + Assert.AreEqual(header.DestinationPathLength, DefaultDestinationPath.Length); + Assert.AreEqual(header.DestinationExtraQuery, DefaultDestinationQuery); + Assert.AreEqual(header.DestinationExtraQueryLength, DefaultDestinationQuery.Length); Assert.IsFalse(header.IsFinalPart); Assert.IsFalse(header.ForceWrite); Assert.IsFalse(header.ForceIfReadOnly); Assert.IsFalse(header.AutoDecompress); - Assert.AreEqual(header.Priority, _testPriority); - Assert.AreEqual(header.TTLAfterCompletion, _testTtlAfterCompletion); - Assert.AreEqual(header.JobPlanOperation, _testJobPlanOperation); - Assert.AreEqual(header.FolderPropertyMode, _testFolderPropertiesMode); - Assert.AreEqual(header.NumberChunks, _testNumberChunks); - Assert.AreEqual(header.DstBlobData.BlobType, _testBlobType); + Assert.AreEqual(header.Priority, DefaultPriority); + Assert.AreEqual(header.TTLAfterCompletion, DefaultTtlAfterCompletion); + Assert.AreEqual(header.JobPlanOperation, DefaultJobPlanOperation); + Assert.AreEqual(header.FolderPropertyMode, DefaultFolderPropertiesMode); + Assert.AreEqual(header.NumberChunks, DefaultNumberChunks); + Assert.AreEqual(header.DstBlobData.BlobType, DefaultBlobType); Assert.IsFalse(header.DstBlobData.NoGuessMimeType); - Assert.AreEqual(header.DstBlobData.ContentType, _testContentType); - Assert.AreEqual(header.DstBlobData.ContentTypeLength, _testContentType.Length); - Assert.AreEqual(header.DstBlobData.ContentEncoding, _testContentEncoding); - Assert.AreEqual(header.DstBlobData.ContentEncodingLength, _testContentEncoding.Length); - Assert.AreEqual(header.DstBlobData.ContentLanguage, _testContentLanguage); - Assert.AreEqual(header.DstBlobData.ContentLanguageLength, _testContentLanguage.Length); - Assert.AreEqual(header.DstBlobData.ContentDisposition, _testContentDisposition); - Assert.AreEqual(header.DstBlobData.ContentDispositionLength, _testContentDisposition.Length); - Assert.AreEqual(header.DstBlobData.CacheControl, _testCacheControl); - Assert.AreEqual(header.DstBlobData.CacheControlLength, _testCacheControl.Length); - Assert.AreEqual(header.DstBlobData.BlockBlobTier, _testBlockBlobTier); - Assert.AreEqual(header.DstBlobData.PageBlobTier, _testPageBlobTier); + Assert.AreEqual(header.DstBlobData.ContentType, DefaultContentType); + Assert.AreEqual(header.DstBlobData.ContentTypeLength, DefaultContentType.Length); + Assert.AreEqual(header.DstBlobData.ContentEncoding, DefaultContentEncoding); + Assert.AreEqual(header.DstBlobData.ContentEncodingLength, DefaultContentEncoding.Length); + Assert.AreEqual(header.DstBlobData.ContentLanguage, DefaultContentLanguage); + Assert.AreEqual(header.DstBlobData.ContentLanguageLength, DefaultContentLanguage.Length); + Assert.AreEqual(header.DstBlobData.ContentDisposition, DefaultContentDisposition); + Assert.AreEqual(header.DstBlobData.ContentDispositionLength, DefaultContentDisposition.Length); + Assert.AreEqual(header.DstBlobData.CacheControl, DefaultCacheControl); + Assert.AreEqual(header.DstBlobData.CacheControlLength, DefaultCacheControl.Length); + Assert.AreEqual(header.DstBlobData.BlockBlobTier, DefaultBlockBlobTier); + Assert.AreEqual(header.DstBlobData.PageBlobTier, DefaultPageBlobTier); Assert.IsFalse(header.DstBlobData.PutMd5); string metadataStr = DictionaryToString(metadata); Assert.AreEqual(header.DstBlobData.Metadata, metadataStr); @@ -82,30 +84,30 @@ public void Ctor() Assert.AreEqual(header.DstBlobData.BlobTags, blobTagsStr); Assert.AreEqual(header.DstBlobData.BlobTagsLength, blobTagsStr.Length); Assert.IsFalse(header.DstBlobData.IsSourceEncrypted); - Assert.AreEqual(header.DstBlobData.CpkScopeInfo, _testCpkScopeInfo); - Assert.AreEqual(header.DstBlobData.CpkScopeInfoLength, _testCpkScopeInfo.Length); - Assert.AreEqual(header.DstBlobData.BlockSize, _testBlockSize); + Assert.AreEqual(header.DstBlobData.CpkScopeInfo, DefaultCpkScopeInfo); + Assert.AreEqual(header.DstBlobData.CpkScopeInfoLength, DefaultCpkScopeInfo.Length); + Assert.AreEqual(header.DstBlobData.BlockSize, DefaultBlockSize); Assert.IsFalse(header.DstLocalData.PreserveLastModifiedTime); - Assert.AreEqual(header.DstLocalData.ChecksumVerificationOption, _testChecksumVerificationOption); + Assert.AreEqual(header.DstLocalData.ChecksumVerificationOption, DefaultChecksumVerificationOption); Assert.IsFalse(header.PreserveSMBPermissions); Assert.IsFalse(header.PreserveSMBInfo); Assert.IsFalse(header.S2SGetPropertiesInBackend); Assert.IsFalse(header.S2SSourceChangeValidation); Assert.IsFalse(header.DestLengthValidation); - Assert.AreEqual(header.S2SInvalidMetadataHandleOption, _testS2sInvalidMetadataHandleOption); - Assert.AreEqual(header.DeleteSnapshotsOption, _testDeleteSnapshotsOption); - Assert.AreEqual(header.PermanentDeleteOption, _testPermanentDeleteOption); - Assert.AreEqual(header.RehydratePriorityType, _testRehydratePriorityType); - Assert.AreEqual(header.AtomicJobStatus, _testJobStatus); - Assert.AreEqual(header.AtomicPartStatus, _testPartStatus); + Assert.AreEqual(header.S2SInvalidMetadataHandleOption, DefaultS2sInvalidMetadataHandleOption); + Assert.AreEqual(header.DeleteSnapshotsOption, DefaultDeleteSnapshotsOption); + Assert.AreEqual(header.PermanentDeleteOption, DefaultPermanentDeleteOption); + Assert.AreEqual(header.RehydratePriorityType, DefaultRehydratePriorityType); + Assert.AreEqual(header.AtomicJobStatus, DefaultJobStatus); + Assert.AreEqual(header.AtomicPartStatus, DefaultPartStatus); } [Test] public async Task Serialize() { // Arrange - IDictionary metadata = BuildMetadata(); - IDictionary blobTags = BuildTags(); + IDictionary metadata = DataProvider.BuildMetadata(); + IDictionary blobTags = DataProvider.BuildTags(); JobPartPlanHeader header = CreateDefaultJobPartHeader( metadata: metadata, @@ -127,77 +129,77 @@ public async Task Serialize() int startTimeSize = DataMovementConstants.PlanFile.LongSizeInBytes; byte[] startTimeBuffer = new byte[startTimeSize]; await stream.ReadAsync(startTimeBuffer, 0, startTimeSize); - Assert.AreEqual(_testStartTime.Ticks.ToByteArray(startTimeSize), startTimeBuffer); + Assert.AreEqual(DefaultStartTime.Ticks.ToByteArray(startTimeSize), startTimeBuffer); int transferIdSize = DataMovementConstants.PlanFile.TransferIdStrNumBytes; byte[] transferIdBuffer = new byte[transferIdSize]; await stream.ReadAsync(transferIdBuffer, 0, transferIdSize); - Assert.AreEqual(_testTransferId.ToByteArray(transferIdSize), transferIdBuffer); + Assert.AreEqual(DefaultTransferId.ToByteArray(transferIdSize), transferIdBuffer); int partNumberSize = DataMovementConstants.PlanFile.LongSizeInBytes; byte[] partNumberBuffer = new byte[partNumberSize]; await stream.ReadAsync(partNumberBuffer, 0, partNumberSize); - Assert.AreEqual(_testPartNumber.ToByteArray(partNumberSize), partNumberBuffer); + Assert.AreEqual(DefaultPartNumber.ToByteArray(partNumberSize), partNumberBuffer); int sourceResourceIdLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] sourceResourceIdLengthBuffer = new byte[sourceResourceIdLengthSize]; await stream.ReadAsync(sourceResourceIdLengthBuffer, 0, sourceResourceIdLengthSize); - Assert.AreEqual(((ushort)_testSourceResourceId.Length).ToByteArray(sourceResourceIdLengthSize), sourceResourceIdLengthBuffer); + Assert.AreEqual(((ushort)DefaultSourceResourceId.Length).ToByteArray(sourceResourceIdLengthSize), sourceResourceIdLengthBuffer); int sourceResourceIdSize = DataMovementConstants.PlanFile.ResourceIdNumBytes; byte[] sourceResourceIdBuffer = new byte[sourceResourceIdSize]; await stream.ReadAsync(sourceResourceIdBuffer, 0, sourceResourceIdSize); - Assert.AreEqual(_testSourceResourceId.ToByteArray(sourceResourceIdSize), sourceResourceIdBuffer); + Assert.AreEqual(DefaultSourceResourceId.ToByteArray(sourceResourceIdSize), sourceResourceIdBuffer); int sourcePathLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] sourcePathLengthBuffer = new byte[sourcePathLengthSize]; await stream.ReadAsync(sourcePathLengthBuffer, 0, sourcePathLengthSize); - Assert.AreEqual(((ushort)_testSourcePath.Length).ToByteArray(sourcePathLengthSize), sourcePathLengthBuffer); + Assert.AreEqual(((ushort)DefaultSourcePath.Length).ToByteArray(sourcePathLengthSize), sourcePathLengthBuffer); int sourcePathSize = DataMovementConstants.PlanFile.PathStrNumBytes; byte[] sourcePathBuffer = new byte[sourcePathSize]; await stream.ReadAsync(sourcePathBuffer, 0, sourcePathSize); - Assert.AreEqual(_testSourcePath.ToByteArray(sourcePathSize), sourcePathBuffer); + Assert.AreEqual(DefaultSourcePath.ToByteArray(sourcePathSize), sourcePathBuffer); int sourceExtraQueryLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] sourceExtraQueryLengthBuffer = new byte[sourceExtraQueryLengthSize]; await stream.ReadAsync(sourceExtraQueryLengthBuffer, 0, sourceExtraQueryLengthSize); - Assert.AreEqual(((ushort)_testSourceQuery.Length).ToByteArray(sourceExtraQueryLengthSize), sourceExtraQueryLengthBuffer); + Assert.AreEqual(((ushort)DefaultSourceQuery.Length).ToByteArray(sourceExtraQueryLengthSize), sourceExtraQueryLengthBuffer); int sourceExtraQuerySize = DataMovementConstants.PlanFile.ExtraQueryNumBytes; byte[] sourceExtraQueryBuffer = new byte[sourceExtraQuerySize]; await stream.ReadAsync(sourceExtraQueryBuffer, 0, sourceExtraQuerySize); - Assert.AreEqual(_testSourceQuery.ToByteArray(sourceExtraQuerySize), sourceExtraQueryBuffer); + Assert.AreEqual(DefaultSourceQuery.ToByteArray(sourceExtraQuerySize), sourceExtraQueryBuffer); int destinationResourceIdLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] destinationResourceIdLengthBuffer = new byte[destinationResourceIdLengthSize]; await stream.ReadAsync(destinationResourceIdLengthBuffer, 0, destinationResourceIdLengthSize); - Assert.AreEqual(((ushort)_testDestinationResourceId.Length).ToByteArray(destinationResourceIdLengthSize), destinationResourceIdLengthBuffer); + Assert.AreEqual(((ushort)DefaultDestinationResourceId.Length).ToByteArray(destinationResourceIdLengthSize), destinationResourceIdLengthBuffer); int destinationResourceIdSize = DataMovementConstants.PlanFile.ResourceIdNumBytes; byte[] destinationResourceIdBuffer = new byte[destinationResourceIdSize]; await stream.ReadAsync(destinationResourceIdBuffer, 0, destinationResourceIdSize); - Assert.AreEqual(_testDestinationResourceId.ToByteArray(destinationResourceIdSize), destinationResourceIdBuffer); + Assert.AreEqual(DefaultDestinationResourceId.ToByteArray(destinationResourceIdSize), destinationResourceIdBuffer); int destinationPathLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] destinationPathLengthBuffer = new byte[destinationPathLengthSize]; await stream.ReadAsync(destinationPathLengthBuffer, 0, destinationPathLengthSize); - Assert.AreEqual(((ushort)_testDestinationPath.Length).ToByteArray(destinationPathLengthSize), destinationPathLengthBuffer); + Assert.AreEqual(((ushort)DefaultDestinationPath.Length).ToByteArray(destinationPathLengthSize), destinationPathLengthBuffer); int destinationPathSize = DataMovementConstants.PlanFile.PathStrNumBytes; byte[] destinationPathBuffer = new byte[destinationPathSize]; await stream.ReadAsync(destinationPathBuffer, 0, destinationPathSize); - Assert.AreEqual(_testDestinationPath.ToByteArray(destinationPathSize), destinationPathBuffer); + Assert.AreEqual(DefaultDestinationPath.ToByteArray(destinationPathSize), destinationPathBuffer); int destinationExtraQueryLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] destinationExtraQueryLengthBuffer = new byte[destinationExtraQueryLengthSize]; await stream.ReadAsync(destinationExtraQueryLengthBuffer, 0, destinationExtraQueryLengthSize); - Assert.AreEqual(((ushort)_testDestinationQuery.Length).ToByteArray(destinationExtraQueryLengthSize), destinationExtraQueryLengthBuffer); + Assert.AreEqual(((ushort)DefaultDestinationQuery.Length).ToByteArray(destinationExtraQueryLengthSize), destinationExtraQueryLengthBuffer); int destinationExtraQuerySize = DataMovementConstants.PlanFile.ExtraQueryNumBytes; byte[] destinationExtraQueryBuffer = new byte[destinationExtraQuerySize]; await stream.ReadAsync(destinationExtraQueryBuffer, 0, destinationExtraQuerySize); - Assert.AreEqual(_testDestinationQuery.ToByteArray(destinationExtraQuerySize), destinationExtraQueryBuffer); + Assert.AreEqual(DefaultDestinationQuery.ToByteArray(destinationExtraQuerySize), destinationExtraQueryBuffer); int oneByte = DataMovementConstants.PlanFile.OneByte; byte[] isFinalPartBuffer = new byte[oneByte]; @@ -223,24 +225,24 @@ public async Task Serialize() int ttlAfterCompletionSize = DataMovementConstants.PlanFile.LongSizeInBytes; byte[] ttlAfterCompletionBuffer = new byte[ttlAfterCompletionSize]; await stream.ReadAsync(ttlAfterCompletionBuffer, 0, ttlAfterCompletionSize); - Assert.AreEqual(_testTtlAfterCompletion.Ticks.ToByteArray(ttlAfterCompletionSize), ttlAfterCompletionBuffer); + Assert.AreEqual(DefaultTtlAfterCompletion.Ticks.ToByteArray(ttlAfterCompletionSize), ttlAfterCompletionBuffer); byte[] fromToBuffer = new byte[oneByte]; await stream.ReadAsync(fromToBuffer, 0, oneByte); - Assert.AreEqual((byte)_testJobPlanOperation, fromToBuffer[0]); + Assert.AreEqual((byte)DefaultJobPlanOperation, fromToBuffer[0]); byte[] folderPropertyModeBuffer = new byte[oneByte]; await stream.ReadAsync(folderPropertyModeBuffer, 0, oneByte); - Assert.AreEqual((byte)_testFolderPropertiesMode, folderPropertyModeBuffer[0]); + Assert.AreEqual((byte)DefaultFolderPropertiesMode, folderPropertyModeBuffer[0]); int numberChunksSize = DataMovementConstants.PlanFile.LongSizeInBytes; byte[] numberChunksBuffer = new byte[numberChunksSize]; await stream.ReadAsync(numberChunksBuffer, 0, numberChunksSize); - Assert.AreEqual(_testNumberChunks.ToByteArray(numberChunksSize), numberChunksBuffer); + Assert.AreEqual(DefaultNumberChunks.ToByteArray(numberChunksSize), numberChunksBuffer); byte[] blobTypeBuffer = new byte[oneByte]; await stream.ReadAsync(blobTypeBuffer, 0, oneByte); - Assert.AreEqual((byte)_testBlobType, blobTypeBuffer[0]); + Assert.AreEqual((byte)DefaultBlobType, blobTypeBuffer[0]); byte[] noGuessMimeTypeBuffer = new byte[oneByte]; await stream.ReadAsync(noGuessMimeTypeBuffer, 0, oneByte); @@ -249,60 +251,60 @@ public async Task Serialize() int contentTypeLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] contentTypeLengthBuffer = new byte[contentTypeLengthSize]; await stream.ReadAsync(contentTypeLengthBuffer, 0, contentTypeLengthSize); - Assert.AreEqual(((ushort)_testContentType.Length).ToByteArray(contentTypeLengthSize), contentTypeLengthBuffer); + Assert.AreEqual(((ushort)DefaultContentType.Length).ToByteArray(contentTypeLengthSize), contentTypeLengthBuffer); int contentTypeSize = DataMovementConstants.PlanFile.HeaderValueNumBytes; byte[] contentTypeBuffer = new byte[contentTypeSize]; await stream.ReadAsync(contentTypeBuffer, 0, contentTypeSize); - Assert.AreEqual(_testContentType.ToByteArray(contentTypeSize), contentTypeBuffer); + Assert.AreEqual(DefaultContentType.ToByteArray(contentTypeSize), contentTypeBuffer); int contentEncodingLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] contentEncodingLengthBuffer = new byte[contentEncodingLengthSize]; await stream.ReadAsync(contentEncodingLengthBuffer, 0, contentEncodingLengthSize); - Assert.AreEqual(((ushort)_testContentEncoding.Length).ToByteArray(contentEncodingLengthSize), contentEncodingLengthBuffer); + Assert.AreEqual(((ushort)DefaultContentEncoding.Length).ToByteArray(contentEncodingLengthSize), contentEncodingLengthBuffer); int contentEncodingSize = DataMovementConstants.PlanFile.HeaderValueNumBytes; byte[] contentEncodingBuffer = new byte[contentEncodingSize]; await stream.ReadAsync(contentEncodingBuffer, 0, contentEncodingSize); - Assert.AreEqual(_testContentEncoding.ToByteArray(contentEncodingSize), contentEncodingBuffer); + Assert.AreEqual(DefaultContentEncoding.ToByteArray(contentEncodingSize), contentEncodingBuffer); int contentLanguageLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] contentLanguageLengthBuffer = new byte[contentLanguageLengthSize]; await stream.ReadAsync(contentLanguageLengthBuffer, 0, contentLanguageLengthSize); - Assert.AreEqual(((ushort)_testContentLanguage.Length).ToByteArray(contentLanguageLengthSize), contentLanguageLengthBuffer); + Assert.AreEqual(((ushort)DefaultContentLanguage.Length).ToByteArray(contentLanguageLengthSize), contentLanguageLengthBuffer); int contentLanguageSize = DataMovementConstants.PlanFile.HeaderValueNumBytes; byte[] contentLanguageBuffer = new byte[contentLanguageSize]; await stream.ReadAsync(contentLanguageBuffer, 0, contentLanguageSize); - Assert.AreEqual(_testContentLanguage.ToByteArray(contentLanguageSize), contentLanguageBuffer); + Assert.AreEqual(DefaultContentLanguage.ToByteArray(contentLanguageSize), contentLanguageBuffer); int contentDispositionLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] contentDispositionLengthBuffer = new byte[contentDispositionLengthSize]; await stream.ReadAsync(contentDispositionLengthBuffer, 0, contentDispositionLengthSize); - Assert.AreEqual(((ushort)_testContentDisposition.Length).ToByteArray(contentDispositionLengthSize), contentDispositionLengthBuffer); + Assert.AreEqual(((ushort)DefaultContentDisposition.Length).ToByteArray(contentDispositionLengthSize), contentDispositionLengthBuffer); int contentDispositionSize = DataMovementConstants.PlanFile.HeaderValueNumBytes; byte[] contentDispositionBuffer = new byte[contentDispositionSize]; await stream.ReadAsync(contentDispositionBuffer, 0, contentDispositionSize); - Assert.AreEqual(_testContentDisposition.ToByteArray(contentDispositionSize), contentDispositionBuffer); + Assert.AreEqual(DefaultContentDisposition.ToByteArray(contentDispositionSize), contentDispositionBuffer); int cacheControlLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] cacheControlLengthBuffer = new byte[cacheControlLengthSize]; await stream.ReadAsync(cacheControlLengthBuffer, 0, cacheControlLengthSize); - Assert.AreEqual(((ushort)_testCacheControl.Length).ToByteArray(cacheControlLengthSize), cacheControlLengthBuffer); + Assert.AreEqual(((ushort)DefaultCacheControl.Length).ToByteArray(cacheControlLengthSize), cacheControlLengthBuffer); int cacheControlSize = DataMovementConstants.PlanFile.HeaderValueNumBytes; byte[] cacheControlBuffer = new byte[cacheControlSize]; await stream.ReadAsync(cacheControlBuffer, 0, cacheControlSize); - Assert.AreEqual(_testCacheControl.ToByteArray(cacheControlSize), cacheControlBuffer); + Assert.AreEqual(DefaultCacheControl.ToByteArray(cacheControlSize), cacheControlBuffer); byte[] blockBlobTierBuffer = new byte[oneByte]; await stream.ReadAsync(blockBlobTierBuffer, 0, oneByte); - Assert.AreEqual((byte)_testBlockBlobTier, blockBlobTierBuffer[0]); + Assert.AreEqual((byte)DefaultBlockBlobTier, blockBlobTierBuffer[0]); byte[] pageBlobTierBuffer = new byte[oneByte]; await stream.ReadAsync(pageBlobTierBuffer, 0, oneByte); - Assert.AreEqual((byte)_testPageBlobTier, pageBlobTierBuffer[0]); + Assert.AreEqual((byte)DefaultPageBlobTier, pageBlobTierBuffer[0]); byte[] putMd5Buffer = new byte[oneByte]; await stream.ReadAsync(putMd5Buffer, 0, oneByte); @@ -337,17 +339,17 @@ public async Task Serialize() int cpkScopeInfoLengthSize = DataMovementConstants.PlanFile.UShortSizeInBytes; byte[] cpkScopeInfoLengthBuffer = new byte[cpkScopeInfoLengthSize]; await stream.ReadAsync(cpkScopeInfoLengthBuffer, 0, cpkScopeInfoLengthSize); - Assert.AreEqual(((ushort)_testCpkScopeInfo.Length).ToByteArray(cpkScopeInfoLengthSize), cpkScopeInfoLengthBuffer); + Assert.AreEqual(((ushort)DefaultCpkScopeInfo.Length).ToByteArray(cpkScopeInfoLengthSize), cpkScopeInfoLengthBuffer); int cpkScopeInfoSize = DataMovementConstants.PlanFile.HeaderValueNumBytes; byte[] cpkScopeInfoBuffer = new byte[cpkScopeInfoSize]; await stream.ReadAsync(cpkScopeInfoBuffer, 0, cpkScopeInfoSize); - Assert.AreEqual(_testCpkScopeInfo.ToByteArray(cpkScopeInfoSize), cpkScopeInfoBuffer); + Assert.AreEqual(DefaultCpkScopeInfo.ToByteArray(cpkScopeInfoSize), cpkScopeInfoBuffer); int blockSizeLengthSize = DataMovementConstants.PlanFile.LongSizeInBytes; byte[] blockSizeLengthBuffer = new byte[blockSizeLengthSize]; await stream.ReadAsync(blockSizeLengthBuffer, 0, blockSizeLengthSize); - Assert.AreEqual(_testBlockSize.ToByteArray(blockSizeLengthSize), blockSizeLengthBuffer); + Assert.AreEqual(DefaultBlockSize.ToByteArray(blockSizeLengthSize), blockSizeLengthBuffer); byte[] preserveLastModifiedTimeBuffer = new byte[oneByte]; await stream.ReadAsync(preserveLastModifiedTimeBuffer, 0, oneByte); @@ -355,7 +357,7 @@ public async Task Serialize() byte[] checksumVerificationOptionBuffer = new byte[oneByte]; await stream.ReadAsync(checksumVerificationOptionBuffer, 0, oneByte); - Assert.AreEqual(_testChecksumVerificationOption, checksumVerificationOptionBuffer[0]); + Assert.AreEqual(DefaultChecksumVerificationOption, checksumVerificationOptionBuffer[0]); byte[] preserveSMBPermissionsBuffer = new byte[oneByte]; await stream.ReadAsync(preserveSMBPermissionsBuffer, 0, oneByte); @@ -379,27 +381,27 @@ public async Task Serialize() byte[] s2sInvalidMetadataHandleOptionBuffer = new byte[oneByte]; await stream.ReadAsync(s2sInvalidMetadataHandleOptionBuffer, 0, oneByte); - Assert.AreEqual(_testS2sInvalidMetadataHandleOption, s2sInvalidMetadataHandleOptionBuffer[0]); + Assert.AreEqual(DefaultS2sInvalidMetadataHandleOption, s2sInvalidMetadataHandleOptionBuffer[0]); byte[] deleteSnapshotsOptionBuffer = new byte[oneByte]; await stream.ReadAsync(deleteSnapshotsOptionBuffer, 0, oneByte); - Assert.AreEqual((byte)_testDeleteSnapshotsOption, deleteSnapshotsOptionBuffer[0]); + Assert.AreEqual((byte)DefaultDeleteSnapshotsOption, deleteSnapshotsOptionBuffer[0]); byte[] permanentDeleteOptionBuffer = new byte[oneByte]; await stream.ReadAsync(permanentDeleteOptionBuffer, 0, oneByte); - Assert.AreEqual((byte)_testPermanentDeleteOption, permanentDeleteOptionBuffer[0]); + Assert.AreEqual((byte)DefaultPermanentDeleteOption, permanentDeleteOptionBuffer[0]); byte[] rehydratePriorityTypeBuffer = new byte[oneByte]; await stream.ReadAsync(rehydratePriorityTypeBuffer, 0, oneByte); - Assert.AreEqual((byte)_testRehydratePriorityType, rehydratePriorityTypeBuffer[0]); + Assert.AreEqual((byte)DefaultRehydratePriorityType, rehydratePriorityTypeBuffer[0]); byte[] atomicJobStatusBuffer = new byte[oneByte]; await stream.ReadAsync(atomicJobStatusBuffer, 0, oneByte); - Assert.AreEqual((byte)_testJobStatus, atomicJobStatusBuffer[0]); + Assert.AreEqual((byte)DefaultJobStatus, atomicJobStatusBuffer[0]); byte[] atomicPartStatusBuffer = new byte[oneByte]; await stream.ReadAsync(atomicPartStatusBuffer, 0, oneByte); - Assert.AreEqual((byte)_testPartStatus, atomicPartStatusBuffer[0]); + Assert.AreEqual((byte)DefaultPartStatus, atomicPartStatusBuffer[0]); } } @@ -419,8 +421,8 @@ public void Serialize_Error() public void Deserialize() { // Arrange - IDictionary metadata = BuildMetadata(); - IDictionary blobTags = BuildTags(); + IDictionary metadata = DataProvider.BuildMetadata(); + IDictionary blobTags = DataProvider.BuildTags(); JobPartPlanHeader header = CreateDefaultJobPartHeader( metadata: metadata, @@ -457,7 +459,7 @@ public void Deserialize_File_Version_b2() using (FileStream stream = File.OpenRead(samplePath)) { // Act / Assert - DeserializeAndVerify(stream, DataMovementConstants.PlanFile.SchemaVersion_b2, BuildMetadata(), BuildTags()); + DeserializeAndVerify(stream, DataMovementConstants.PlanFile.SchemaVersion_b2, DataProvider.BuildMetadata(), DataProvider.BuildTags()); } } @@ -482,40 +484,40 @@ private void DeserializeAndVerify( // Assert Assert.AreEqual(deserializedHeader.Version, schemaVersion); - Assert.AreEqual(deserializedHeader.StartTime, _testStartTime); - Assert.AreEqual(deserializedHeader.TransferId, _testTransferId); - Assert.AreEqual(deserializedHeader.PartNumber, _testPartNumber); - Assert.AreEqual(deserializedHeader.SourcePath, _testSourcePath); - Assert.AreEqual(deserializedHeader.SourcePathLength, _testSourcePath.Length); - Assert.AreEqual(deserializedHeader.SourceExtraQuery, _testSourceQuery); - Assert.AreEqual(deserializedHeader.SourceExtraQueryLength, _testSourceQuery.Length); - Assert.AreEqual(deserializedHeader.DestinationPath, _testDestinationPath); - Assert.AreEqual(deserializedHeader.DestinationPathLength, _testDestinationPath.Length); - Assert.AreEqual(deserializedHeader.DestinationExtraQuery, _testDestinationQuery); - Assert.AreEqual(deserializedHeader.DestinationExtraQueryLength, _testDestinationQuery.Length); + Assert.AreEqual(deserializedHeader.StartTime, DefaultStartTime); + Assert.AreEqual(deserializedHeader.TransferId, DefaultTransferId); + Assert.AreEqual(deserializedHeader.PartNumber, DefaultPartNumber); + Assert.AreEqual(deserializedHeader.SourcePath, DefaultSourcePath); + Assert.AreEqual(deserializedHeader.SourcePathLength, DefaultSourcePath.Length); + Assert.AreEqual(deserializedHeader.SourceExtraQuery, DefaultSourceQuery); + Assert.AreEqual(deserializedHeader.SourceExtraQueryLength, DefaultSourceQuery.Length); + Assert.AreEqual(deserializedHeader.DestinationPath, DefaultDestinationPath); + Assert.AreEqual(deserializedHeader.DestinationPathLength, DefaultDestinationPath.Length); + Assert.AreEqual(deserializedHeader.DestinationExtraQuery, DefaultDestinationQuery); + Assert.AreEqual(deserializedHeader.DestinationExtraQueryLength, DefaultDestinationQuery.Length); Assert.IsFalse(deserializedHeader.IsFinalPart); Assert.IsFalse(deserializedHeader.ForceWrite); Assert.IsFalse(deserializedHeader.ForceIfReadOnly); Assert.IsFalse(deserializedHeader.AutoDecompress); - Assert.AreEqual(deserializedHeader.Priority, _testPriority); - Assert.AreEqual(deserializedHeader.TTLAfterCompletion, _testTtlAfterCompletion); - Assert.AreEqual(deserializedHeader.JobPlanOperation, _testJobPlanOperation); - Assert.AreEqual(deserializedHeader.FolderPropertyMode, _testFolderPropertiesMode); - Assert.AreEqual(deserializedHeader.NumberChunks, _testNumberChunks); - Assert.AreEqual(deserializedHeader.DstBlobData.BlobType, _testBlobType); + Assert.AreEqual(deserializedHeader.Priority, DefaultPriority); + Assert.AreEqual(deserializedHeader.TTLAfterCompletion, DefaultTtlAfterCompletion); + Assert.AreEqual(deserializedHeader.JobPlanOperation, DefaultJobPlanOperation); + Assert.AreEqual(deserializedHeader.FolderPropertyMode, DefaultFolderPropertiesMode); + Assert.AreEqual(deserializedHeader.NumberChunks, DefaultNumberChunks); + Assert.AreEqual(deserializedHeader.DstBlobData.BlobType, DefaultBlobType); Assert.IsFalse(deserializedHeader.DstBlobData.NoGuessMimeType); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentType, _testContentType); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentTypeLength, _testContentType.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentEncoding, _testContentEncoding); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentEncodingLength, _testContentEncoding.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentLanguage, _testContentLanguage); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentLanguageLength, _testContentLanguage.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentDisposition, _testContentDisposition); - Assert.AreEqual(deserializedHeader.DstBlobData.ContentDispositionLength, _testContentDisposition.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.CacheControl, _testCacheControl); - Assert.AreEqual(deserializedHeader.DstBlobData.CacheControlLength, _testCacheControl.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.BlockBlobTier, _testBlockBlobTier); - Assert.AreEqual(deserializedHeader.DstBlobData.PageBlobTier, _testPageBlobTier); + Assert.AreEqual(deserializedHeader.DstBlobData.ContentType, DefaultContentType); + Assert.AreEqual(deserializedHeader.DstBlobData.ContentTypeLength, DefaultContentType.Length); + Assert.AreEqual(deserializedHeader.DstBlobData.ContentEncoding, DefaultContentEncoding); + Assert.AreEqual(deserializedHeader.DstBlobData.ContentEncodingLength, DefaultContentEncoding.Length); + Assert.AreEqual(deserializedHeader.DstBlobData.ContentLanguage, DefaultContentLanguage); + Assert.AreEqual(deserializedHeader.DstBlobData.ContentLanguageLength, DefaultContentLanguage.Length); + Assert.AreEqual(deserializedHeader.DstBlobData.ContentDisposition, DefaultContentDisposition); + Assert.AreEqual(deserializedHeader.DstBlobData.ContentDispositionLength, DefaultContentDisposition.Length); + Assert.AreEqual(deserializedHeader.DstBlobData.CacheControl, DefaultCacheControl); + Assert.AreEqual(deserializedHeader.DstBlobData.CacheControlLength, DefaultCacheControl.Length); + Assert.AreEqual(deserializedHeader.DstBlobData.BlockBlobTier, DefaultBlockBlobTier); + Assert.AreEqual(deserializedHeader.DstBlobData.PageBlobTier, DefaultPageBlobTier); Assert.IsFalse(deserializedHeader.DstBlobData.PutMd5); string metadataStr = DictionaryToString(metadata); Assert.AreEqual(deserializedHeader.DstBlobData.Metadata, metadataStr); @@ -524,22 +526,22 @@ private void DeserializeAndVerify( Assert.AreEqual(deserializedHeader.DstBlobData.BlobTags, blobTagsStr); Assert.AreEqual(deserializedHeader.DstBlobData.BlobTagsLength, blobTagsStr.Length); Assert.IsFalse(deserializedHeader.DstBlobData.IsSourceEncrypted); - Assert.AreEqual(deserializedHeader.DstBlobData.CpkScopeInfo, _testCpkScopeInfo); - Assert.AreEqual(deserializedHeader.DstBlobData.CpkScopeInfoLength, _testCpkScopeInfo.Length); - Assert.AreEqual(deserializedHeader.DstBlobData.BlockSize, _testBlockSize); + Assert.AreEqual(deserializedHeader.DstBlobData.CpkScopeInfo, DefaultCpkScopeInfo); + Assert.AreEqual(deserializedHeader.DstBlobData.CpkScopeInfoLength, DefaultCpkScopeInfo.Length); + Assert.AreEqual(deserializedHeader.DstBlobData.BlockSize, DefaultBlockSize); Assert.IsFalse(deserializedHeader.DstLocalData.PreserveLastModifiedTime); - Assert.AreEqual(deserializedHeader.DstLocalData.ChecksumVerificationOption, _testChecksumVerificationOption); + Assert.AreEqual(deserializedHeader.DstLocalData.ChecksumVerificationOption, DefaultChecksumVerificationOption); Assert.IsFalse(deserializedHeader.PreserveSMBPermissions); Assert.IsFalse(deserializedHeader.PreserveSMBInfo); Assert.IsFalse(deserializedHeader.S2SGetPropertiesInBackend); Assert.IsFalse(deserializedHeader.S2SSourceChangeValidation); Assert.IsFalse(deserializedHeader.DestLengthValidation); - Assert.AreEqual(deserializedHeader.S2SInvalidMetadataHandleOption, _testS2sInvalidMetadataHandleOption); - Assert.AreEqual(deserializedHeader.DeleteSnapshotsOption, _testDeleteSnapshotsOption); - Assert.AreEqual(deserializedHeader.PermanentDeleteOption, _testPermanentDeleteOption); - Assert.AreEqual(deserializedHeader.RehydratePriorityType, _testRehydratePriorityType); - Assert.AreEqual(deserializedHeader.AtomicJobStatus, _testJobStatus); - Assert.AreEqual(deserializedHeader.AtomicPartStatus, _testPartStatus); + Assert.AreEqual(deserializedHeader.S2SInvalidMetadataHandleOption, DefaultS2sInvalidMetadataHandleOption); + Assert.AreEqual(deserializedHeader.DeleteSnapshotsOption, DefaultDeleteSnapshotsOption); + Assert.AreEqual(deserializedHeader.PermanentDeleteOption, DefaultPermanentDeleteOption); + Assert.AreEqual(deserializedHeader.RehydratePriorityType, DefaultRehydratePriorityType); + Assert.AreEqual(deserializedHeader.AtomicJobStatus, DefaultJobStatus); + Assert.AreEqual(deserializedHeader.AtomicPartStatus, DefaultPartStatus); } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerTests.cs index 8977b9b247b8b..8e3f6cee917cd 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/LocalTransferCheckpointerTests.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using NUnit.Framework; using Azure.Storage.DataMovement.Models.JobPlan; +using static Azure.Storage.DataMovement.Tests.TransferUtility; namespace Azure.Storage.DataMovement.Tests { @@ -55,7 +56,7 @@ internal void CreateStubJobPlanFileAsync( { // Populate the JobPlanFile with a pseudo job plan header - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber, sourcePath: sourcePaths.ElementAt(i), @@ -182,7 +183,7 @@ public async Task AddNewJobPartAsync() string transferId = GetNewTransferId(); int partNumber = 0; int chunksTotal = 1; - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -217,7 +218,7 @@ await transferCheckpointer.AddNewJobPartAsync( readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { // Assert - await AssertJobPlanHeaderAsync(header, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header, stream); } } @@ -229,7 +230,7 @@ public async Task AddNewJobPartAsync_Error() string transferId = GetNewTransferId(); int partNumber = 0; int chunksTotal = 1; - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -273,16 +274,16 @@ public async Task AddNewJobPartAsync_MultipleParts() // Add multiple parts for the same job string transferId = GetNewTransferId(); int chunksTotal = 1; - JobPartPlanHeader header1 = CreateDefaultJobPartHeader( + JobPartPlanHeader header1 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 0); - JobPartPlanHeader header2 = CreateDefaultJobPartHeader( + JobPartPlanHeader header2 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 1); - JobPartPlanHeader header3 = CreateDefaultJobPartHeader( + JobPartPlanHeader header3 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 2); - JobPartPlanHeader header4 = CreateDefaultJobPartHeader( + JobPartPlanHeader header4 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 3); @@ -343,7 +344,7 @@ await transferCheckpointer.AddNewJobPartAsync( readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { // Assert - await AssertJobPlanHeaderAsync(header1, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header1, stream); } using (Stream stream = await transferCheckpointer.ReadableStreamAsync( @@ -353,7 +354,7 @@ await transferCheckpointer.AddNewJobPartAsync( readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { // Assert - await AssertJobPlanHeaderAsync(header2, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header2, stream); } using (Stream stream = await transferCheckpointer.ReadableStreamAsync( @@ -363,7 +364,7 @@ await transferCheckpointer.AddNewJobPartAsync( readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { // Assert - await AssertJobPlanHeaderAsync(header3, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header3, stream); } using (Stream stream = await transferCheckpointer.ReadableStreamAsync( @@ -373,7 +374,7 @@ await transferCheckpointer.AddNewJobPartAsync( readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { // Assert - await AssertJobPlanHeaderAsync(header4, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header4, stream); } } @@ -382,7 +383,7 @@ public async Task AddNewJobPartAsync_AddAfterRemove() { using DisposingLocalDirectory test = DisposingLocalDirectory.GetTestDirectory(); string transferId = GetNewTransferId(); - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 1); @@ -425,7 +426,7 @@ await transferCheckpointer.AddNewJobPartAsync( readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { // Assert - await AssertJobPlanHeaderAsync(header, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header, stream); } } @@ -502,7 +503,7 @@ public async Task AddExistingJobAsync_InvalidHeaderError() string transferId = GetNewTransferId(); int partNumber = 0; - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber, version: "bV"); @@ -591,7 +592,7 @@ public async Task GetStoredTransfersAsync_Empty() TransferCheckpointer transferCheckpointer = new LocalTransferCheckpointer(test.DirectoryPath); string transferId = GetNewTransferId(); int partNumber = 0; - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -723,7 +724,7 @@ public async Task CurrentJobPartCountAsync_OneJob() string transferId = GetNewTransferId(); int partNumber = 0; int chunksTotal = 1; - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -757,16 +758,16 @@ public async Task CurrentJobPartCountAsync_MultipleJobs() // Arrange string transferId = GetNewTransferId(); int chunksTotal = 1; - JobPartPlanHeader header1 = CreateDefaultJobPartHeader( + JobPartPlanHeader header1 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 0); - JobPartPlanHeader header2 = CreateDefaultJobPartHeader( + JobPartPlanHeader header2 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 1); - JobPartPlanHeader header3 = CreateDefaultJobPartHeader( + JobPartPlanHeader header3 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 2); - JobPartPlanHeader header4 = CreateDefaultJobPartHeader( + JobPartPlanHeader header4 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 3); @@ -846,7 +847,7 @@ public async Task ReadableStreamAsync() string transferId = GetNewTransferId(); int partNumber = 0; int chunksTotal = 1; - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -872,7 +873,7 @@ await transferCheckpointer.AddNewJobPartAsync( readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { // Assert - await AssertJobPlanHeaderAsync(header, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header, stream); } } @@ -906,7 +907,7 @@ public async Task SetJobTransferStatusAsync() int partNumber = 0; int chunksTotal = 1; StorageTransferStatus newStatus = StorageTransferStatus.Completed; - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -935,7 +936,7 @@ await transferCheckpointer.AddNewJobPartAsync( offset: 0, readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { - await AssertJobPlanHeaderAsync(header, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header, stream); } } @@ -948,16 +949,16 @@ public async Task SetJobTransferStatusAsync_MultipleParts() string transferId = GetNewTransferId(); int chunksTotal = 1; StorageTransferStatus newStatus = StorageTransferStatus.Completed; - JobPartPlanHeader header1 = CreateDefaultJobPartHeader( + JobPartPlanHeader header1 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 0); - JobPartPlanHeader header2 = CreateDefaultJobPartHeader( + JobPartPlanHeader header2 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 1); - JobPartPlanHeader header3 = CreateDefaultJobPartHeader( + JobPartPlanHeader header3 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 2); - JobPartPlanHeader header4 = CreateDefaultJobPartHeader( + JobPartPlanHeader header4 = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: 3); @@ -1017,7 +1018,7 @@ await transferCheckpointer.AddNewJobPartAsync( offset: 0, readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { - await AssertJobPlanHeaderAsync(header1, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header1, stream); } header2.AtomicJobStatus = newStatus; using (Stream stream = await transferCheckpointer.ReadableStreamAsync( @@ -1026,7 +1027,7 @@ await transferCheckpointer.AddNewJobPartAsync( offset: 0, readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { - await AssertJobPlanHeaderAsync(header2, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header2, stream); } header3.AtomicJobStatus = newStatus; using (Stream stream = await transferCheckpointer.ReadableStreamAsync( @@ -1035,7 +1036,7 @@ await transferCheckpointer.AddNewJobPartAsync( offset: 0, readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { - await AssertJobPlanHeaderAsync(header3, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header3, stream); } header4.AtomicJobStatus = newStatus; using (Stream stream = await transferCheckpointer.ReadableStreamAsync( @@ -1044,7 +1045,7 @@ await transferCheckpointer.AddNewJobPartAsync( offset: 0, readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { - await AssertJobPlanHeaderAsync(header4, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header4, stream); } } @@ -1057,7 +1058,7 @@ public void SetJobTransferStatusAsync_Error() string transferId = GetNewTransferId(); int partNumber = 0; StorageTransferStatus newStatus = StorageTransferStatus.Completed; - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -1079,7 +1080,7 @@ public async Task SetJobPartTransferStatusAsync() int chunksTotal = 1; // originally the default is set to Queued StorageTransferStatus newStatus = StorageTransferStatus.Completed; - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); @@ -1108,7 +1109,7 @@ await transferCheckpointer.AddNewJobPartAsync( offset: 0, readSize: DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes)) { - await AssertJobPlanHeaderAsync(header, stream); + await CheckpointerTesting.AssertJobPlanHeaderAsync(header, stream); } } @@ -1122,7 +1123,7 @@ public void SetJobPartTransferStatusAsync_Error() int partNumber = 0; // originally the default is set to Queued StorageTransferStatus newStatus = StorageTransferStatus.Completed; - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: partNumber); diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/PauseResumeTransferTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/PauseResumeTransferTests.cs index fbca8067b5ff3..855d5ac7aa054 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/PauseResumeTransferTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/PauseResumeTransferTests.cs @@ -32,7 +32,7 @@ public PauseResumeTransferTests( } private async Task AssertDirectorySourceAndDestinationAsync( - TransferType transferType, + TransferDirection transferType, StorageResourceContainer sourceResource, StorageResourceContainer destinationResource, BlobContainerClient sourceContainer, @@ -41,7 +41,7 @@ private async Task AssertDirectorySourceAndDestinationAsync( await foreach (StorageResourceSingle childSourceResource in sourceResource.GetStorageResourcesAsync()) { StorageResourceSingle childDestinationResource; - if (transferType == TransferType.Upload) + if (transferType == TransferDirection.Upload) { string destinationChildName = childSourceResource.Path.Substring(sourceResource.Path.Length + 1); childDestinationResource = destinationResource.GetChildStorageResource(destinationChildName); @@ -61,13 +61,13 @@ await AssertSourceAndDestinationAsync( } private async Task AssertSourceAndDestinationAsync( - TransferType transferType, + TransferDirection transferType, StorageResourceSingle sourceResource, StorageResourceSingle destinationResource, BlobContainerClient sourceContainer, BlobContainerClient destinationContainer) { - if (transferType == TransferType.Upload) + if (transferType == TransferDirection.Upload) { // Verify Upload by downloading the blob and comparing the values BlobUriBuilder destinationBuilder = new BlobUriBuilder(destinationResource.Uri); @@ -76,7 +76,7 @@ private async Task AssertSourceAndDestinationAsync( await DownloadAndAssertAsync(fileStream, destinationContainer.GetBlockBlobClient(destinationBuilder.BlobName)); } } - else if (transferType == TransferType.Download) + else if (transferType == TransferDirection.Download) { // Verify Download BlobUriBuilder sourceBuilder = new BlobUriBuilder(sourceResource.Uri); @@ -141,7 +141,7 @@ private BlockBlobStorageResource CreateBlobDestinationResource( } private async Task<(StorageResourceSingle SourceResource, StorageResourceSingle DestinationResource)> CreateStorageResourcesAsync( - TransferType transferType, + TransferDirection transferType, long size, string localDirectory, BlobContainerClient sourceContainer, @@ -152,14 +152,14 @@ private BlockBlobStorageResource CreateBlobDestinationResource( StorageResourceSingle SourceResource = default; StorageResourceSingle DestinationResource = default; - if (transferType == TransferType.Download) + if (transferType == TransferDirection.Download) { Argument.AssertNotNull(sourceContainer, nameof(sourceContainer)); Argument.AssertNotNullOrEmpty(localDirectory, nameof(localDirectory)); SourceResource ??= await CreateBlobSourceResourceAsync(size, storagePath, sourceContainer); DestinationResource ??= new LocalFileStorageResource(Path.Combine(localDirectory, storagePath)); } - else if (transferType == TransferType.Copy) + else if (transferType == TransferDirection.Copy) { Argument.AssertNotNull(sourceContainer, nameof(sourceContainer)); Argument.AssertNotNull(destinationContainer, nameof(destinationContainer)); @@ -185,7 +185,7 @@ private BlockBlobStorageResource CreateBlobDestinationResource( /// private async Task CreateSingleLongTransferAsync( TransferManager manager, - TransferType transferType = TransferType.Upload, + TransferDirection transferType = TransferDirection.Upload, string localDirectory = default, BlobContainerClient sourceContainer = default, BlobContainerClient destinationContainer = default, @@ -219,10 +219,10 @@ private async Task CreateSingleLongTransferAsync( [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35439")] [RecordedTest] - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task TryPauseTransferAsync_Id(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task TryPauseTransferAsync_Id(TransferDirection transferType) { // Arrange using DisposingLocalDirectory checkpointerDirectory = DisposingLocalDirectory.GetTestDirectory(); @@ -267,10 +267,10 @@ public async Task TryPauseTransferAsync_Id(TransferType transferType) [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35439")] [RecordedTest] - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task TryPauseTransferAsync_DataTransfer(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task TryPauseTransferAsync_DataTransfer(TransferDirection transferType) { // Arrange using DisposingLocalDirectory checkpointerDirectory = DisposingLocalDirectory.GetTestDirectory(); @@ -331,10 +331,10 @@ public void TryPauseTransferAsync_Error() [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35439")] [RecordedTest] - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task TryPauseTransferAsync_AlreadyPaused(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task TryPauseTransferAsync_AlreadyPaused(TransferDirection transferType) { // Arrange using DisposingLocalDirectory checkpointerDirectory = DisposingLocalDirectory.GetTestDirectory(); @@ -384,10 +384,10 @@ public async Task TryPauseTransferAsync_AlreadyPaused(TransferType transferType) [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35439")] [RecordedTest] - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task PauseThenResumeTransferAsync(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task PauseThenResumeTransferAsync(TransferDirection transferType) { // Arrange using DisposingLocalDirectory checkpointerDirectory = DisposingLocalDirectory.GetTestDirectory(); @@ -458,10 +458,10 @@ await AssertSourceAndDestinationAsync( [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35439")] [RecordedTest] - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task ResumeTransferAsync(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task ResumeTransferAsync(TransferDirection transferType) { // Arrange using DisposingLocalDirectory checkpointerDirectory = DisposingLocalDirectory.GetTestDirectory(); @@ -565,7 +565,7 @@ private async Task CreateLocalDirectoryS } private async Task<(StorageResourceContainer SourceResource, StorageResourceContainer DestinationResource)> CreateStorageResourceContainersAsync( - TransferType transferType, + TransferDirection transferType, long size, int transferCount, string sourceDirectoryPath, @@ -575,7 +575,7 @@ private async Task CreateLocalDirectoryS { StorageResourceContainer SourceResource = default; StorageResourceContainer DestinationResource = default; - if (transferType == TransferType.Download) + if (transferType == TransferDirection.Download) { Argument.AssertNotNull(sourceContainer, nameof(sourceContainer)); Argument.AssertNotNullOrEmpty(destinationDirectoryPath, nameof(destinationDirectoryPath)); @@ -586,7 +586,7 @@ private async Task CreateLocalDirectoryS container: sourceContainer); DestinationResource ??= new LocalDirectoryStorageResourceContainer(destinationDirectoryPath); } - else if (transferType == TransferType.Copy) + else if (transferType == TransferDirection.Copy) { Argument.AssertNotNull(sourceContainer, nameof(sourceContainer)); Argument.AssertNotNull(destinationContainer, nameof(destinationContainer)); @@ -628,7 +628,7 @@ private async Task CreateLocalDirectoryS /// private async Task CreateDirectoryLongTransferAsync( TransferManager manager, - TransferType transferType = TransferType.Upload, + TransferDirection transferType = TransferDirection.Upload, string sourceDirectory = default, string destinationDirectory = default, BlobContainerClient sourceContainer = default, @@ -666,10 +666,10 @@ private async Task CreateDirectoryLongTransferAsync( [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35439")] [RecordedTest] - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task TryPauseTransferAsync_Id_Directory(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task TryPauseTransferAsync_Id_Directory(TransferDirection transferType) { // Arrange using DisposingLocalDirectory checkpointerDirectory = DisposingLocalDirectory.GetTestDirectory(); @@ -711,10 +711,10 @@ public async Task TryPauseTransferAsync_Id_Directory(TransferType transferType) [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35439")] [RecordedTest] - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task TryPauseTransferAsync_DataTransfer_Directory(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task TryPauseTransferAsync_DataTransfer_Directory(TransferDirection transferType) { // Arrange using DisposingLocalDirectory checkpointerDirectory = DisposingLocalDirectory.GetTestDirectory(); @@ -756,10 +756,10 @@ public async Task TryPauseTransferAsync_DataTransfer_Directory(TransferType tran [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35439")] [RecordedTest] - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task TryPauseTransferAsync_AlreadyPaused_Directory(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task TryPauseTransferAsync_AlreadyPaused_Directory(TransferDirection transferType) { // Arrange using DisposingLocalDirectory checkpointerDirectory = DisposingLocalDirectory.GetTestDirectory(); @@ -807,10 +807,10 @@ public async Task TryPauseTransferAsync_AlreadyPaused_Directory(TransferType tra [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35439")] [RecordedTest] - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task PauseThenResumeTransferAsync_Directory(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task PauseThenResumeTransferAsync_Directory(TransferDirection transferType) { // Arrange using DisposingLocalDirectory checkpointerDirectory = DisposingLocalDirectory.GetTestDirectory(); @@ -884,10 +884,10 @@ await AssertDirectorySourceAndDestinationAsync( [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/35439")] [RecordedTest] - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task ResumeTransferAsync_Directory(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task ResumeTransferAsync_Directory(TransferDirection transferType) { // Arrange using DisposingLocalDirectory checkpointerDirectory = DisposingLocalDirectory.GetTestDirectory(); diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/ProgressHandlerTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/ProgressHandlerTests.cs index 3d7b0b11e9505..7e8088e7c910a 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/ProgressHandlerTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/ProgressHandlerTests.cs @@ -247,10 +247,10 @@ await TransferAndAssertProgress( [Test] [LiveOnly] // https://github.com/Azure/azure-sdk-for-net/issues/33082 - [TestCase(TransferType.Upload)] - [TestCase(TransferType.Download)] - [TestCase(TransferType.Copy)] - public async Task ProgressHandler_Chunks(TransferType transferType) + [TestCase(TransferDirection.Upload)] + [TestCase(TransferDirection.Download)] + [TestCase(TransferDirection.Copy)] + public async Task ProgressHandler_Chunks(TransferDirection transferType) { // Arrange // For this test, file size should be multiple of chunk size to make predictable progress updates @@ -264,13 +264,13 @@ public async Task ProgressHandler_Chunks(TransferType transferType) StorageResourceContainer sourceResource; StorageResourceContainer destinationResource; - if (transferType == TransferType.Upload) + if (transferType == TransferDirection.Upload) { await PopulateTestLocalDirectory(localDirectory.DirectoryPath, fileSize, fileCount); sourceResource = new LocalDirectoryStorageResourceContainer(localDirectory.DirectoryPath); destinationResource = new BlobStorageResourceContainer(destinationContainer.Container); } - else if (transferType == TransferType.Download) + else if (transferType == TransferDirection.Download) { await PopulateTestContainer(sourceContainer.Container, fileSize, fileCount); sourceResource = new BlobStorageResourceContainer(sourceContainer.Container); diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/RehydrateStorageResourceTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/RehydrateStorageResourceTests.cs index 06bf3bf6808fb..8f42bf4f955e9 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/RehydrateStorageResourceTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/RehydrateStorageResourceTests.cs @@ -10,6 +10,7 @@ using Azure.Storage.DataMovement.Models.JobPlan; using Moq; using NUnit.Framework; +using static Azure.Storage.DataMovement.Tests.TransferUtility; namespace Azure.Storage.DataMovement.Tests { @@ -122,7 +123,7 @@ private async Task AddJobPartToCheckpointer( for (int currentPart = 0; currentPart < partCount; currentPart++) { - JobPartPlanHeader header = CreateDefaultJobPartHeader( + JobPartPlanHeader header = CheckpointerTesting.CreateDefaultJobPartHeader( transferId: transferId, partNumber: currentPart, sourcePath: sourcePaths[currentPart], diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/CheckpointerTesting.cs b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/CheckpointerTesting.cs new file mode 100644 index 0000000000000..6b188d06eba24 --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/CheckpointerTesting.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Storage.Test; +using System.Collections.Generic; +using System.IO; +using System.Threading.Tasks; +using System; +using Azure.Storage.DataMovement.Models.JobPlan; + +namespace Azure.Storage.DataMovement.Tests +{ + internal class CheckpointerTesting + { + internal const string DefaultTransferId = + "c591bacc-5552-4c5c-b068-552685ec5cd5"; + internal const long DefaultPartNumber = 5; + internal static readonly DateTimeOffset DefaultStartTime + = new DateTimeOffset(2023, 03, 13, 15, 24, 6, default); + internal const string DefaultSourceResourceId = "LocalFile"; + internal const string DefaultSourcePath = "C:/sample-source"; + internal const string DefaultSourceQuery = "sourcequery"; + internal const string DefaultDestinationResourceId = "LocalFile"; + internal const string DefaultDestinationPath = "C:/sample-destination"; + internal const string DefaultDestinationQuery = "destquery"; + internal const byte DefaultPriority = 0; + internal static readonly DateTimeOffset DefaultTtlAfterCompletion = DateTimeOffset.MaxValue; + internal const JobPlanOperation DefaultJobPlanOperation = JobPlanOperation.Upload; + internal const FolderPropertiesMode DefaultFolderPropertiesMode = FolderPropertiesMode.None; + internal const long DefaultNumberChunks = 1; + internal const JobPlanBlobType DefaultBlobType = JobPlanBlobType.BlockBlob; + internal const string DefaultContentType = "ContentType / type"; + internal const string DefaultContentEncoding = "UTF8"; + internal const string DefaultContentLanguage = "content-language"; + internal const string DefaultContentDisposition = "content-disposition"; + internal const string DefaultCacheControl = "cache-control"; + internal const JobPartPlanBlockBlobTier DefaultBlockBlobTier = JobPartPlanBlockBlobTier.None; + internal const JobPartPlanPageBlobTier DefaultPageBlobTier = JobPartPlanPageBlobTier.None; + internal const string DefaultCpkScopeInfo = "cpk-scope-info"; + internal const long DefaultBlockSize = 4 * Constants.KB; + internal const byte DefaultS2sInvalidMetadataHandleOption = 0; + internal const byte DefaultChecksumVerificationOption = 0; + internal const JobPartDeleteSnapshotsOption DefaultDeleteSnapshotsOption = JobPartDeleteSnapshotsOption.None; + internal const JobPartPermanentDeleteOption DefaultPermanentDeleteOption = JobPartPermanentDeleteOption.None; + internal const JobPartPlanRehydratePriorityType DefaultRehydratePriorityType = JobPartPlanRehydratePriorityType.None; + internal const StorageTransferStatus DefaultJobStatus = StorageTransferStatus.Queued; + internal const StorageTransferStatus DefaultPartStatus = StorageTransferStatus.Queued; + + internal static JobPartPlanHeader CreateDefaultJobPartHeader( + string version = DataMovementConstants.PlanFile.SchemaVersion, + DateTimeOffset startTime = default, + string transferId = DefaultTransferId, + long partNumber = DefaultPartNumber, + string sourceResourceId = DefaultSourceResourceId, + string sourcePath = DefaultSourcePath, + string sourceExtraQuery = DefaultSourceQuery, + string destinationResourceId = DefaultDestinationResourceId, + string destinationPath = DefaultDestinationPath, + string destinationExtraQuery = DefaultDestinationQuery, + bool isFinalPart = false, + bool forceWrite = false, + bool forceIfReadOnly = false, + bool autoDecompress = false, + byte priority = DefaultPriority, + DateTimeOffset ttlAfterCompletion = default, + JobPlanOperation fromTo = DefaultJobPlanOperation, + FolderPropertiesMode folderPropertyMode = DefaultFolderPropertiesMode, + long numberChunks = DefaultNumberChunks, + JobPlanBlobType blobType = DefaultBlobType, + bool noGuessMimeType = false, + string contentType = DefaultContentType, + string contentEncoding = DefaultContentEncoding, + string contentLanguage = DefaultContentLanguage, + string contentDisposition = DefaultContentDisposition, + string cacheControl = DefaultCacheControl, + JobPartPlanBlockBlobTier blockBlobTier = DefaultBlockBlobTier, + JobPartPlanPageBlobTier pageBlobTier = DefaultPageBlobTier, + bool putMd5 = false, + IDictionary metadata = default, + IDictionary blobTags = default, + bool isSourceEncrypted = false, + string cpkScopeInfo = DefaultCpkScopeInfo, + long blockSize = DefaultBlockSize, + bool preserveLastModifiedTime = false, + byte checksumVerificationOption = DefaultChecksumVerificationOption, + bool preserveSMBPermissions = false, + bool preserveSMBInfo = false, + bool s2sGetPropertiesInBackend = false, + bool s2sSourceChangeValidation = false, + bool destLengthValidation = false, + byte s2sInvalidMetadataHandleOption = DefaultS2sInvalidMetadataHandleOption, + JobPartDeleteSnapshotsOption deleteSnapshotsOption = DefaultDeleteSnapshotsOption, + JobPartPermanentDeleteOption permanentDeleteOption = DefaultPermanentDeleteOption, + JobPartPlanRehydratePriorityType rehydratePriorityType = DefaultRehydratePriorityType, + StorageTransferStatus atomicJobStatus = DefaultJobStatus, + StorageTransferStatus atomicPartStatus = DefaultPartStatus) + { + if (startTime == default) + { + startTime = DefaultStartTime; + } + if (ttlAfterCompletion == default) + { + ttlAfterCompletion = DefaultTtlAfterCompletion; + } + metadata ??= DataProvider.BuildMetadata(); + blobTags ??= DataProvider.BuildTags(); + + JobPartPlanDestinationBlob dstBlobData = new JobPartPlanDestinationBlob( + blobType: blobType, + noGuessMimeType: noGuessMimeType, + contentType: contentType, + contentEncoding: contentEncoding, + contentLanguage: contentLanguage, + contentDisposition: contentDisposition, + cacheControl: cacheControl, + blockBlobTier: blockBlobTier, + pageBlobTier: pageBlobTier, + putMd5: putMd5, + metadata: metadata, + blobTags: blobTags, + isSourceEncrypted: isSourceEncrypted, + cpkScopeInfo: cpkScopeInfo, + blockSize: blockSize); + + JobPartPlanDestinationLocal dstLocalData = new JobPartPlanDestinationLocal( + preserveLastModifiedTime: preserveLastModifiedTime, + checksumVerificationOption: checksumVerificationOption); + + return new JobPartPlanHeader( + version: version, + startTime: startTime, + transferId: transferId, + partNumber: partNumber, + sourceResourceId: sourceResourceId, + sourcePath: sourcePath, + sourceExtraQuery: sourceExtraQuery, + destinationResourceId: destinationResourceId, + destinationPath: destinationPath, + destinationExtraQuery: destinationExtraQuery, + isFinalPart: isFinalPart, + forceWrite: forceWrite, + forceIfReadOnly: forceIfReadOnly, + autoDecompress: autoDecompress, + priority: priority, + ttlAfterCompletion: ttlAfterCompletion, + jobPlanOperation: fromTo, + folderPropertyMode: folderPropertyMode, + numberChunks: numberChunks, + dstBlobData: dstBlobData, + dstLocalData: dstLocalData, + preserveSMBPermissions: preserveSMBPermissions, + preserveSMBInfo: preserveSMBInfo, + s2sGetPropertiesInBackend: s2sGetPropertiesInBackend, + s2sSourceChangeValidation: s2sSourceChangeValidation, + destLengthValidation: destLengthValidation, + s2sInvalidMetadataHandleOption: s2sInvalidMetadataHandleOption, + deleteSnapshotsOption: deleteSnapshotsOption, + permanentDeleteOption: permanentDeleteOption, + rehydratePriorityType: rehydratePriorityType, + atomicJobStatus: atomicJobStatus, + atomicPartStatus: atomicPartStatus); + } + + internal static async Task AssertJobPlanHeaderAsync(JobPartPlanHeader header, Stream stream) + { + int headerSize = DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes; + using var originalHeaderStream = new MemoryStream(headerSize); + header.Serialize(originalHeaderStream); + originalHeaderStream.Seek(0, SeekOrigin.Begin); + stream.Seek(0, SeekOrigin.Begin); + + for (var i = 0; i < headerSize; i += Constants.DefaultBufferSize * 5 / 2) + { + var startIndex = i; + var count = Math.Min(Constants.DefaultBufferSize, (int)(headerSize - startIndex)); + + var buffer = new byte[count]; + var actual = new byte[count]; + stream.Seek(i, SeekOrigin.Begin); + originalHeaderStream.Seek(i, SeekOrigin.Begin); + await stream.ReadAsync(buffer, 0, count); + await originalHeaderStream.ReadAsync(actual, 0, count); + + TestHelper.AssertSequenceEqual( + actual, + buffer); + } + } + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/DataMovementTestBase.cs b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/DataMovementTestBase.cs index 0d023d3d372cd..6c0131c46b2f8 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/DataMovementTestBase.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/DataMovementTestBase.cs @@ -18,256 +18,9 @@ namespace Azure.Storage.DataMovement.Tests /// public abstract class DataMovementTestBase : StorageTestBase { - public enum TransferType - { - Upload, - Download, - Copy, - } - public DataMovementTestBase(bool async, RecordedTestMode? mode = null) : base(async, mode /* RecordedTestMode.Record /* to re-record */) { } - - [SetUp] - public void Setup() - { - } - public static string GetNewTransferId() => Guid.NewGuid().ToString(); - - public List ListFilesInDirectory(string directory) - { - List files = new List(); - - // Create a queue of folders to enumerate files from, starting with provided path - Queue folders = new(); - folders.Enqueue(directory); - - while (folders.Count > 0) - { - // Grab a folder from the queue - string dir = folders.Dequeue(); - - // Try to enumerate and queue all subdirectories of the current folder - try - { - foreach (string subdir in Directory.EnumerateDirectories(dir)) - { - folders.Enqueue(subdir); - } - } - catch - { - // If we lack permissions to enumerate, throw if the caller specifies - // that we shouldn't continue on error. - // - // TODO: Logging for missing permissions to enumerate folder - // - // Afterthought: once logging is implemented, we can just log any problems - // (whether with given dir or subdir), and skip if told to/throw if not. No need for - // the `dir == _basePath` check (which right now is just a filler signal - // for something going wrong, as opposed to an "success" with an empty list). - if (dir == directory) - { - throw; - } - - // Otherwise, just log the failed subdirectory and continue to list as many - // files as accessible. - continue; - } - - // Send all files in the directory to the scan results - foreach (string file in Directory.EnumerateFiles(dir)) - { - files.Add(file); - } - } - return files; - } - - public Dictionary BuildTags() - => new Dictionary - { - { "tagKey0", "tagValue0" }, - { "tagKey1", "tagValue1" } - }; - - internal const string _testTransferId = - "c591bacc-5552-4c5c-b068-552685ec5cd5"; - internal const long _testPartNumber = 5; - internal static readonly DateTimeOffset _testStartTime - = new DateTimeOffset(2023, 03, 13, 15, 24, 6, default); - internal const string _testSourceResourceId = "LocalFile"; - internal const string _testSourcePath = "C:/sample-source"; - internal const string _testSourceQuery = "sourcequery"; - internal const string _testDestinationResourceId = "LocalFile"; - internal const string _testDestinationPath = "C:/sample-destination"; - internal const string _testDestinationQuery = "destquery"; - internal const byte _testPriority = 0; - internal static readonly DateTimeOffset _testTtlAfterCompletion = DateTimeOffset.MaxValue; - internal const JobPlanOperation _testJobPlanOperation = JobPlanOperation.Upload; - internal const FolderPropertiesMode _testFolderPropertiesMode = FolderPropertiesMode.None; - internal const long _testNumberChunks = 1; - internal const JobPlanBlobType _testBlobType = JobPlanBlobType.BlockBlob; - internal const string _testContentType = "ContentType / type"; - internal const string _testContentEncoding = "UTF8"; - internal const string _testContentLanguage = "content-language"; - internal const string _testContentDisposition = "content-disposition"; - internal const string _testCacheControl = "cache-control"; - internal const JobPartPlanBlockBlobTier _testBlockBlobTier = JobPartPlanBlockBlobTier.None; - internal const JobPartPlanPageBlobTier _testPageBlobTier = JobPartPlanPageBlobTier.None; - internal const string _testCpkScopeInfo = "cpk-scope-info"; - internal const long _testBlockSize = 4 * Constants.KB; - internal const byte _testS2sInvalidMetadataHandleOption = 0; - internal const byte _testChecksumVerificationOption = 0; - internal const JobPartDeleteSnapshotsOption _testDeleteSnapshotsOption = JobPartDeleteSnapshotsOption.None; - internal const JobPartPermanentDeleteOption _testPermanentDeleteOption = JobPartPermanentDeleteOption.None; - internal const JobPartPlanRehydratePriorityType _testRehydratePriorityType = JobPartPlanRehydratePriorityType.None; - internal const StorageTransferStatus _testJobStatus = StorageTransferStatus.Queued; - internal const StorageTransferStatus _testPartStatus = StorageTransferStatus.Queued; - - internal JobPartPlanHeader CreateDefaultJobPartHeader( - string version = DataMovementConstants.PlanFile.SchemaVersion, - DateTimeOffset startTime = default, - string transferId = _testTransferId, - long partNumber = _testPartNumber, - string sourceResourceId = _testSourceResourceId, - string sourcePath = _testSourcePath, - string sourceExtraQuery = _testSourceQuery, - string destinationResourceId = _testDestinationResourceId, - string destinationPath = _testDestinationPath, - string destinationExtraQuery = _testDestinationQuery, - bool isFinalPart = false, - bool forceWrite = false, - bool forceIfReadOnly = false, - bool autoDecompress = false, - byte priority = _testPriority, - DateTimeOffset ttlAfterCompletion = default, - JobPlanOperation fromTo = _testJobPlanOperation, - FolderPropertiesMode folderPropertyMode = _testFolderPropertiesMode, - long numberChunks = _testNumberChunks, - JobPlanBlobType blobType = _testBlobType, - bool noGuessMimeType = false, - string contentType = _testContentType, - string contentEncoding = _testContentEncoding, - string contentLanguage = _testContentLanguage, - string contentDisposition = _testContentDisposition, - string cacheControl = _testCacheControl, - JobPartPlanBlockBlobTier blockBlobTier = _testBlockBlobTier, - JobPartPlanPageBlobTier pageBlobTier = _testPageBlobTier, - bool putMd5 = false, - IDictionary metadata = default, - IDictionary blobTags = default, - bool isSourceEncrypted = false, - string cpkScopeInfo = _testCpkScopeInfo, - long blockSize = _testBlockSize, - bool preserveLastModifiedTime = false, - byte checksumVerificationOption = _testChecksumVerificationOption, - bool preserveSMBPermissions = false, - bool preserveSMBInfo = false, - bool s2sGetPropertiesInBackend = false, - bool s2sSourceChangeValidation = false, - bool destLengthValidation = false, - byte s2sInvalidMetadataHandleOption = _testS2sInvalidMetadataHandleOption, - JobPartDeleteSnapshotsOption deleteSnapshotsOption = _testDeleteSnapshotsOption, - JobPartPermanentDeleteOption permanentDeleteOption = _testPermanentDeleteOption, - JobPartPlanRehydratePriorityType rehydratePriorityType = _testRehydratePriorityType, - StorageTransferStatus atomicJobStatus = _testJobStatus, - StorageTransferStatus atomicPartStatus = _testPartStatus) - { - if (startTime == default) - { - startTime = _testStartTime; - } - if (ttlAfterCompletion == default) - { - ttlAfterCompletion = _testTtlAfterCompletion; - } - metadata ??= BuildMetadata(); - blobTags ??= BuildTags(); - - JobPartPlanDestinationBlob dstBlobData = new JobPartPlanDestinationBlob( - blobType: blobType, - noGuessMimeType: noGuessMimeType, - contentType: contentType, - contentEncoding: contentEncoding, - contentLanguage: contentLanguage, - contentDisposition: contentDisposition, - cacheControl: cacheControl, - blockBlobTier: blockBlobTier, - pageBlobTier: pageBlobTier, - putMd5: putMd5, - metadata: metadata, - blobTags: blobTags, - isSourceEncrypted: isSourceEncrypted, - cpkScopeInfo: cpkScopeInfo, - blockSize: blockSize); - - JobPartPlanDestinationLocal dstLocalData = new JobPartPlanDestinationLocal( - preserveLastModifiedTime: preserveLastModifiedTime, - checksumVerificationOption: checksumVerificationOption); - - return new JobPartPlanHeader( - version: version, - startTime: startTime, - transferId: transferId, - partNumber: partNumber, - sourceResourceId: sourceResourceId, - sourcePath: sourcePath, - sourceExtraQuery: sourceExtraQuery, - destinationResourceId: destinationResourceId, - destinationPath: destinationPath, - destinationExtraQuery: destinationExtraQuery, - isFinalPart: isFinalPart, - forceWrite: forceWrite, - forceIfReadOnly: forceIfReadOnly, - autoDecompress: autoDecompress, - priority: priority, - ttlAfterCompletion: ttlAfterCompletion, - jobPlanOperation: fromTo, - folderPropertyMode: folderPropertyMode, - numberChunks: numberChunks, - dstBlobData: dstBlobData, - dstLocalData: dstLocalData, - preserveSMBPermissions: preserveSMBPermissions, - preserveSMBInfo: preserveSMBInfo, - s2sGetPropertiesInBackend: s2sGetPropertiesInBackend, - s2sSourceChangeValidation: s2sSourceChangeValidation, - destLengthValidation: destLengthValidation, - s2sInvalidMetadataHandleOption: s2sInvalidMetadataHandleOption, - deleteSnapshotsOption: deleteSnapshotsOption, - permanentDeleteOption: permanentDeleteOption, - rehydratePriorityType: rehydratePriorityType, - atomicJobStatus: atomicJobStatus, - atomicPartStatus: atomicPartStatus); - } - - internal static async Task AssertJobPlanHeaderAsync(JobPartPlanHeader header, Stream stream) - { - int headerSize = DataMovementConstants.PlanFile.JobPartHeaderSizeInBytes; - using var originalHeaderStream = new MemoryStream(headerSize); - header.Serialize(originalHeaderStream); - originalHeaderStream.Seek(0, SeekOrigin.Begin); - stream.Seek(0, SeekOrigin.Begin); - - for (var i = 0; i < headerSize; i += Constants.DefaultBufferSize * 5 / 2) - { - var startIndex = i; - var count = Math.Min(Constants.DefaultBufferSize, (int)(headerSize - startIndex)); - - var buffer = new byte[count]; - var actual = new byte[count]; - stream.Seek(i, SeekOrigin.Begin); - originalHeaderStream.Seek(i, SeekOrigin.Begin); - await stream.ReadAsync(buffer, 0, count); - await originalHeaderStream.ReadAsync(actual, 0, count); - - TestHelper.AssertSequenceEqual( - actual, - buffer); - } - } } } diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferDirection.cs b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferDirection.cs new file mode 100644 index 0000000000000..e4ec6af30b9f6 --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferDirection.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +namespace Azure.Storage.DataMovement.Tests +{ + public enum TransferDirection + { + Upload, + Download, + Copy, + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferUtility.cs b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferUtility.cs new file mode 100644 index 0000000000000..0e64ddf91fc51 --- /dev/null +++ b/sdk/storage/Azure.Storage.DataMovement/tests/Shared/TransferUtility.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; + +namespace Azure.Storage.DataMovement.Tests +{ + internal class TransferUtility + { + public static string GetNewTransferId() => Guid.NewGuid().ToString(); + } +} diff --git a/sdk/storage/Azure.Storage.DataMovement/tests/StartTransferDownloadDirectoryTests.cs b/sdk/storage/Azure.Storage.DataMovement/tests/StartTransferDownloadDirectoryTests.cs index 0db58f16cb915..aba886aaa8b4e 100644 --- a/sdk/storage/Azure.Storage.DataMovement/tests/StartTransferDownloadDirectoryTests.cs +++ b/sdk/storage/Azure.Storage.DataMovement/tests/StartTransferDownloadDirectoryTests.cs @@ -12,6 +12,7 @@ using Azure.Storage.Blobs.Models; using Azure.Storage.DataMovement.Blobs; using Azure.Storage.DataMovement.Models; +using Azure.Storage.Test.Shared; using NUnit.Framework; namespace Azure.Storage.DataMovement.Tests @@ -85,7 +86,7 @@ private async Task DownloadBlobDirectoryAndVerify( } // List all files in the destination local path - List destinationFiles = ListFilesInDirectory(destinationLocalPath); + List destinationFiles = FileUtil.ListFileNamesRecursive(destinationLocalPath); Assert.AreEqual(destinationFiles.Count, sourceFiles.Count); destinationFiles.Sort(); sourceFiles.Sort(); @@ -430,7 +431,7 @@ public async Task DownloadDirectoryAsync_Root() CancellationTokenSource tokenSource = new CancellationTokenSource(TimeSpan.FromSeconds(30)); await transfer.AwaitCompletion(tokenSource.Token); - IEnumerable destinationFiles = ListFilesInDirectory(destination.DirectoryPath) + IEnumerable destinationFiles = FileUtil.ListFileNamesRecursive(destination.DirectoryPath) .Select(f => f.Substring(destination.DirectoryPath.Length + 1).Replace("\\", "/")); Assert.IsTrue(destinationFiles.OrderBy(f => f).SequenceEqual(files.OrderBy(f => f)));