Share via


MockAdlsClient Class

Definition

Mock Adls Client. All the operations are done in memory. This is not a accurate immplementation of actual adlsclient. The immplementations are best effort only.

public sealed class MockAdlsClient : Microsoft.Azure.DataLake.Store.AdlsClient
type MockAdlsClient = class
    inherit AdlsClient
Public NotInheritable Class MockAdlsClient
Inherits AdlsClient
Inheritance
MockAdlsClient

Properties

AccountFQDN

Azure data lake store account name including full domain name

(Inherited from AdlsClient)
ClientId

Client object ID

(Inherited from AdlsClient)

Methods

AddUserAgentSuffix(String)

Adds the user agent suffix

(Inherited from AdlsClient)
BulkDownload(String, String, Int32, IfExists, Boolean, IProgress<TransferStatus>, Boolean, Boolean, CancellationToken)

Download directory or file from remote server to local. Transfers the contents under source directory under the destination directory. Transfers the source file and saves it as the destination path. This method does not throw any exception for any entry's transfer failure. Refer the return value TransferStatus to get the status/exception of each entry's transfer. By default logs the transfer progress in system's temp path, so that user can recover using resume if upload has crashed. This progress logging can be disabled using disableTransferLogging. It is highly recomended to set ServicePointManager.DefaultConnectionLimit to the number of threads application wants the sdk to use before creating any instance of AdlsClient. By default ServicePointManager.DefaultConnectionLimit is set to 2.

(Inherited from AdlsClient)
BulkDownload(String, String, Int32, IfExists, IProgress<TransferStatus>, Boolean, Boolean, CancellationToken)

Reads data from memory stream and save it to local file

BulkUpload(String, String, Int32, IfExists, Boolean, IProgress<TransferStatus>, Boolean, Boolean, Boolean, CancellationToken)

Upload directory or file from local to remote. Transfers the contents under source directory under the destination directory. Transfers the source file and saves it as the destination path. This method does not throw any exception for any entry's transfer failure. Refer the return value TransferStatus to get the status/exception of each entry's transfer. By default logs the transfer progress in system's temp path, so that user can recover using resume if upload has crashed. This progress logging can be disabled using disableTransferLogging. It is highly recomended to set ServicePointManager.DefaultConnectionLimit to the number of threads application wants the sdk to use before creating any instance of AdlsClient. By default ServicePointManager.DefaultConnectionLimit is set to 2. By default files are uploaded at new line boundaries. However if files does not have newline within 4MB chunks, the transfer will fail. In that case it is required to pass true to isBinary to avoid uploads at newline boundaries.

(Inherited from AdlsClient)
BulkUpload(String, String, Int32, IfExists, IProgress<TransferStatus>, Boolean, Boolean, Boolean, CancellationToken)

Bulk uploads file only. Reads a local file and maintains the memory stream for the entry

ChangeAcl(String, List<AclEntry>, RequestedAclType, Int32, IProgress<AclProcessorStats>, CancellationToken)

Currently the recursive entities need to be created separately for mock testing

ChangeAcl(String, List<AclEntry>, RequestedAclType, Int32)

Currently the recursive entities need to be created separately for mock testing

CheckAccess(String, String, CancellationToken)

Checks if the user/group has specified access of the given path

(Inherited from AdlsClient)
CheckAccessAsync(String, String, CancellationToken)

Asynchronously checks if the user/group has specified access of the given path

(Inherited from AdlsClient)
CheckExists(String)

Checks whether file or directory exists

(Inherited from AdlsClient)
ConcatenateFiles(String, List<String>, Boolean, CancellationToken)

Concats the memory stream of source entries and merges them into a new memory stream

ConcatenateFilesAsync(String, List<String>, Boolean, CancellationToken)

Concats the memory stream of source entries and merges them into a new memory stream

ConcurrentAppend(String, Boolean, Byte[], Int32, Int32)

Synchronous API to perform concurrent append at server. The offset at which append will occur is determined by server. It is highly recomended to call this api with data size less than equals 4MB. Backend gurantees 4MB atomic appends.

(Inherited from AdlsClient)
ConcurrentAppendAsync(String, Boolean, Byte[], Int32, Int32, CancellationToken)

Asynchronous API to perform concurrent append at server. The offset at which append will occur is determined by server. Asynchronous operation. It is highly recomended to call this api with data size less than equals 4MB. Backend gurantees 4MB atomic appends.

(Inherited from AdlsClient)
CreateDelegatingHandler(HttpClientHandler, DelegatingHandler[])

Based on Microsoft.Rest.ServiceCLient immplementation. USed for mock framework's delegation handler

(Inherited from AdlsClient)
CreateDirectory(String, String, CancellationToken)

Creates a directory- Creates an entry for the directory in the internal dictionary

CreateDirectoryAsync(String, String, CancellationToken)

Creates a directory- Creates an entry for the directory in the internal dictionary

CreateFile(String, IfExists, String, Boolean)

Creates an entry to the internal dictionary for the new file. The entry encapsulates AclStatus, DirectoryEntry and a memory stream

CreateFileAsync(String, IfExists, String, Boolean, CancellationToken)

Creates an entry to the internal dictionary for the new file. The entry encapsulates AclStatus, DirectoryEntry and a memory stream

Delete(String, CancellationToken)

Delete an entry from the internal dictionary

DeleteAsync(String, CancellationToken)

Delete an entry from the internal dictionary

DeleteRecursive(String, CancellationToken)

Deletes all entries within a directory or delete a file

DeleteRecursiveAsync(String, CancellationToken)

