/// <summary> /// This method is used to record the Editors Table status with specified client ID and editorsTableType for the file URL. /// </summary> /// <param name="fileUrl">Specify the file URL which get the file we use.</param> /// <param name="clientId">Specify the client ID of the editors table.</param> /// <param name="userName">Specify the user name of the user who calls cell storage service.</param> /// <param name="password">Specify the password of the user who calls cell storage service.</param> /// <param name="domain">Specify the domain of the user who calls cell storage service.</param> public void RecordEditorTable(string fileUrl, string clientId, string userName, string password, string domain) { Action function = () => { EditorsTableSubRequestType ets = new EditorsTableSubRequestType(); ets.Type = SubRequestAttributeType.EditorsTable; ets.SubRequestData = new EditorsTableSubRequestDataType(); ets.SubRequestData.ClientID = clientId; ets.SubRequestData.EditorsTableRequestTypeSpecified = true; ets.SubRequestData.EditorsTableRequestType = EditorsTableRequestTypes.LeaveEditingSession; ets.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString(); IMS_FSSHTTP_FSSHTTPBAdapter adapter = site.GetAdapter <IMS_FSSHTTP_FSSHTTPBAdapter>(); this.intializeContext(fileUrl, userName, password, domain); EditorsTableSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <EditorsTableSubResponseType>(adapter.CellStorageRequest(fileUrl, new SubRequestType[] { ets }), 0, 0, site); if (!string.Equals("Success", subResponse.ErrorCode, StringComparison.OrdinalIgnoreCase)) { this.errorMessage.Add(string.Format("Failed to release the editor tables join status for the client id {1} on the file {0} using the following user: {2}/{3}and password:{4}", fileUrl, clientId, userName, domain, password)); this.isEnvironmentRollbackSuccess = false; } }; this.AddOrUpdate(new SharedLockKey(fileUrl, clientId, string.Empty), function); }
/// <summary> /// Capture requirements related to EditorsTable sub response. /// </summary> /// <param name="editorsTableSubResponse">Containing the EditorsTableSubResponse information.</param> /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param> public static void ValidateEditorsTableSubResponse(EditorsTableSubResponseType editorsTableSubResponse, ITestSite site) { ValidateSubResponseType(editorsTableSubResponse as SubResponseType, site); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4693 // if can launch this method, the schema matches. site.CaptureRequirementIfAreEqual <Type>( typeof(EditorsTableSubResponseType), editorsTableSubResponse.GetType(), "MS-FSSHTTP", 4693, @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: EditorsTableSubResponseType."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R5747 // if can launch this method, the schema matches. site.CaptureRequirementIfAreEqual <Type>( typeof(EditorsTableSubResponseType), editorsTableSubResponse.GetType(), "MS-FSSHTTP", 5747, @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: EditorsTableSubResponseType."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1769 // if can launch this method, the schema matches. site.CaptureRequirement( "MS-FSSHTTP", 1769, @"[In EditorsTableSubResponseType][The schema of EditorsTableSubResponseType is] <xs:complexType name=""EditorsTableSubResponseType""> <xs:complexContent> <xs:extension base=""tns:SubResponseType""> <xs:sequence minOccurs=""0"" maxOccurs=""1""> <xs:element name=""SubResponseData""> <xs:complexType> <xs:complexContent> <xs:restriction base=""xs:anyType""/> </xs:complexContent> </xs:complexType> </xs:element> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3079 // if can launch this method, the schema matches. site.CaptureRequirement( "MS-FSSHTTP", 3079, @"[In EditorsTableSubResponseType] SubResponseData: It MUST be an empty element without any attributes."); }
public void MSFSSHTTP_FSSHTTPB_S07_TC01_EditorsTable_FileNotExistsOrCannotBeCreated() { if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 9001, this.Site)) { Site.Assume.Inconclusive("Implementation does not support the editors table."); } // Create a join editor session with the URL which could not be found. string url = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site); // Initialize the service this.InitializeContext(url, this.UserName01, this.Password01, this.Domain); EditorsTableSubRequestType join = SharedTestSuiteHelper.CreateEditorsTableSubRequestForJoinSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.DefaultTimeOut); // Call protocol adapter operation CellStorageRequest to join the editing session. CellStorageResponse cellStorageResponseJoin = this.Adapter.CellStorageRequest(url, new SubRequestType[] { join }); EditorsTableSubResponseType subResponseJoin = SharedTestSuiteHelper.ExtractSubResponse <EditorsTableSubResponseType>(cellStorageResponseJoin, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the ErrorCode attribute returned equals "FileNotExistsOrCannotBeCreated", MS-FSSHTTP_R1971 and MS-FSSHTTP_R358 can be covered. Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponseJoin.ErrorCode, this.Site), "MS-FSSHTTP", 1971, @"[In EditorsTable Subrequest] If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element."); Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponseJoin.ErrorCode, this.Site), "MS-FSSHTTP", 358, @"[In GenericErrorCodeTypes] FileNotExistsOrCannotBeCreated indicates an error when either the targeted URL for the file specified as part of the Request element does not exist or file creation failed on the protocol server."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponseJoin.ErrorCode, this.Site), @"[In GenericErrorCodeTypes] FileNotExistsOrCannotBeCreated indicates an error when either the targeted URL for the file specified as part of the Request element does not exist or file creation failed on the protocol server."); } }
/// <summary> /// This method is used to prepare to join a editors table on the file using the specified client id. /// </summary> /// <param name="fileUrl">Specify the file.</param> /// <param name="clientId">Specify the client ID.</param> /// <param name="userName">Specify the user name of the user who calls cell storage service.</param> /// <param name="password">Specify the password of the user who calls cell storage service.</param> /// <param name="domain">Specify the domain of the user who calls cell storage service.</param> /// <param name="timeout">Specify the timeout value.</param> protected void PrepareJoinEditorsTable(string fileUrl, string clientId, string userName, string password, string domain, int timeout = SharedTestSuiteHelper.DefaultTimeOut) { this.InitializeContext(fileUrl, userName, password, domain); // Create join editor session object. EditorsTableSubRequestType joinEditorTable = SharedTestSuiteHelper.CreateEditorsTableSubRequestForJoinSession(clientId, timeout); // Call protocol adapter operation CellStorageRequest with EditorsTableRequestType JoinEditingSession. CellStorageResponse response = this.Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { joinEditorTable }); EditorsTableSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <EditorsTableSubResponseType>(response, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), "The user {0} uses the client id {1} to join the editor table should succeed.", userName, clientId); this.StatusManager.RecordEditorTable(this.DefaultFileUrl, clientId); }