C# Class Microsoft.Protocols.TestSuites.MS_WOPI.MS_WOPIAdapter

The implementation of the IMS_WOPIAdapter interface.
Inheritance: Microsoft.Protocols.TestTools.ManagedAdapterBase, IMS_WOPIAdapter
Show file Open project: OfficeDev/Interop-TestSuites

Public Methods

Method Description
CheckFileInfo ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiSessionContextValue ) : WOPIHttpResponse

This method is used to return the file information including file properties and permissions for the user who is identified by token that is sent in the request.

CheckFolderInfo ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiSessionContextValue ) : WOPIHttpResponse

This method is used to return information about folder and permissions for the user which is determined by "targetResourceUrl" parameter and the "Authorization" header in "commonHeaders" parameter.

DeleteFile ( string targetResourceUrl, WebHeaderCollection commonHeaders ) : WOPIHttpResponse

This method is used to delete a file.

EnumerateChildren ( string targetResourceUrlOfFloder, WebHeaderCollection commonHeaders ) : WOPIHttpResponse

This method is used to return the contents of a folder on the WOPI server.

GetFile ( string targetResourceUrl, WebHeaderCollection commonHeaders, int maxExpectedSize ) : WOPIHttpResponse

This method is used to get a file.

GetRestrictedLink ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiRestrictedLink ) : WOPIHttpResponse

This method is used to get a link to a file though which a user is able to operate on a file in a limited way.

Initialize ( ITestSite testSite ) : void

The Overridden Initialize method, it includes the initialization logic of this adapter.

Lock ( string targetResourceUrl, WebHeaderCollection commonHeaders, string lockIdentifierValue ) : WOPIHttpResponse

This method is used to take a lock for editing a file.

PutFile ( string targetResourceUrl, WebHeaderCollection commonHeaders, int xwopiSize, byte bodyContents, string lockIdentifierOfFile ) : WOPIHttpResponse

This method is used to update a file on the WOPI server.

PutRelativeFile ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiSuggestedTarget, string xwopiRelativeTarget, byte bodyContents, bool xwopiOverwriteRelativeTarget, int xwopiSize ) : WOPIHttpResponse

This method is used to create a file on the WOPI server based on the current file.

ReadSecureStore ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiApplicationId ) : WOPIHttpResponse

This method is used to access the WOPI server's implementation of a secure store.

RefreshLock ( string targetResourceUrl, WebHeaderCollection commonHeaders, string lockIdentifierOfRefreshLock ) : WOPIHttpResponse

This method is used to release the existing lock for modifying a file.

RevokeRestrictedLink ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiRestrictedLink ) : WOPIHttpResponse

This method is used to revoke all links to a file through which a number of users are able to operate on a file in a limited way.

UnLock ( string targetResourceUrl, WebHeaderCollection commonHeaders, string lockIdentifierOfFile ) : WOPIHttpResponse

This method is used to release a lock for editing a file.

UnlockAndRelock ( string targetResourceUrl, WebHeaderCollection commonHeaders, string lockIdentifierValue, string lockIdentifierOldValue ) : WOPIHttpResponse

This method is used to refresh and retake a lock for editing a file.

Protected Methods

Method Description
GetWebExceptionHeadersValue ( WebException webException ) : string

A method is used to get the headers value from a web exception's http response.

RecordWebExceptionInformation ( string targetResourceUrl, WOPIOperationName wopiOperationName, WebException webException ) : void

A method is used to record information about web exception which is thrown by calling protocol operations.

SendWOPIRequest ( string targetResourceUrl, WebHeaderCollection headers, byte body, WOPIOperationName operationName ) : WOPIHttpResponse

A method is used to send http request for MS-WOPI operation.

Private Methods

Method Description
GetHttpMethodForWOPIOperation ( WOPIOperationName operationName ) : string

A method used to get the HTTP method value according to the WOPI operation name.

GetTheXWOPIOverrideHeaderValue ( WOPIOperationName operationName ) : string

A method is used to get the X-WOPI-Override header value according to the operation name.

