From a726e81fa481ec8705f666d035a6bb6baa27ea42 Mon Sep 17 00:00:00 2001 From: Kan Tang Date: Tue, 19 Jan 2021 16:42:25 +0800 Subject: [PATCH] =?UTF-8?q?Use=20name=20for=20directory/file=20initializin?= =?UTF-8?q?g=20and=20removed=20unwanted=20funcion=E2=80=A6=20(#1401)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …ality. Fixes https://github.com/Azure/azure-sdk-for-cpp/issues/1163 # Pull Request Checklist Please leverage this checklist as a reminder to address commonly occurring feedback when submitting a pull request to make sure your PR can be reviewed quickly: See the detailed list in the [contributing guide](https://github.com/Azure/azure-sdk-for-cpp/blob/master/CONTRIBUTING.md#pull-requests). - [x] [C++ Guidelines](https://azure.github.io/azure-sdk/cpp_introduction.html) - [x] Doxygen docs - [x] Unit tests - [x] No unwanted commits/changes - [x] Descriptive title/description - [x] PR is single purpose - [x] Related issue listed - [x] Comments in source - [x] No typos - [x] Update changelog - [x] Not work-in-progress - [x] External references or docs updated - [x] Self review of PR done - [x] Any breaking changes? --- .../azure-storage-files-shares/CHANGELOG.md | 3 ++ .../storage/files/shares/share_client.hpp | 16 ------ .../files/shares/share_directory_client.hpp | 8 +-- .../files/shares/share_file_client.hpp | 2 +- .../sample/file_share_getting_started.cpp | 2 +- .../src/share_client.cpp | 16 +----- .../src/share_directory_client.cpp | 12 ++--- .../src/share_file_client.cpp | 4 +- .../test/share_client_test.cpp | 5 +- .../test/share_directory_client_test.cpp | 54 ++++++++++++------- .../test/share_file_client_test.cpp | 26 +++++---- .../test/share_sas_test.cpp | 2 +- 12 files changed, 74 insertions(+), 76 deletions(-) diff --git a/sdk/storage/azure-storage-files-shares/CHANGELOG.md b/sdk/storage/azure-storage-files-shares/CHANGELOG.md index d8c66bd66..ce8a77fef 100644 --- a/sdk/storage/azure-storage-files-shares/CHANGELOG.md +++ b/sdk/storage/azure-storage-files-shares/CHANGELOG.md @@ -2,6 +2,9 @@ ## 12.0.0-beta.7 (Unreleased) +### Breaking Changes + +- Removed `GetDirectoryClient` and `GetFileClient` from `ShareClient`. `ShareDirectoryClient` and `ShareFileClient` now initializes with the name of the resource, not path, to indicate that no path parsing is done for the API ## 12.0.0-beta.6 (2020-01-14) diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp index 36a520581..cd28db36f 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_client.hpp @@ -80,22 +80,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ ShareDirectoryClient GetRootDirectoryClient() const; - /** - * @brief Create a ShareDirectoryClient from current ShareClient - * @param directoryPath The path of the directory. - * @return ShareDirectoryClient A directory client that can be used to manage a share directory - * resource. - */ - ShareDirectoryClient GetDirectoryClient(const std::string& directoryPath) const; - - /** - * @brief Create a ShareFileClient from current ShareClient - * @param filePath The path of the file. - * @return ShareFileClient A file client that can be used to manage a share file - * resource. - */ - ShareFileClient GetFileClient(const std::string& filePath) const; - /** * @brief Creates the file share. * @param options Optional parameters to create this file share. diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp index bf61aaf3c..3856d0c05 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_directory_client.hpp @@ -33,7 +33,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { static ShareDirectoryClient CreateFromConnectionString( const std::string& connectionString, const std::string& shareName, - const std::string& directoryPath, + const std::string& directoryName, const ShareClientOptions& options = ShareClientOptions()); /** @@ -67,11 +67,11 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** * @brief Create a ShareDirectoryClient that's a sub directory of the current * ShareDirectoryClient - * @param subDirectoryName The name of the subdirectory. + * @param subdirectoryName The name of the subdirectory. * @return ShareDirectoryClient A directory client that can be used to manage a share directory * resource. */ - ShareDirectoryClient GetSubdirectoryClient(const std::string& subDirectoryName) const; + ShareDirectoryClient GetSubdirectoryClient(const std::string& subdirectoryName) const; /** * @brief Create a ShareFileClient from current ShareDirectoryClient @@ -79,7 +79,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { * @return ShareFileClient A file client that can be used to manage a share file * resource. */ - ShareFileClient GetFileClient(const std::string& filePath) const; + ShareFileClient GetFileClient(const std::string& fileName) const; /** * @brief Initializes a new instance of the ShareDirectoryClient class with an identical uri diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp index d369ac598..a9903556d 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp @@ -32,7 +32,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { static ShareFileClient CreateFromConnectionString( const std::string& connectionString, const std::string& shareName, - const std::string& filePath, + const std::string& fileName, const ShareClientOptions& options = ShareClientOptions()); /** diff --git a/sdk/storage/azure-storage-files-shares/sample/file_share_getting_started.cpp b/sdk/storage/azure-storage-files-shares/sample/file_share_getting_started.cpp index 1a31decf2..10b8513b7 100644 --- a/sdk/storage/azure-storage-files-shares/sample/file_share_getting_started.cpp +++ b/sdk/storage/azure-storage-files-shares/sample/file_share_getting_started.cpp @@ -27,7 +27,7 @@ void FileShareGettingStarted() std::cout << e.what() << std::endl; } - ShareFileClient fileClient = shareClient.GetFileClient(fileName); + ShareFileClient fileClient = shareClient.GetRootDirectoryClient().GetFileClient(fileName); fileClient.UploadFrom(reinterpret_cast(fileContent.data()), fileContent.size()); diff --git a/sdk/storage/azure-storage-files-shares/src/share_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_client.cpp index 6cc5ae642..f95b638e0 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_client.cpp @@ -90,21 +90,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { ShareDirectoryClient ShareClient::GetRootDirectoryClient() const { - return GetDirectoryClient(""); - } - - ShareDirectoryClient ShareClient::GetDirectoryClient(const std::string& directoryPath) const - { - auto builder = m_shareUri; - builder.AppendPath(Storage::Details::UrlEncodePath(directoryPath)); - return ShareDirectoryClient(builder, m_pipeline); - } - - ShareFileClient ShareClient::GetFileClient(const std::string& filePath) const - { - auto builder = m_shareUri; - builder.AppendPath(Storage::Details::UrlEncodePath(filePath)); - return ShareFileClient(builder, m_pipeline); + return ShareDirectoryClient(m_shareUri, m_pipeline); } ShareClient ShareClient::WithSnapshot(const std::string& snapshot) const diff --git a/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp index 94c61b303..51a99421e 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_directory_client.cpp @@ -20,13 +20,13 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { ShareDirectoryClient ShareDirectoryClient::CreateFromConnectionString( const std::string& connectionString, const std::string& shareName, - const std::string& directoryPath, + const std::string& directoryName, const ShareClientOptions& options) { auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString); auto directoryUri = std::move(parsedConnectionString.FileServiceUrl); directoryUri.AppendPath(Storage::Details::UrlEncodePath(shareName)); - directoryUri.AppendPath(Storage::Details::UrlEncodePath(directoryPath)); + directoryUri.AppendPath(Storage::Details::UrlEncodePath(directoryName)); if (parsedConnectionString.KeyCredential) { @@ -92,17 +92,17 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { } ShareDirectoryClient ShareDirectoryClient::GetSubdirectoryClient( - const std::string& subDirectoryName) const + const std::string& subdirectoryName) const { auto builder = m_shareDirectoryUri; - builder.AppendPath(Storage::Details::UrlEncodePath(subDirectoryName)); + builder.AppendPath(Storage::Details::UrlEncodePath(subdirectoryName)); return ShareDirectoryClient(builder, m_pipeline); } - ShareFileClient ShareDirectoryClient::GetFileClient(const std::string& filePath) const + ShareFileClient ShareDirectoryClient::GetFileClient(const std::string& fileName) const { auto builder = m_shareDirectoryUri; - builder.AppendPath(Storage::Details::UrlEncodePath(filePath)); + builder.AppendPath(Storage::Details::UrlEncodePath(fileName)); return ShareFileClient(builder, m_pipeline); } diff --git a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp index 310bde6e7..0a0f1100a 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp @@ -23,13 +23,13 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { ShareFileClient ShareFileClient::CreateFromConnectionString( const std::string& connectionString, const std::string& shareName, - const std::string& filePath, + const std::string& fileName, const ShareClientOptions& options) { auto parsedConnectionString = Azure::Storage::Details::ParseConnectionString(connectionString); auto fileUri = std::move(parsedConnectionString.FileServiceUrl); fileUri.AppendPath(Storage::Details::UrlEncodePath(shareName)); - fileUri.AppendPath(Storage::Details::UrlEncodePath(filePath)); + fileUri.AppendPath(Storage::Details::UrlEncodePath(fileName)); if (parsedConnectionString.KeyCredential) { diff --git a/sdk/storage/azure-storage-files-shares/test/share_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/share_client_test.cpp index 455220e9f..84e27fb8c 100644 --- a/sdk/storage/azure-storage-files-shares/test/share_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/share_client_test.cpp @@ -345,7 +345,8 @@ namespace Azure { namespace Storage { namespace Test { { std::string directoryName = baseName + RandomString(); - auto directoryClient = m_shareClient->GetDirectoryClient(directoryName); + auto directoryClient + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(directoryName); EXPECT_NO_THROW(directoryClient.Create()); auto directoryUrl = directoryClient.GetUri(); EXPECT_EQ( @@ -354,7 +355,7 @@ namespace Azure { namespace Storage { namespace Test { } { std::string fileName = baseName + RandomString(); - auto fileClient = m_shareClient->GetFileClient(fileName); + auto fileClient = m_shareClient->GetRootDirectoryClient().GetFileClient(fileName); EXPECT_NO_THROW(fileClient.Create(1024)); auto fileUrl = fileClient.GetUri(); EXPECT_EQ(fileUrl, m_shareClient->GetUri() + "/" + Storage::Details::UrlEncodePath(fileName)); diff --git a/sdk/storage/azure-storage-files-shares/test/share_directory_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/share_directory_client_test.cpp index 58a75685d..7cd79dc34 100644 --- a/sdk/storage/azure-storage-files-shares/test/share_directory_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/share_directory_client_test.cpp @@ -21,7 +21,7 @@ namespace Azure { namespace Storage { namespace Test { StandardStorageConnectionString(), m_shareName)); m_shareClient->Create(); m_fileShareDirectoryClient = std::make_shared( - m_shareClient->GetDirectoryClient(m_directoryName)); + m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(m_directoryName)); m_fileShareDirectoryClient->Create(); } @@ -57,7 +57,8 @@ namespace Azure { namespace Storage { namespace Test { { options.Prefix = prefix; } - auto directoryClient = m_shareClient->GetDirectoryClient(directoryPath); + auto directoryClient + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(directoryPath); do { auto response = directoryClient.ListFilesAndDirectoriesSinglePage(options); @@ -81,7 +82,8 @@ namespace Azure { namespace Storage { namespace Test { for (int32_t i = 0; i < 5; ++i) { auto name = RandomString(10); - Files::Shares::ShareDirectoryClient client = m_shareClient->GetDirectoryClient(name); + Files::Shares::ShareDirectoryClient client + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(name); EXPECT_NO_THROW(client.Create()); directoryClients.emplace_back(std::move(client)); } @@ -96,7 +98,8 @@ namespace Azure { namespace Storage { namespace Test { for (int32_t i = 0; i < 5; ++i) { auto name = RandomString(10); - Files::Shares::ShareDirectoryClient client = m_shareClient->GetDirectoryClient(name); + Files::Shares::ShareDirectoryClient client + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(name); EXPECT_NO_THROW(client.Create()); EXPECT_THROW(client.Create(), StorageException); } @@ -170,8 +173,10 @@ namespace Azure { namespace Storage { namespace Test { { // Create directory with metadata works - auto client1 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); - auto client2 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); + auto client1 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); + auto client2 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); Files::Shares::CreateShareDirectoryOptions options1; Files::Shares::CreateShareDirectoryOptions options2; options1.Metadata = metadata1; @@ -194,8 +199,10 @@ namespace Azure { namespace Storage { namespace Test { { // Create directory with permission/permission key works - auto client1 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); - auto client2 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); + auto client1 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); + auto client2 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); Files::Shares::CreateShareDirectoryOptions options1; Files::Shares::CreateShareDirectoryOptions options2; options1.DirectoryPermission = permission; @@ -207,7 +214,8 @@ namespace Azure { namespace Storage { namespace Test { auto result2 = client2.GetProperties()->FilePermissionKey; EXPECT_EQ(result1, result2); - auto client3 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); + auto client3 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); Files::Shares::CreateShareDirectoryOptions options3; options3.SmbProperties.PermissionKey = result1; EXPECT_NO_THROW(client3.Create(options3)); @@ -223,8 +231,10 @@ namespace Azure { namespace Storage { namespace Test { properties.CreatedOn = std::chrono::system_clock::now(); properties.LastWrittenOn = std::chrono::system_clock::now(); properties.PermissionKey = ""; - auto client1 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); - auto client2 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); + auto client1 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); + auto client2 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); EXPECT_NO_THROW(client1.Create()); EXPECT_NO_THROW(client2.Create()); @@ -238,7 +248,8 @@ namespace Azure { namespace Storage { namespace Test { auto result2 = client2.GetProperties()->FilePermissionKey; EXPECT_EQ(result1, result2); - auto client3 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); + auto client3 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); Files::Shares::CreateShareDirectoryOptions options3; options3.SmbProperties.PermissionKey = result1; std::string permissionKey; @@ -258,8 +269,10 @@ namespace Azure { namespace Storage { namespace Test { properties.PermissionKey = m_fileShareDirectoryClient->GetProperties()->FilePermissionKey; { // Create directory with SmbProperties works - auto client1 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); - auto client2 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); + auto client1 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); + auto client2 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); Files::Shares::CreateShareDirectoryOptions options1; Files::Shares::CreateShareDirectoryOptions options2; options1.SmbProperties = properties; @@ -276,8 +289,10 @@ namespace Azure { namespace Storage { namespace Test { { // SetProperties works - auto client1 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); - auto client2 = m_shareClient->GetDirectoryClient(LowercaseRandomString()); + auto client1 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); + auto client2 + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(LowercaseRandomString()); EXPECT_NO_THROW(client1.Create()); EXPECT_NO_THROW(client2.Create()); @@ -300,9 +315,9 @@ namespace Azure { namespace Storage { namespace Test { std::vector directoryNameSetB; std::vector fileNameSetA; std::vector fileNameSetB; - auto clientA = m_shareClient->GetDirectoryClient(directoryNameA); + auto clientA = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(directoryNameA); clientA.Create(); - auto clientB = m_shareClient->GetDirectoryClient(directoryNameB); + auto clientB = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(directoryNameB); clientB.Create(); for (size_t i = 0; i < 5; ++i) { @@ -399,7 +414,8 @@ namespace Azure { namespace Storage { namespace Test { // List max result Files::Shares::ListFilesAndDirectoriesSinglePageOptions options; options.PageSizeHint = 2; - auto directoryNameAClient = m_shareClient->GetDirectoryClient(directoryNameA); + auto directoryNameAClient + = m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(directoryNameA); auto response = directoryNameAClient.ListFilesAndDirectoriesSinglePage(options); EXPECT_LE(2U, response->DirectoryItems.size() + response->FileItems.size()); } diff --git a/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp index 6ad287c76..58b560da9 100644 --- a/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp @@ -27,7 +27,7 @@ namespace Azure { namespace Storage { namespace Test { StandardStorageConnectionString(), m_shareName)); m_shareClient->Create(); m_fileShareDirectoryClient = std::make_shared( - m_shareClient->GetDirectoryClient(m_directoryName)); + m_shareClient->GetRootDirectoryClient().GetSubdirectoryClient(m_directoryName)); m_fileShareDirectoryClient->Create(); m_fileClient = std::make_shared( m_fileShareDirectoryClient->GetFileClient(m_fileName)); @@ -580,7 +580,8 @@ namespace Azure { namespace Storage { namespace Test { auto memBodyStream = Core::Http::MemoryBodyStream(rangeContent); { // Simple upload/download. - auto fileClient = m_shareClient->GetFileClient(LowercaseRandomString(10)); + auto fileClient + = m_shareClient->GetRootDirectoryClient().GetFileClient(LowercaseRandomString(10)); fileClient.Create(static_cast(numOfChunks) * rangeSize); for (int32_t i = 0; i < numOfChunks; ++i) { @@ -608,7 +609,8 @@ namespace Azure { namespace Storage { namespace Test { memBodyStream.Rewind(); auto md5 = Md5::Hash(rangeContent.data(), rangeContent.size()); auto invalidMd5 = Md5::Hash(std::string("This is garbage.")); - auto fileClient = m_shareClient->GetFileClient(LowercaseRandomString(10)); + auto fileClient + = m_shareClient->GetRootDirectoryClient().GetFileClient(LowercaseRandomString(10)); Files::Shares::UploadShareFileRangeOptions uploadOptions; fileClient.Create(static_cast(numOfChunks) * rangeSize); ContentHash hash; @@ -630,10 +632,12 @@ namespace Azure { namespace Storage { namespace Test { auto memBodyStream = Core::Http::MemoryBodyStream(fileContent); { // Simple copy works. - auto fileClient = m_shareClient->GetFileClient(LowercaseRandomString(10)); + auto fileClient + = m_shareClient->GetRootDirectoryClient().GetFileClient(LowercaseRandomString(10)); fileClient.Create(fileSize); - auto destFileClient = m_shareClient->GetFileClient(LowercaseRandomString(10)); + auto destFileClient + = m_shareClient->GetRootDirectoryClient().GetFileClient(LowercaseRandomString(10)); Files::Shares::Models::StartCopyShareFileResult result; EXPECT_NO_THROW(result = destFileClient.StartCopy(fileClient.GetUri()).ExtractValue()); EXPECT_EQ(Files::Shares::Models::CopyStatusType::Success, result.CopyStatus); @@ -642,10 +646,12 @@ namespace Azure { namespace Storage { namespace Test { { // Copy mode with override and empty permission throws error.. - auto fileClient = m_shareClient->GetFileClient(LowercaseRandomString(10)); + auto fileClient + = m_shareClient->GetRootDirectoryClient().GetFileClient(LowercaseRandomString(10)); fileClient.Create(fileSize); - auto destFileClient = m_shareClient->GetFileClient(LowercaseRandomString(10)); + auto destFileClient + = m_shareClient->GetRootDirectoryClient().GetFileClient(LowercaseRandomString(10)); Files::Shares::StartCopyShareFileOptions copyOptions; copyOptions.PermissionCopyMode = Files::Shares::Models::PermissionCopyModeType::Override; EXPECT_THROW(destFileClient.StartCopy(fileClient.GetUri(), copyOptions), std::runtime_error); @@ -660,7 +666,8 @@ namespace Azure { namespace Storage { namespace Test { auto halfContent = std::vector(fileContent.begin(), fileContent.begin() + fileSize / 2); halfContent.resize(fileSize); - auto fileClient = m_shareClient->GetFileClient(LowercaseRandomString(10)); + auto fileClient + = m_shareClient->GetRootDirectoryClient().GetFileClient(LowercaseRandomString(10)); fileClient.Create(fileSize); EXPECT_NO_THROW(fileClient.UploadRange(0, &memBodyStream)); EXPECT_NO_THROW(fileClient.ClearRange(fileSize / 2, fileSize / 2)); @@ -689,7 +696,8 @@ namespace Azure { namespace Storage { namespace Test { auto halfContent = std::vector(fileContent.begin(), fileContent.begin() + fileSize / 2); halfContent.resize(fileSize); - auto fileClient = m_shareClient->GetFileClient(LowercaseRandomString(10)); + auto fileClient + = m_shareClient->GetRootDirectoryClient().GetFileClient(LowercaseRandomString(10)); fileClient.Create(fileSize); EXPECT_NO_THROW(fileClient.UploadRange(0, &memBodyStream)); EXPECT_NO_THROW(fileClient.ClearRange(fileSize / 2, fileSize / 2)); diff --git a/sdk/storage/azure-storage-files-shares/test/share_sas_test.cpp b/sdk/storage/azure-storage-files-shares/test/share_sas_test.cpp index 8e38e9f9a..70ed4d74d 100644 --- a/sdk/storage/azure-storage-files-shares/test/share_sas_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/share_sas_test.cpp @@ -34,7 +34,7 @@ namespace Azure { namespace Storage { namespace Test { auto fileServiceClient0 = Files::Shares::ShareServiceClient::CreateFromConnectionString( StandardStorageConnectionString()); auto shareClient0 = fileServiceClient0.GetShareClient(m_shareName); - auto fileClient0 = shareClient0.GetFileClient(fileName); + auto fileClient0 = shareClient0.GetRootDirectoryClient().GetFileClient(fileName); std::string shareUri = shareClient0.GetUri(); std::string fileUri = fileClient0.GetUri();