Resolved some API review comments from Arch board on File Share service. (#1033)

This commit is contained in:
Kan Tang 2020-12-02 10:18:41 +08:00 committed by GitHub
parent 4e38e8961e
commit 96892d9923
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 177 additions and 167 deletions

View File

@ -16,8 +16,8 @@
namespace Azure { namespace Storage { namespace Files { namespace Shares {
class DirectoryClient;
class FileClient;
class ShareDirectoryClient;
class ShareFileClient;
class ShareClient {
public:
@ -72,20 +72,26 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
ShareClient WithSnapshot(const std::string& snapshot) const;
/**
* @brief Create a DirectoryClient from current ShareClient
* @param directoryPath The path of the directory.
* @return DirectoryClient A directory client that can be used to manage a share directory
* resource.
* @brief Gets the ShareDirectoryClient that's pointing to the root directory of current ShareClient
* @return ShareDirectoryClient The root directory of the share.
*/
DirectoryClient GetDirectoryClient(const std::string& directoryPath) const;
ShareDirectoryClient GetRootShareDirectoryClient() const;
/**
* @brief Create a FileClient from current ShareClient
* @param filePath The path of the file.
* @return FileClient A file client that can be used to manage a share file
* @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.
*/
FileClient GetFileClient(const std::string& filePath) const;
ShareDirectoryClient GetShareDirectoryClient(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 GetShareFileClient(const std::string& filePath) const;
/**
* @brief Creates the file share.

View File

@ -16,12 +16,12 @@
namespace Azure { namespace Storage { namespace Files { namespace Shares {
class FileClient;
class ShareFileClient;
class DirectoryClient {
class ShareDirectoryClient {
public:
/**
* @brief Create A DirectoryClient from connection string to manage a File Share Directory
* @brief Create A ShareDirectoryClient from connection string to manage a File Share Directory
* resource.
* @param connectionString Azure Storage connection string.
* @param shareName The name of a file share.
@ -29,30 +29,30 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* @param options Optional parameters used to initialize the client.
* @return ShareClient The client that can be used to manage a share resource.
*/
static DirectoryClient CreateFromConnectionString(
static ShareDirectoryClient CreateFromConnectionString(
const std::string& connectionString,
const std::string& shareName,
const std::string& directoryPath,
const ShareClientOptions& options = ShareClientOptions());
/**
* @brief Initialize a new instance of DirectoryClient using shared key authentication.
* @brief Initialize a new instance of ShareDirectoryClient using shared key authentication.
* @param shareDirectoryUri The URI of the directory this client's request targets.
* @param credential The shared key credential used to initialize the client.
* @param options Optional parameters used to initialize the client.
*/
explicit DirectoryClient(
explicit ShareDirectoryClient(
const std::string& shareDirectoryUri,
std::shared_ptr<StorageSharedKeyCredential> credential,
const ShareClientOptions& options = ShareClientOptions());
/**
* @brief Initialize a new instance of DirectoryClient using anonymous access or shared access
* @brief Initialize a new instance of ShareDirectoryClient using anonymous access or shared access
* signature.
* @param shareDirectoryUri The URI of the directory this client's request targets.
* @param options Optional parameters used to initialize the client.
*/
explicit DirectoryClient(
explicit ShareDirectoryClient(
const std::string& shareDirectoryUri,
const ShareClientOptions& options = ShareClientOptions());
@ -64,31 +64,31 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string GetUri() const { return m_shareDirectoryUri.GetAbsoluteUrl(); }
/**
* @brief Create a DirectoryClient that's a sub directory of the current DirectoryClient
* @brief Create a ShareDirectoryClient that's a sub directory of the current ShareDirectoryClient
* @param subDirectoryName The name of the subdirectory.
* @return DirectoryClient A directory client that can be used to manage a share directory
* @return ShareDirectoryClient A directory client that can be used to manage a share directory
* resource.
*/
DirectoryClient GetSubDirectoryClient(const std::string& subDirectoryName) const;
ShareDirectoryClient GetSubShareDirectoryClient(const std::string& subDirectoryName) const;
/**
* @brief Create a FileClient from current DirectoryClient
* @brief Create a ShareFileClient from current ShareDirectoryClient
* @param filePath The path of the file.
* @return FileClient A file client that can be used to manage a share file
* @return ShareFileClient A file client that can be used to manage a share file
* resource.
*/
FileClient GetFileClient(const std::string& filePath) const;
ShareFileClient GetShareFileClient(const std::string& filePath) const;
/**
* @brief Initializes a new instance of the DirectoryClient class with an identical uri
* @brief Initializes a new instance of the ShareDirectoryClient class with an identical uri
* source but the specified share snapshot timestamp.
*
* @param shareSnapshot The snapshot identifier for a share snapshot.
* @return A new DirectoryClient instance.
* @return A new ShareDirectoryClient instance.
* @remarks Pass empty string to remove the snapshot returning the directory client without
* specifying the share snapshot.
*/
DirectoryClient WithShareSnapshot(const std::string& shareSnapshot) const;
ShareDirectoryClient WithShareSnapshot(const std::string& shareSnapshot) const;
/**
* @brief Creates the directory.
@ -187,7 +187,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Azure::Core::Http::Url m_shareDirectoryUri;
std::shared_ptr<Azure::Core::Http::HttpPipeline> m_pipeline;
explicit DirectoryClient(
explicit ShareDirectoryClient(
Azure::Core::Http::Url shareDirectoryUri,
std::shared_ptr<Azure::Core::Http::HttpPipeline> pipeline)
: m_shareDirectoryUri(std::move(shareDirectoryUri)), m_pipeline(std::move(pipeline))

View File

@ -17,10 +17,10 @@
namespace Azure { namespace Storage { namespace Files { namespace Shares {
class FileClient {
class ShareFileClient {
public:
/**
* @brief Create A FileClient from connection string to manage a File Share File
* @brief Create A ShareFileClient from connection string to manage a File Share File
* resource.
* @param connectionString Azure Storage connection string.
* @param shareName The name of a file share.
@ -28,30 +28,30 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
* @param options Optional parameters used to initialize the client.
* @return ShareClient The client that can be used to manage a share resource.
*/
static FileClient CreateFromConnectionString(
static ShareFileClient CreateFromConnectionString(
const std::string& connectionString,
const std::string& shareName,
const std::string& filePath,
const ShareClientOptions& options = ShareClientOptions());
/**
* @brief Initialize a new instance of FileClient using shared key authentication.
* @brief Initialize a new instance of ShareFileClient using shared key authentication.
* @param shareFileUri The URI of the file this client's request targets.
* @param credential The shared key credential used to initialize the client.
* @param options Optional parameters used to initialize the client.
*/
explicit FileClient(
explicit ShareFileClient(
const std::string& shareFileUri,
std::shared_ptr<StorageSharedKeyCredential> credential,
const ShareClientOptions& options = ShareClientOptions());
/**
* @brief Initialize a new instance of FileClient using anonymous access or shared access
* @brief Initialize a new instance of ShareFileClient using anonymous access or shared access
* signature.
* @param shareFileUri The URI of the file this client's request targets.
* @param options Optional parameters used to initialize the client.
*/
explicit FileClient(
explicit ShareFileClient(
const std::string& shareFileUri,
const ShareClientOptions& options = ShareClientOptions());
@ -63,15 +63,15 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::string GetUri() const { return m_shareFileUri.GetAbsoluteUrl(); }
/**
* @brief Initializes a new instance of the FileClient class with an identical uri
* @brief Initializes a new instance of the ShareFileClient class with an identical uri
* source but the specified share snapshot timestamp.
*
* @param snapshot The snapshot identifier for the share snapshot.
* @return A new FileClient instance.
* @return A new ShareFileClient instance.
* @remarks Pass empty string to remove the snapshot returning the file client without
* specifying the share snapshot.
*/
FileClient WithShareSnapshot(const std::string& shareSnapshot) const;
ShareFileClient WithShareSnapshot(const std::string& shareSnapshot) const;
/**
* @brief Creates the file.
@ -334,7 +334,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Azure::Core::Http::Url m_shareFileUri;
std::shared_ptr<Azure::Core::Http::HttpPipeline> m_pipeline;
explicit FileClient(
explicit ShareFileClient(
Azure::Core::Http::Url shareFileUri,
std::shared_ptr<Azure::Core::Http::HttpPipeline> pipeline)
: m_shareFileUri(std::move(shareFileUri)), m_pipeline(std::move(pipeline))
@ -342,6 +342,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
friend class ShareClient;
friend class DirectoryClient;
friend class ShareDirectoryClient;
};
}}}} // namespace Azure::Storage::Files::Shares

View File

@ -61,7 +61,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names
struct ListDirectoryHandlesSegmentResult
{
std::vector<HandleItem> HandleList;
std::vector<HandleItem> Handles;
std::string ContinuationToken;
};
@ -87,7 +87,6 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { names
/**
* @brief Last write time for the file/directory..
*/
Azure::Core::Nullable<std::string> LastWriteTime;
};

View File

@ -26,7 +26,7 @@ void FileShareGettingStarted()
std::cout << e.what() << std::endl;
}
FileClient fileClient = shareClient.GetFileClient(fileName);
ShareFileClient fileClient = shareClient.GetShareFileClient(fileName);
fileClient.UploadFrom(reinterpret_cast<const uint8_t*>(fileContent.data()), fileContent.size());

View File

@ -85,18 +85,23 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
}
DirectoryClient ShareClient::GetDirectoryClient(const std::string& directoryPath) const
ShareDirectoryClient ShareClient::GetRootShareDirectoryClient() const
{
return GetShareDirectoryClient("");
}
ShareDirectoryClient ShareClient::GetShareDirectoryClient(const std::string& directoryPath) const
{
auto builder = m_shareUri;
builder.AppendPath(Storage::Details::UrlEncodePath(directoryPath));
return DirectoryClient(builder, m_pipeline);
return ShareDirectoryClient(builder, m_pipeline);
}
FileClient ShareClient::GetFileClient(const std::string& filePath) const
ShareFileClient ShareClient::GetShareFileClient(const std::string& filePath) const
{
auto builder = m_shareUri;
builder.AppendPath(Storage::Details::UrlEncodePath(filePath));
return FileClient(builder, m_pipeline);
return ShareFileClient(builder, m_pipeline);
}
ShareClient ShareClient::WithSnapshot(const std::string& snapshot) const

View File

@ -16,7 +16,7 @@
namespace Azure { namespace Storage { namespace Files { namespace Shares {
DirectoryClient DirectoryClient::CreateFromConnectionString(
ShareDirectoryClient ShareDirectoryClient::CreateFromConnectionString(
const std::string& connectionString,
const std::string& shareName,
const std::string& directoryPath,
@ -29,16 +29,16 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
if (parsedConnectionString.KeyCredential)
{
return DirectoryClient(
return ShareDirectoryClient(
directoryUri.GetAbsoluteUrl(), parsedConnectionString.KeyCredential, options);
}
else
{
return DirectoryClient(directoryUri.GetAbsoluteUrl(), options);
return ShareDirectoryClient(directoryUri.GetAbsoluteUrl(), options);
}
}
DirectoryClient::DirectoryClient(
ShareDirectoryClient::ShareDirectoryClient(
const std::string& shareDirectoryUri,
std::shared_ptr<StorageSharedKeyCredential> credential,
const ShareClientOptions& options)
@ -64,7 +64,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
}
DirectoryClient::DirectoryClient(
ShareDirectoryClient::ShareDirectoryClient(
const std::string& shareDirectoryUri,
const ShareClientOptions& options)
: m_shareDirectoryUri(shareDirectoryUri)
@ -88,23 +88,23 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
}
DirectoryClient DirectoryClient::GetSubDirectoryClient(const std::string& subDirectoryName) const
ShareDirectoryClient ShareDirectoryClient::GetSubShareDirectoryClient(const std::string& subDirectoryName) const
{
auto builder = m_shareDirectoryUri;
builder.AppendPath(Storage::Details::UrlEncodePath(subDirectoryName));
return DirectoryClient(builder, m_pipeline);
return ShareDirectoryClient(builder, m_pipeline);
}
FileClient DirectoryClient::GetFileClient(const std::string& filePath) const
ShareFileClient ShareDirectoryClient::GetShareFileClient(const std::string& filePath) const
{
auto builder = m_shareDirectoryUri;
builder.AppendPath(Storage::Details::UrlEncodePath(filePath));
return FileClient(builder, m_pipeline);
return ShareFileClient(builder, m_pipeline);
}
DirectoryClient DirectoryClient::WithShareSnapshot(const std::string& shareSnapshot) const
ShareDirectoryClient ShareDirectoryClient::WithShareSnapshot(const std::string& shareSnapshot) const
{
DirectoryClient newClient(*this);
ShareDirectoryClient newClient(*this);
if (shareSnapshot.empty())
{
newClient.m_shareDirectoryUri.RemoveQueryParameter(Details::c_ShareSnapshotQueryParameter);
@ -118,7 +118,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
return newClient;
}
Azure::Core::Response<Models::CreateDirectoryResult> DirectoryClient::Create(
Azure::Core::Response<Models::CreateDirectoryResult> ShareDirectoryClient::Create(
const CreateDirectoryOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::Directory::CreateOptions();
@ -162,7 +162,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareDirectoryUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::DeleteDirectoryResult> DirectoryClient::Delete(
Azure::Core::Response<Models::DeleteDirectoryResult> ShareDirectoryClient::Delete(
const DeleteDirectoryOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::Directory::DeleteOptions();
@ -170,7 +170,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareDirectoryUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::GetDirectoryPropertiesResult> DirectoryClient::GetProperties(
Azure::Core::Response<Models::GetDirectoryPropertiesResult> ShareDirectoryClient::GetProperties(
const GetDirectoryPropertiesOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::Directory::GetPropertiesOptions();
@ -178,7 +178,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareDirectoryUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::SetDirectoryPropertiesResult> DirectoryClient::SetProperties(
Azure::Core::Response<Models::SetDirectoryPropertiesResult> ShareDirectoryClient::SetProperties(
Models::FileShareSmbProperties smbProperties,
const SetDirectoryPropertiesOptions& options) const
{
@ -216,7 +216,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareDirectoryUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::SetDirectoryMetadataResult> DirectoryClient::SetMetadata(
Azure::Core::Response<Models::SetDirectoryMetadataResult> ShareDirectoryClient::SetMetadata(
const std::map<std::string, std::string>& metadata,
const SetDirectoryMetadataOptions& options) const
{
@ -227,7 +227,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
Azure::Core::Response<Models::ListFilesAndDirectoriesSegmentResult>
DirectoryClient::ListFilesAndDirectoriesSegment(
ShareDirectoryClient::ListFilesAndDirectoriesSegment(
const ListFilesAndDirectoriesSegmentOptions& options) const
{
auto protocolLayerOptions
@ -254,7 +254,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
Azure::Core::Response<Models::ListDirectoryHandlesSegmentResult>
DirectoryClient::ListHandlesSegment(const ListDirectoryHandlesSegmentOptions& options) const
ShareDirectoryClient::ListHandlesSegment(const ListDirectoryHandlesSegmentOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::Directory::ListHandlesOptions();
protocolLayerOptions.ContinuationToken = options.ContinuationToken;
@ -264,13 +264,13 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareDirectoryUri, *m_pipeline, options.Context, protocolLayerOptions);
Models::ListDirectoryHandlesSegmentResult ret;
ret.ContinuationToken = std::move(result->ContinuationToken);
ret.HandleList = std::move(result->HandleList);
ret.Handles = std::move(result->HandleList);
return Azure::Core::Response<Models::ListDirectoryHandlesSegmentResult>(
std::move(ret), result.ExtractRawResponse());
}
Azure::Core::Response<Models::ForceCloseDirectoryHandleResult> DirectoryClient::ForceCloseHandle(
Azure::Core::Response<Models::ForceCloseDirectoryHandleResult> ShareDirectoryClient::ForceCloseHandle(
const std::string& handleId,
const ForceCloseDirectoryHandleOptions& options) const
{
@ -283,7 +283,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
Azure::Core::Response<Models::ForceCloseAllDirectoryHandlesResult>
DirectoryClient::ForceCloseAllHandles(const ForceCloseAllDirectoryHandlesOptions& options) const
ShareDirectoryClient::ForceCloseAllHandles(const ForceCloseAllDirectoryHandlesOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::Directory::ForceCloseHandlesOptions();
protocolLayerOptions.HandleId = c_FileAllHandles;

View File

@ -19,7 +19,7 @@
namespace Azure { namespace Storage { namespace Files { namespace Shares {
FileClient FileClient::CreateFromConnectionString(
ShareFileClient ShareFileClient::CreateFromConnectionString(
const std::string& connectionString,
const std::string& shareName,
const std::string& filePath,
@ -32,15 +32,15 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
if (parsedConnectionString.KeyCredential)
{
return FileClient(fileUri.GetAbsoluteUrl(), parsedConnectionString.KeyCredential, options);
return ShareFileClient(fileUri.GetAbsoluteUrl(), parsedConnectionString.KeyCredential, options);
}
else
{
return FileClient(fileUri.GetAbsoluteUrl(), options);
return ShareFileClient(fileUri.GetAbsoluteUrl(), options);
}
}
FileClient::FileClient(
ShareFileClient::ShareFileClient(
const std::string& shareFileUri,
std::shared_ptr<StorageSharedKeyCredential> credential,
const ShareClientOptions& options)
@ -67,7 +67,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
}
FileClient::FileClient(const std::string& shareFileUri, const ShareClientOptions& options)
ShareFileClient::ShareFileClient(const std::string& shareFileUri, const ShareClientOptions& options)
: m_shareFileUri(shareFileUri)
{
std::vector<std::unique_ptr<Azure::Core::Http::HttpPolicy>> policies;
@ -89,9 +89,9 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_pipeline = std::make_shared<Azure::Core::Http::HttpPipeline>(policies);
}
FileClient FileClient::WithShareSnapshot(const std::string& shareSnapshot) const
ShareFileClient ShareFileClient::WithShareSnapshot(const std::string& shareSnapshot) const
{
FileClient newClient(*this);
ShareFileClient newClient(*this);
if (shareSnapshot.empty())
{
newClient.m_shareFileUri.RemoveQueryParameter(Details::c_ShareSnapshotQueryParameter);
@ -105,7 +105,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
return newClient;
}
Azure::Core::Response<Models::CreateFileResult> FileClient::Create(
Azure::Core::Response<Models::CreateFileResult> ShareFileClient::Create(
int64_t fileSize,
const CreateFileOptions& options) const
{
@ -176,7 +176,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::DeleteFileResult> FileClient::Delete(
Azure::Core::Response<Models::DeleteFileResult> ShareFileClient::Delete(
const DeleteFileOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::File::DeleteOptions();
@ -185,7 +185,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::DownloadFileResult> FileClient::Download(
Azure::Core::Response<Models::DownloadFileResult> ShareFileClient::Download(
const DownloadFileOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::File::DownloadOptions();
@ -244,7 +244,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
return downloadResponse;
}
Azure::Core::Response<Models::StartCopyFileResult> FileClient::StartCopy(
Azure::Core::Response<Models::StartCopyFileResult> ShareFileClient::StartCopy(
std::string copySource,
const StartCopyFileOptions& options) const
{
@ -302,7 +302,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::AbortCopyFileResult> FileClient::AbortCopy(
Azure::Core::Response<Models::AbortCopyFileResult> ShareFileClient::AbortCopy(
std::string copyId,
const AbortCopyFileOptions& options) const
{
@ -313,7 +313,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::GetFilePropertiesResult> FileClient::GetProperties(
Azure::Core::Response<Models::GetFilePropertiesResult> ShareFileClient::GetProperties(
const GetFilePropertiesOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::File::GetPropertiesOptions();
@ -322,7 +322,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::SetFilePropertiesResult> FileClient::SetProperties(
Azure::Core::Response<Models::SetFilePropertiesResult> ShareFileClient::SetProperties(
Models::FileShareHttpHeaders httpHeaders,
Models::FileShareSmbProperties smbProperties,
const SetFilePropertiesOptions& options) const
@ -385,7 +385,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::SetFileMetadataResult> FileClient::SetMetadata(
Azure::Core::Response<Models::SetFileMetadataResult> ShareFileClient::SetMetadata(
const std::map<std::string, std::string>& metadata,
const SetFileMetadataOptions& options) const
{
@ -396,7 +396,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::UploadFileRangeResult> FileClient::UploadRange(
Azure::Core::Response<Models::UploadFileRangeResult> ShareFileClient::UploadRange(
int64_t offset,
Azure::Core::Http::BodyStream* content,
const UploadFileRangeOptions& options) const
@ -412,7 +412,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *content, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::ClearFileRangeResult> FileClient::ClearRange(
Azure::Core::Response<Models::ClearFileRangeResult> ShareFileClient::ClearRange(
int64_t offset,
int64_t length,
const ClearFileRangeOptions& options) const
@ -432,7 +432,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
protocolLayerOptions);
}
Azure::Core::Response<Models::GetFileRangeListResult> FileClient::GetRangeList(
Azure::Core::Response<Models::GetFileRangeListResult> ShareFileClient::GetRangeList(
const GetFileRangeListOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::File::GetRangeListOptions();
@ -457,7 +457,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::ListFileHandlesSegmentResult> FileClient::ListHandlesSegment(
Azure::Core::Response<Models::ListFileHandlesSegmentResult> ShareFileClient::ListHandlesSegment(
const ListFileHandlesSegmentOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::File::ListHandlesOptions();
@ -467,13 +467,13 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
Models::ListFileHandlesSegmentResult ret;
ret.ContinuationToken = std::move(result->ContinuationToken);
ret.HandleList = std::move(result->HandleList);
ret.Handles = std::move(result->HandleList);
return Azure::Core::Response<Models::ListFileHandlesSegmentResult>(
std::move(ret), result.ExtractRawResponse());
}
Azure::Core::Response<Models::ForceCloseFileHandleResult> FileClient::ForceCloseHandle(
Azure::Core::Response<Models::ForceCloseFileHandleResult> ShareFileClient::ForceCloseHandle(
const std::string& handleId,
const ForceCloseFileHandleOptions& options) const
{
@ -485,7 +485,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
Models::ForceCloseFileHandleResult(), result.ExtractRawResponse());
}
Azure::Core::Response<Models::ForceCloseAllFileHandlesResult> FileClient::ForceCloseAllHandles(
Azure::Core::Response<Models::ForceCloseAllFileHandlesResult> ShareFileClient::ForceCloseAllHandles(
const ForceCloseAllFileHandlesOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::File::ForceCloseHandlesOptions();
@ -495,7 +495,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::AcquireFileLeaseResult> FileClient::AcquireLease(
Azure::Core::Response<Models::AcquireFileLeaseResult> ShareFileClient::AcquireLease(
const std::string& proposedLeaseId,
const AcquireFileLeaseOptions& options) const
{
@ -506,7 +506,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::ChangeFileLeaseResult> FileClient::ChangeLease(
Azure::Core::Response<Models::ChangeFileLeaseResult> ShareFileClient::ChangeLease(
const std::string& leaseId,
const std::string& proposedLeaseId,
const ChangeFileLeaseOptions& options) const
@ -518,7 +518,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::ReleaseFileLeaseResult> FileClient::ReleaseLease(
Azure::Core::Response<Models::ReleaseFileLeaseResult> ShareFileClient::ReleaseLease(
const std::string& leaseId,
const ReleaseFileLeaseOptions& options) const
{
@ -528,7 +528,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::BreakFileLeaseResult> FileClient::BreakLease(
Azure::Core::Response<Models::BreakFileLeaseResult> ShareFileClient::BreakLease(
const BreakFileLeaseOptions& options) const
{
Details::ShareRestClient::File::BreakLeaseOptions protocolLayerOptions;
@ -536,7 +536,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUri, *m_pipeline, options.Context, protocolLayerOptions);
}
Azure::Core::Response<Models::DownloadFileToResult> FileClient::DownloadTo(
Azure::Core::Response<Models::DownloadFileToResult> ShareFileClient::DownloadTo(
uint8_t* buffer,
std::size_t bufferSize,
const DownloadFileToOptions& options) const
@ -656,7 +656,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
return ret;
}
Azure::Core::Response<Models::DownloadFileToResult> FileClient::DownloadTo(
Azure::Core::Response<Models::DownloadFileToResult> ShareFileClient::DownloadTo(
const std::string& fileName,
const DownloadFileToOptions& options) const
{
@ -786,7 +786,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
return ret;
}
Azure::Core::Response<Models::UploadFileFromResult> FileClient::UploadFrom(
Azure::Core::Response<Models::UploadFileFromResult> ShareFileClient::UploadFrom(
const uint8_t* buffer,
std::size_t bufferSize,
const UploadFileFromOptions& options) const
@ -878,7 +878,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
std::make_unique<Azure::Core::Http::RawResponse>(std::move(createResult.GetRawResponse())));
}
Azure::Core::Response<Models::UploadFileFromResult> FileClient::UploadFrom(
Azure::Core::Response<Models::UploadFileFromResult> ShareFileClient::UploadFrom(
const std::string& fileName,
const UploadFileFromOptions& options) const
{

View File

@ -307,7 +307,7 @@ namespace Azure { namespace Storage { namespace Test {
{
std::string directoryName = baseName + RandomString();
auto directoryClient = m_shareClient->GetDirectoryClient(directoryName);
auto directoryClient = m_shareClient->GetShareDirectoryClient(directoryName);
EXPECT_NO_THROW(directoryClient.Create());
auto directoryUrl = directoryClient.GetUri();
EXPECT_EQ(
@ -316,7 +316,7 @@ namespace Azure { namespace Storage { namespace Test {
}
{
std::string fileName = baseName + RandomString();
auto fileClient = m_shareClient->GetFileClient(fileName);
auto fileClient = m_shareClient->GetShareFileClient(fileName);
EXPECT_NO_THROW(fileClient.Create(1024));
auto fileUrl = fileClient.GetUri();
EXPECT_EQ(fileUrl, m_shareClient->GetUri() + "/" + Storage::Details::UrlEncodePath(fileName));

View File

@ -7,7 +7,7 @@
namespace Azure { namespace Storage { namespace Test {
std::shared_ptr<Files::Shares::DirectoryClient>
std::shared_ptr<Files::Shares::ShareDirectoryClient>
FileShareDirectoryClientTest::m_fileShareDirectoryClient;
std::string FileShareDirectoryClientTest::m_directoryName;
@ -19,8 +19,8 @@ namespace Azure { namespace Storage { namespace Test {
Files::Shares::ShareClient::CreateFromConnectionString(
StandardStorageConnectionString(), m_shareName));
m_shareClient->Create();
m_fileShareDirectoryClient = std::make_shared<Files::Shares::DirectoryClient>(
m_shareClient->GetDirectoryClient(m_directoryName));
m_fileShareDirectoryClient = std::make_shared<Files::Shares::ShareDirectoryClient>(
m_shareClient->GetShareDirectoryClient(m_directoryName));
m_fileShareDirectoryClient->Create();
}
@ -56,7 +56,7 @@ namespace Azure { namespace Storage { namespace Test {
{
options.Prefix = prefix;
}
auto directoryClient = m_shareClient->GetDirectoryClient(directoryPath);
auto directoryClient = m_shareClient->GetShareDirectoryClient(directoryPath);
do
{
auto response = directoryClient.ListFilesAndDirectoriesSegment(options);
@ -76,11 +76,11 @@ namespace Azure { namespace Storage { namespace Test {
{
{
// Normal create/delete.
std::vector<Files::Shares::DirectoryClient> directoryClients;
std::vector<Files::Shares::ShareDirectoryClient> directoryClients;
for (int32_t i = 0; i < 5; ++i)
{
auto name = RandomString(10);
Files::Shares::DirectoryClient client = m_shareClient->GetDirectoryClient(name);
Files::Shares::ShareDirectoryClient client = m_shareClient->GetShareDirectoryClient(name);
EXPECT_NO_THROW(client.Create());
directoryClients.emplace_back(std::move(client));
}
@ -95,7 +95,7 @@ namespace Azure { namespace Storage { namespace Test {
for (int32_t i = 0; i < 5; ++i)
{
auto name = RandomString(10);
Files::Shares::DirectoryClient client = m_shareClient->GetDirectoryClient(name);
Files::Shares::ShareDirectoryClient client = m_shareClient->GetShareDirectoryClient(name);
EXPECT_NO_THROW(client.Create());
EXPECT_THROW(client.Create(), StorageException);
}
@ -118,8 +118,8 @@ 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->GetShareDirectoryClient(LowercaseRandomString());
auto client2 = m_shareClient->GetShareDirectoryClient(LowercaseRandomString());
Files::Shares::CreateDirectoryOptions options1;
Files::Shares::CreateDirectoryOptions options2;
options1.Metadata = metadata1;
@ -142,8 +142,8 @@ 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->GetShareDirectoryClient(LowercaseRandomString());
auto client2 = m_shareClient->GetShareDirectoryClient(LowercaseRandomString());
Files::Shares::CreateDirectoryOptions options1;
Files::Shares::CreateDirectoryOptions options2;
options1.DirectoryPermission = permission;
@ -155,7 +155,7 @@ 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->GetShareDirectoryClient(LowercaseRandomString());
Files::Shares::CreateDirectoryOptions options3;
options3.SmbProperties.PermissionKey = result1;
EXPECT_NO_THROW(client3.Create(options3));
@ -171,8 +171,8 @@ namespace Azure { namespace Storage { namespace Test {
properties.CreationTime = ToIso8601(std::chrono::system_clock::now(), 7);
properties.LastWriteTime = ToIso8601(std::chrono::system_clock::now(), 7);
properties.PermissionKey = "";
auto client1 = m_shareClient->GetDirectoryClient(LowercaseRandomString());
auto client2 = m_shareClient->GetDirectoryClient(LowercaseRandomString());
auto client1 = m_shareClient->GetShareDirectoryClient(LowercaseRandomString());
auto client2 = m_shareClient->GetShareDirectoryClient(LowercaseRandomString());
EXPECT_NO_THROW(client1.Create());
EXPECT_NO_THROW(client2.Create());
@ -186,7 +186,7 @@ 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->GetShareDirectoryClient(LowercaseRandomString());
Files::Shares::CreateDirectoryOptions options3;
options3.SmbProperties.PermissionKey = result1;
std::string permissionKey;
@ -206,8 +206,8 @@ 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->GetShareDirectoryClient(LowercaseRandomString());
auto client2 = m_shareClient->GetShareDirectoryClient(LowercaseRandomString());
Files::Shares::CreateDirectoryOptions options1;
Files::Shares::CreateDirectoryOptions options2;
options1.SmbProperties = properties;
@ -224,8 +224,8 @@ namespace Azure { namespace Storage { namespace Test {
{
// SetProperties works
auto client1 = m_shareClient->GetDirectoryClient(LowercaseRandomString());
auto client2 = m_shareClient->GetDirectoryClient(LowercaseRandomString());
auto client1 = m_shareClient->GetShareDirectoryClient(LowercaseRandomString());
auto client2 = m_shareClient->GetShareDirectoryClient(LowercaseRandomString());
EXPECT_NO_THROW(client1.Create());
EXPECT_NO_THROW(client2.Create());
@ -248,25 +248,25 @@ namespace Azure { namespace Storage { namespace Test {
std::vector<std::string> directoryNameSetB;
std::vector<std::string> fileNameSetA;
std::vector<std::string> fileNameSetB;
auto clientA = m_shareClient->GetDirectoryClient(directoryNameA);
auto clientA = m_shareClient->GetShareDirectoryClient(directoryNameA);
clientA.Create();
auto clientB = m_shareClient->GetDirectoryClient(directoryNameB);
auto clientB = m_shareClient->GetShareDirectoryClient(directoryNameB);
clientB.Create();
for (size_t i = 0; i < 5; ++i)
{
{
auto directoryName = LowercaseRandomString();
auto fileName = LowercaseRandomString();
EXPECT_NO_THROW(clientA.GetSubDirectoryClient(directoryName).Create());
EXPECT_NO_THROW(clientA.GetFileClient(fileName).Create(1024));
EXPECT_NO_THROW(clientA.GetSubShareDirectoryClient(directoryName).Create());
EXPECT_NO_THROW(clientA.GetShareFileClient(fileName).Create(1024));
directoryNameSetA.emplace_back(std::move(directoryName));
fileNameSetA.emplace_back(std::move(fileName));
}
{
auto directoryName = LowercaseRandomString();
auto fileName = LowercaseRandomString();
EXPECT_NO_THROW(clientB.GetSubDirectoryClient(directoryName).Create());
EXPECT_NO_THROW(clientB.GetFileClient(fileName).Create(1024));
EXPECT_NO_THROW(clientB.GetSubShareDirectoryClient(directoryName).Create());
EXPECT_NO_THROW(clientB.GetShareFileClient(fileName).Create(1024));
directoryNameSetB.emplace_back(std::move(directoryName));
fileNameSetB.emplace_back(std::move(fileName));
}
@ -347,7 +347,7 @@ namespace Azure { namespace Storage { namespace Test {
// List max result
Files::Shares::ListFilesAndDirectoriesSegmentOptions options;
options.MaxResults = 2;
auto directoryNameAClient = m_shareClient->GetDirectoryClient(directoryNameA);
auto directoryNameAClient = m_shareClient->GetShareDirectoryClient(directoryNameA);
auto response = directoryNameAClient.ListFilesAndDirectoriesSegment(options);
EXPECT_LE(2U, response->DirectoryItems.size() + response->FileItems.size());
}
@ -356,7 +356,7 @@ namespace Azure { namespace Storage { namespace Test {
TEST_F(FileShareDirectoryClientTest, HandlesFunctionalityWorks)
{
auto result = m_fileShareDirectoryClient->ListHandlesSegment();
EXPECT_TRUE(result->HandleList.empty());
EXPECT_TRUE(result->Handles.empty());
EXPECT_TRUE(result->ContinuationToken.empty());
EXPECT_NO_THROW(m_fileShareDirectoryClient->ForceCloseAllHandles());
}

View File

@ -21,7 +21,7 @@ namespace Azure { namespace Storage { namespace Test {
static Files::Shares::Models::FileShareHttpHeaders GetInterestingHttpHeaders();
static std::shared_ptr<Files::Shares::DirectoryClient> m_fileShareDirectoryClient;
static std::shared_ptr<Files::Shares::ShareDirectoryClient> m_fileShareDirectoryClient;
static std::string m_directoryName;
};

View File

@ -12,7 +12,7 @@
namespace Azure { namespace Storage { namespace Test {
std::shared_ptr<Files::Shares::FileClient> FileShareFileClientTest::m_fileClient;
std::shared_ptr<Files::Shares::ShareFileClient> FileShareFileClientTest::m_fileClient;
std::string FileShareFileClientTest::m_fileName;
std::vector<uint8_t> FileShareFileClientTest::m_fileContent;
@ -25,11 +25,11 @@ namespace Azure { namespace Storage { namespace Test {
Files::Shares::ShareClient::CreateFromConnectionString(
StandardStorageConnectionString(), m_shareName));
m_shareClient->Create();
m_fileShareDirectoryClient = std::make_shared<Files::Shares::DirectoryClient>(
m_shareClient->GetDirectoryClient(m_directoryName));
m_fileShareDirectoryClient = std::make_shared<Files::Shares::ShareDirectoryClient>(
m_shareClient->GetShareDirectoryClient(m_directoryName));
m_fileShareDirectoryClient->Create();
m_fileClient = std::make_shared<Files::Shares::FileClient>(
m_fileShareDirectoryClient->GetFileClient(m_fileName));
m_fileClient = std::make_shared<Files::Shares::ShareFileClient>(
m_fileShareDirectoryClient->GetShareFileClient(m_fileName));
m_fileClient->Create(1024);
}
@ -44,11 +44,11 @@ namespace Azure { namespace Storage { namespace Test {
{
{
// Normal create/delete.
std::vector<Files::Shares::FileClient> fileClients;
std::vector<Files::Shares::ShareFileClient> fileClients;
for (int32_t i = 0; i < 5; ++i)
{
auto fileName = RandomString(10);
Files::Shares::FileClient client = m_fileShareDirectoryClient->GetFileClient(fileName);
Files::Shares::ShareFileClient client = m_fileShareDirectoryClient->GetShareFileClient(fileName);
EXPECT_NO_THROW(client.Create(1024));
fileClients.emplace_back(std::move(client));
}
@ -62,7 +62,7 @@ namespace Azure { namespace Storage { namespace Test {
for (int32_t i = 0; i < 5; ++i)
{
auto fileName = RandomString(10);
Files::Shares::FileClient client = m_fileShareDirectoryClient->GetFileClient(fileName);
Files::Shares::ShareFileClient client = m_fileShareDirectoryClient->GetShareFileClient(fileName);
EXPECT_NO_THROW(client.Create(1024));
EXPECT_NO_THROW(client.Create(1024));
}
@ -85,8 +85,8 @@ namespace Azure { namespace Storage { namespace Test {
{
// Create directory with metadata works
auto client1 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client2 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client1 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
auto client2 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
Files::Shares::CreateFileOptions options1;
Files::Shares::CreateFileOptions options2;
options1.Metadata = metadata1;
@ -109,8 +109,8 @@ namespace Azure { namespace Storage { namespace Test {
{
// Create directory with permission/permission key works
auto client1 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client2 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client1 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
auto client2 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
Files::Shares::CreateFileOptions options1;
Files::Shares::CreateFileOptions options2;
options1.Permission = permission;
@ -122,7 +122,7 @@ namespace Azure { namespace Storage { namespace Test {
auto result2 = client2.GetProperties()->FilePermissionKey;
EXPECT_EQ(result1, result2);
auto client3 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client3 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
Files::Shares::CreateFileOptions options3;
options3.SmbProperties.PermissionKey = result1;
EXPECT_NO_THROW(client3.Create(1024, options3));
@ -138,8 +138,8 @@ namespace Azure { namespace Storage { namespace Test {
properties.CreationTime = ToIso8601(std::chrono::system_clock::now(), 7);
properties.LastWriteTime = ToIso8601(std::chrono::system_clock::now(), 7);
properties.PermissionKey = "";
auto client1 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client2 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client1 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
auto client2 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
EXPECT_NO_THROW(client1.Create(1024));
EXPECT_NO_THROW(client2.Create(1024));
@ -153,7 +153,7 @@ namespace Azure { namespace Storage { namespace Test {
auto result2 = client1.GetProperties()->FilePermissionKey;
EXPECT_EQ(result1, result2);
auto client3 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client3 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
Files::Shares::CreateFileOptions options3;
options3.SmbProperties.PermissionKey = result1;
std::string permissionKey;
@ -173,8 +173,8 @@ namespace Azure { namespace Storage { namespace Test {
properties.PermissionKey = m_fileClient->GetProperties()->FilePermissionKey;
{
// Create directory with SmbProperties works
auto client1 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client2 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client1 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
auto client2 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
Files::Shares::CreateFileOptions options1;
Files::Shares::CreateFileOptions options2;
options1.SmbProperties = properties;
@ -191,8 +191,8 @@ namespace Azure { namespace Storage { namespace Test {
{
// SetProperties works
auto client1 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client2 = m_fileShareDirectoryClient->GetFileClient(LowercaseRandomString());
auto client1 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
auto client2 = m_fileShareDirectoryClient->GetShareFileClient(LowercaseRandomString());
EXPECT_NO_THROW(client1.Create(1024));
EXPECT_NO_THROW(client2.Create(1024));
@ -209,7 +209,7 @@ namespace Azure { namespace Storage { namespace Test {
TEST_F(FileShareFileClientTest, HandlesFunctionalityWorks)
{
auto result = m_fileClient->ListHandlesSegment();
EXPECT_TRUE(result->HandleList.empty());
EXPECT_TRUE(result->Handles.empty());
EXPECT_TRUE(result->ContinuationToken.empty());
EXPECT_NO_THROW(m_fileClient->ForceCloseAllHandles());
}
@ -259,7 +259,7 @@ namespace Azure { namespace Storage { namespace Test {
std::vector<uint8_t> fileContent = RandomBuffer(static_cast<std::size_t>(8_MB));
auto testUploadFromBuffer = [&](int concurrency, int64_t fileSize) {
auto fileClient = m_fileShareDirectoryClient->GetFileClient(RandomString());
auto fileClient = m_fileShareDirectoryClient->GetShareFileClient(RandomString());
Files::Shares::UploadFileFromOptions options;
options.ChunkSize = 512_KB;
@ -282,7 +282,7 @@ namespace Azure { namespace Storage { namespace Test {
};
auto testUploadFromFile = [&](int concurrency, int64_t fileSize) {
auto fileClient = m_fileShareDirectoryClient->GetFileClient(RandomString());
auto fileClient = m_fileShareDirectoryClient->GetShareFileClient(RandomString());
Files::Shares::UploadFileFromOptions options;
options.ChunkSize = 512_KB;
@ -533,7 +533,7 @@ 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->GetShareFileClient(LowercaseRandomString(10));
fileClient.Create(static_cast<int64_t>(numOfChunks) * rangeSize);
for (int32_t i = 0; i < numOfChunks; ++i)
{
@ -560,7 +560,7 @@ namespace Azure { namespace Storage { namespace Test {
memBodyStream.Rewind();
auto md5String = Base64Encode(Md5::Hash(rangeContent.data(), rangeContent.size()));
auto invalidMd5String = Base64Encode(Md5::Hash(std::string("This is garbage.")));
auto fileClient = m_shareClient->GetFileClient(LowercaseRandomString(10));
auto fileClient = m_shareClient->GetShareFileClient(LowercaseRandomString(10));
Files::Shares::UploadFileRangeOptions uploadOptions;
fileClient.Create(static_cast<int64_t>(numOfChunks) * rangeSize);
uploadOptions.TransactionalMd5 = md5String;
@ -578,10 +578,10 @@ 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->GetShareFileClient(LowercaseRandomString(10));
fileClient.Create(fileSize);
auto destFileClient = m_shareClient->GetFileClient(LowercaseRandomString(10));
auto destFileClient = m_shareClient->GetShareFileClient(LowercaseRandomString(10));
Files::Shares::Models::StartCopyFileResult result;
EXPECT_NO_THROW(result = destFileClient.StartCopy(fileClient.GetUri()).ExtractValue());
EXPECT_EQ(Files::Shares::Models::CopyStatusType::Success, result.CopyStatus);
@ -590,10 +590,10 @@ 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->GetShareFileClient(LowercaseRandomString(10));
fileClient.Create(fileSize);
auto destFileClient = m_shareClient->GetFileClient(LowercaseRandomString(10));
auto destFileClient = m_shareClient->GetShareFileClient(LowercaseRandomString(10));
Files::Shares::StartCopyFileOptions copyOptions;
copyOptions.PermissionCopyMode = Files::Shares::Models::PermissionCopyModeType::Override;
EXPECT_THROW(destFileClient.StartCopy(fileClient.GetUri(), copyOptions), std::runtime_error);
@ -608,7 +608,7 @@ namespace Azure { namespace Storage { namespace Test {
auto halfContent
= std::vector<uint8_t>(fileContent.begin(), fileContent.begin() + fileSize / 2);
halfContent.resize(fileSize);
auto fileClient = m_shareClient->GetFileClient(LowercaseRandomString(10));
auto fileClient = m_shareClient->GetShareFileClient(LowercaseRandomString(10));
fileClient.Create(fileSize);
EXPECT_NO_THROW(fileClient.UploadRange(0, &memBodyStream));
EXPECT_NO_THROW(fileClient.ClearRange(fileSize / 2, fileSize / 2));
@ -635,7 +635,7 @@ namespace Azure { namespace Storage { namespace Test {
auto halfContent
= std::vector<uint8_t>(fileContent.begin(), fileContent.begin() + fileSize / 2);
halfContent.resize(fileSize);
auto fileClient = m_shareClient->GetFileClient(LowercaseRandomString(10));
auto fileClient = m_shareClient->GetShareFileClient(LowercaseRandomString(10));
fileClient.Create(fileSize);
EXPECT_NO_THROW(fileClient.UploadRange(0, &memBodyStream));
EXPECT_NO_THROW(fileClient.ClearRange(fileSize / 2, fileSize / 2));

View File

@ -12,7 +12,7 @@ namespace Azure { namespace Storage { namespace Test {
static void SetUpTestSuite();
static void TearDownTestSuite();
static std::shared_ptr<Files::Shares::FileClient> m_fileClient;
static std::shared_ptr<Files::Shares::ShareFileClient> m_fileClient;
static std::string m_fileName;
static std::vector<uint8_t> m_fileContent;
};

View File

@ -29,7 +29,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.GetShareFileClient(fileName);
std::string shareUri = shareClient0.GetUri();
std::string fileUri = fileClient0.GetUri();
@ -37,7 +37,7 @@ namespace Azure { namespace Storage { namespace Test {
auto verifyFileRead = [&](const std::string& sas) {
int64_t fileSize = 512;
fileClient0.Create(fileSize);
auto fileClient = Files::Shares::FileClient(fileUri + sas);
auto fileClient = Files::Shares::ShareFileClient(fileUri + sas);
auto downloadedContent = fileClient.Download();
EXPECT_EQ(
ReadBodyStream(downloadedContent->BodyStream).size(), static_cast<std::size_t>(fileSize));
@ -45,14 +45,14 @@ namespace Azure { namespace Storage { namespace Test {
auto verifyFileCreate = [&](const std::string& sas) {
int64_t fileSize = 512;
auto fileClient = Files::Shares::FileClient(fileUri + sas);
auto fileClient = Files::Shares::ShareFileClient(fileUri + sas);
EXPECT_NO_THROW(fileClient.Create(fileSize));
};
auto verifyFileWrite = [&](const std::string& sas) {
int64_t fileSize = 512;
fileClient0.Create(fileSize);
auto fileClient = Files::Shares::FileClient(fileUri + sas);
auto fileClient = Files::Shares::ShareFileClient(fileUri + sas);
std::string fileContent = "a";
EXPECT_NO_THROW(fileClient.UploadFrom(
reinterpret_cast<const uint8_t*>(fileContent.data()), fileContent.size()));
@ -61,7 +61,7 @@ namespace Azure { namespace Storage { namespace Test {
auto verifyFileDelete = [&](const std::string& sas) {
int64_t fileSize = 512;
fileClient0.Create(fileSize);
auto fileClient = Files::Shares::FileClient(fileUri + sas);
auto fileClient = Files::Shares::ShareFileClient(fileUri + sas);
EXPECT_NO_THROW(fileClient.Delete());
};
@ -209,7 +209,7 @@ namespace Azure { namespace Storage { namespace Test {
builder2.CacheControl = "no-cache";
builder2.ContentEncoding = "identify";
auto sasToken = builder2.GenerateSasToken(*keyCredential);
auto fileClient = Files::Shares::FileClient(fileUri + sasToken);
auto fileClient = Files::Shares::ShareFileClient(fileUri + sasToken);
fileClient0.Create(0);
auto p = fileClient.GetProperties();
EXPECT_EQ(p->HttpHeaders.ContentType, headers.ContentType);