LogHttpTransportInfo ( HttpWebRequest wopiRequest, byte requestBody, WOPIHttpResponse wopiResponse, WOPIOperationName operationName, bool isResponse = true ) : void

A method used to log the HTTP transport information.

OutPutHeadersValue ( WebHeaderCollection headers ) : string

A method is used to out put headers values into a string value.

ValidateCheckFileInfoResponse ( WOPIHttpResponse response ) : void

This method is used to validate CheckFileInfo response captures.

ValidateCheckFolderInfoResponse ( WOPIHttpResponse response ) : void

This method is used to validate CheckFolderInfo response captures.

ValidateCommonMessageCapture ( ) : void

This method is used to validate all common captures for adapter. These captures are applied for all messages.

ValidateEnumerateChildrenResponse ( WOPIHttpResponse response ) : void

This method is used to validate EnumerateChildren response captures.

ValidateFileContentCapture ( ) : void

This method is used to validate all about file content requests adapter capture.

ValidateFilesCapture ( ) : void

This method is used to validate all adapter requirements for file level operations.

ValidateFoldersCapture ( ) : void

This method is used to validate all about folder requests capture adapter.

ValidateLockResponse ( WOPIHttpResponse response ) : void

This method is used to validate Lock response captures.

ValidatePutRelativeFileResponse ( WOPIHttpResponse response ) : void

This method is used to validate PutRelativeFile response captures.

ValidateReadSecureStoreResponse ( WOPIHttpResponse response ) : void

This method is used to validate ReadSecureStore response captures.

ValidateURL ( string urlValue, string urlName ) : void

A method used to validate the specified URL value whether is a valid URL format. It the value is not a valid URL format, this method will raise an "Assert.Fail" exception.

Method Details

CheckFileInfo() public method

This method is used to return the file information including file properties and permissions for the user who is identified by token that is sent in the request.
public CheckFileInfo ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiSessionContextValue ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
xwopiSessionContextValue string A parameter represents the value of the session context information.
return WOPIHttpResponse

CheckFolderInfo() public method

This method is used to return information about folder and permissions for the user which is determined by "targetResourceUrl" parameter and the "Authorization" header in "commonHeaders" parameter.
public CheckFolderInfo ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiSessionContextValue ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
xwopiSessionContextValue string A parameter represents the value of the session context information.
return WOPIHttpResponse

DeleteFile() public method