Deletes all entries within a directory or delete a file

EnumerateDeletedItems(String, String, Int32, IProgress<EnumerateDeletedItemsProgress>, CancellationToken)

Search trash under a account with hint and a starting point. This is a long running operation, and user is updated with progress periodically.

EnumerateDeletedItemsAsync(String, String, Int32, IProgress<EnumerateDeletedItemsProgress>, CancellationToken)

Asynchronously gets the trash entries

EnumerateDirectory(String, UserGroupRepresentation, CancellationToken)

Returns a list of entries contained under the given directory

GetAclStatus(String, UserGroupRepresentation, CancellationToken)

Gets the ACL entry list, owner ID, group ID, octal permission and sticky bit (only for a directory) of the file/directory

GetAclStatusAsync(String, UserGroupRepresentation, CancellationToken)

Gets the ACL entry list, owner ID, group ID, octal permission and sticky bit (only for a directory) of the file/directory

GetAppendStream(String, CancellationToken)

Returns the memory stream for appending to the file encapsulated in mock adls output stream.

GetAppendStreamAsync(String, CancellationToken)

Returns the memory stream for appending to the file encapsulated in mock adls output stream.

GetContentSummary(String, Int32, CancellationToken)

Currently the recursive entities need to be created separately for mock testing

GetDirectoryEntry(String, UserGroupRepresentation, CancellationToken)

Get Directory or file info

GetDirectoryEntryAsync(String, UserGroupRepresentation, CancellationToken)

Get Directory or file info

GetExceptionFromResponse(OperationResponse, String)

Returns a ADLS Exception based on response from the server

(Inherited from AdlsClient)
GetFileProperties(String, Boolean, String, Boolean, Boolean, Int32, Boolean, Boolean, Int64, CancellationToken)

Gets fileproperties, conmsistentacl is always true since this is mock

GetHttpClientForCert()

This method needs to be overriden by inheriting class to provide a ideal solution of reusing httclients. Inheriting class has to dispose of the previous httpclient and then get a new httpclient

(Inherited from AdlsClient)
GetMockClient()

Factory method that returns an instance of Mock adls client

GetMockClient(String)

Factory method that returns an instance of Mock adls client

GetReadStream(String, CancellationToken)

Returns a memory stream for reading data of the file

GetReadStream(String, Int32, CancellationToken)

Synchronous API that returns the stream to read data from file in ADLS

(Inherited from AdlsClient)
GetReadStreamAsync(String, CancellationToken)

Returns a memory stream for reading data of the file

GetReadStreamAsync(String, Int32, CancellationToken)

Asynchronous API that returns the stream to read data from file in ADLS

(Inherited from AdlsClient)
ModifyAclEntries(String, List<AclEntry>, CancellationToken)

Adds acl entries for a given path

ModifyAclEntriesAsync(String, List<AclEntry>, CancellationToken)

Adds acl entries for a given path

RemoveAclEntries(String, List<AclEntry>, CancellationToken)

Removes specified Acl Entries for a file or directory from the internal AclStatus maintained in memory.

RemoveAclEntriesAsync(String, List<AclEntry>, CancellationToken)

Removes specified Acl Entries for a file or directory from the internal AclStatus maintained in memory.

RemoveAllAcls(String, CancellationToken)

Removes all Acl Entries for a file or directory from the internal AclStatus maintained in memory.

RemoveAllAclsAsync(String, CancellationToken)

Removes all Acl Entries for a file or directory from the internal AclStatus maintained in memory.

RemoveDefaultAcls(String, CancellationToken)

Removes all Acl Entries of AclScope default for a file or directory from the internal AclStatus maintained in memory.

RemoveDefaultAclsAsync(String, CancellationToken)

Removes all Acl Entries of AclScope default for a file or directory from the internal AclStatus maintained in memory.

Rename(String, String, Boolean, CancellationToken)

Removes the source entry and add a new entry in the internal dictionary with the same metadata of the source entry

RenameAsync(String, String, Boolean, CancellationToken)

Removes the source entry and add a new entry in the internal dictionary with the same metadata of the source entry

RestoreDeletedItems(String, String, String, String, CancellationToken)

Synchronously Restores trash entry

RestoreDeletedItemsAsync(String, String, String, String, CancellationToken)

Asynchronously Restores trash entry

SetAcl(String, List<AclEntry>, CancellationToken)

Sets new acl entries for the given path.

SetAclAsync(String, List<AclEntry>, CancellationToken)

Sets new acl entries for the given path.

SetConditionalCreateWithOverwrite(Boolean)

Sets whether to perform conditional create with overwrite. Helps resolving atomic issues with retries

(Inherited from AdlsClient)
SetExpiryTime(String, ExpiryOption, Int64, CancellationToken)

Sets the expiry time for the file.

SetExpiryTimeAsync(String, ExpiryOption, Int64, CancellationToken)

Sets the expiry time for the file.

SetOwner(String, String, String, CancellationToken)

Sets the owner and group of the path

SetOwnerAsync(String, String, String, CancellationToken)

Sets the owner and group of the path

SetPermission(String, String, CancellationToken)

Sets the permission string for the given path

SetPermissionAsync(String, String, CancellationToken)

Sets the permission string for the given path

SetPerRequestTimeout(TimeSpan)

Sets the per request timeout. Highly recommended to set it after creating client. Not recommended to set it while requests are underway from a different thread.

(Inherited from AdlsClient)
SetToken(String)

Sets the auth token.

(Inherited from AdlsClient)

Applies to