This method is used to delete a file.
public DeleteFile ( string targetResourceUrl, WebHeaderCollection commonHeaders ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
return WOPIHttpResponse

EnumerateChildren() public method

This method is used to return the contents of a folder on the WOPI server.
public EnumerateChildren ( string targetResourceUrlOfFloder, WebHeaderCollection commonHeaders ) : WOPIHttpResponse
targetResourceUrlOfFloder string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
return WOPIHttpResponse

GetFile() public method

This method is used to get a file.
public GetFile ( string targetResourceUrl, WebHeaderCollection commonHeaders, int maxExpectedSize ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
maxExpectedSize int A parameter represents the specifying upper bound size of the file being requested.
return WOPIHttpResponse

GetRestrictedLink() public method

This method is used to get a link to a file though which a user is able to operate on a file in a limited way.
public GetRestrictedLink ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiRestrictedLink ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
xwopiRestrictedLink string A parameter represents the type of restricted link being request by WOPI client.
return WOPIHttpResponse

GetWebExceptionHeadersValue() protected method

A method is used to get the headers value from a web exception's http response.
protected GetWebExceptionHeadersValue ( WebException webException ) : string
webException System.Net.WebException A parameter represents the web exception instance.
return string

Initialize() public method

The Overridden Initialize method, it includes the initialization logic of this adapter.
public Initialize ( ITestSite testSite ) : void
testSite ITestSite The ITestSite member of ManagedAdapterBase
return void

Lock() public method

This method is used to take a lock for editing a file.
public Lock ( string targetResourceUrl, WebHeaderCollection commonHeaders, string lockIdentifierValue ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
lockIdentifierValue string A parameter represents the value which is provided by WOPI client that WOPI server used to identify the lock on the file.
return WOPIHttpResponse

PutFile() public method

This method is used to update a file on the WOPI server.
public PutFile ( string targetResourceUrl, WebHeaderCollection commonHeaders, int xwopiSize, byte bodyContents, string lockIdentifierOfFile ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
xwopiSize int A parameter represents the size of the request body.
bodyContents byte A parameter represents the body contents of the request.
lockIdentifierOfFile string A parameter represents the value which is provided by WOPI client that WOPI server used to identify the lock on the file.
return WOPIHttpResponse

PutRelativeFile() public method

This method is used to create a file on the WOPI server based on the current file.
public PutRelativeFile ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiSuggestedTarget, string xwopiRelativeTarget, byte bodyContents, bool xwopiOverwriteRelativeTarget, int xwopiSize ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
xwopiSuggestedTarget string A parameter represents the file name in order to create a file.
xwopiRelativeTarget string A parameter represents the file name of the current file.
bodyContents byte A parameter represents the body contents of the request.
xwopiOverwriteRelativeTarget bool A parameter represents the value that specifies whether the host overwrite the file name if it exists.
xwopiSize int A parameter represents the size of the file.
return WOPIHttpResponse

ReadSecureStore() public method

This method is used to access the WOPI server's implementation of a secure store.
public ReadSecureStore ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiApplicationId ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
xwopiApplicationId string A parameter represents the value of application ID.
return WOPIHttpResponse

RecordWebExceptionInformation() protected method

A method is used to record information about web exception which is thrown by calling protocol operations.
protected RecordWebExceptionInformation ( string targetResourceUrl, WOPIOperationName wopiOperationName, WebException webException ) : void
targetResourceUrl string A parameter represents the request URL which cause a web exception.
wopiOperationName WOPIOperationName A parameter represents the protocol operation name which sends a http request and then get a web exception.
webException System.Net.WebException A parameter represents web exception instance.
return void

RefreshLock() public method

This method is used to release the existing lock for modifying a file.
public RefreshLock ( string targetResourceUrl, WebHeaderCollection commonHeaders, string lockIdentifierOfRefreshLock ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
lockIdentifierOfRefreshLock string A parameter represents the value which is provided by WOPI client that WOPI server used to identify the lock on the file.
return WOPIHttpResponse

RevokeRestrictedLink() public method

This method is used to revoke all links to a file through which a number of users are able to operate on a file in a limited way.
public RevokeRestrictedLink ( string targetResourceUrl, WebHeaderCollection commonHeaders, string xwopiRestrictedLink ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
xwopiRestrictedLink string A parameter represents the type of restricted link being revoked by WOPI client.
return WOPIHttpResponse

SendWOPIRequest() protected method

A method is used to send http request for MS-WOPI operation.
protected SendWOPIRequest ( string targetResourceUrl, WebHeaderCollection headers, byte body, WOPIOperationName operationName ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource Uri.
headers System.Net.WebHeaderCollection A parameter represents the headers which is included in the http request.
body byte A parameter represents the body contents which is sent in the http request.
operationName WOPIOperationName A parameter represents the WOPI operation which the http request belongs to.
return WOPIHttpResponse

UnLock() public method

This method is used to release a lock for editing a file.
public UnLock ( string targetResourceUrl, WebHeaderCollection commonHeaders, string lockIdentifierOfFile ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
lockIdentifierOfFile string A parameter represents the value which is provided by WOPI client that WOPI server used to identify the lock on the file.
return WOPIHttpResponse

UnlockAndRelock() public method

This method is used to refresh and retake a lock for editing a file.
public UnlockAndRelock ( string targetResourceUrl, WebHeaderCollection commonHeaders, string lockIdentifierValue, string lockIdentifierOldValue ) : WOPIHttpResponse
targetResourceUrl string A parameter represents the target resource URL.
commonHeaders System.Net.WebHeaderCollection A parameter represents the common headers that contain "Authorization" header and etc.
lockIdentifierValue string A parameter represents the value which is provided by WOPI client that WOPI server used to identify the lock on the file.
lockIdentifierOldValue string A parameter represents the value which is previously provided by WOPI client that WOPI server used to identify the lock on the file.
return WOPIHttpResponse