public void MSFSSHTTP_FSSHTTPB_S04_TC06_ExclusiveLock_FileNotExistsOrCannotBeCreated() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); string notExistsFileUrl = this.DefaultFileUrl.Substring(0, this.DefaultFileUrl.LastIndexOf('/')) + "/noexistsFile.txt"; ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); // Get the exclusive lock with nonexistent file URL and expect the server returns error code "LockRequestFail" or "Unknown". CellStorageResponse response = this.Adapter.CellStorageRequest(notExistsFileUrl, new SubRequestType[] { subRequest }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); ErrorCodeType errorType = SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site); bool isR1926Verified = errorType == ErrorCodeType.LockRequestFail || errorType == ErrorCodeType.Unknown || errorType == ErrorCodeType.FileNotExistsOrCannotBeCreated; this.Site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R1926, expect the error code LockRequestFail or Unknown or FileNotExistsOrCannotBeCreated, but actually error code is " + errorType); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1926 Site.CaptureRequirementIfIsTrue( isR1926Verified, "MS-FSSHTTP", 1926, @"[In ExclusiveLock Subrequest][The protocol returns results based on the following conditions: ] 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 ""LockRequestFail "" or ""Unknown"" or ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element."); } else { Site.Assert.IsTrue( isR1926Verified, @"[In ExclusiveLock Subrequest][The protocol returns results based on the following conditions: ] 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 ""LockRequestFail "" or ""Unknown"" or ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element."); } }
public void TestCase_S10_TC01_SubRequestToken() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); ExclusiveLockSubRequestType exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); // Update the file contents when the coalesce is true. CellSubRequestType putChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedPutChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(10))); putChange.SubRequestData.CoalesceSpecified = true; putChange.SubRequestData.Coalesce = true; CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { exclusiveLocksubRequest, putChange }); int exclusiveIndex = 0; int putchangeIndex = 0; for (int i = 0; i < response.ResponseCollection.Response[0].SubResponse.Length; i++) { if (response.ResponseCollection.Response[0].SubResponse[i].SubRequestToken == exclusiveLocksubRequest.SubRequestToken) { exclusiveIndex = i; } else if (response.ResponseCollection.Response[0].SubResponse[i].SubRequestToken == putChange.SubRequestToken) { putchangeIndex = i; } } ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, exclusiveIndex, this.Site); CellSubResponseType putChangeResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, putchangeIndex, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "Test case cannot continue unless the get lock sub request succeeds."); this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, exclusiveLocksubRequest.SubRequestData.ExclusiveLockID); this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(putChangeResponse.ErrorCode, this.Site), "Test case cannot continue unless the put changes sub request succeeds."); this.Site.Assert.AreEqual <int>( int.Parse(exclusiveLocksubRequest.SubRequestToken), int.Parse(exclusiveResponse.SubRequestToken), "Test case cannot run unless the put change response token equals the expected sub request token."); this.Site.Assert.AreEqual <int>( int.Parse(putChange.SubRequestToken), int.Parse(putChangeResponse.SubRequestToken), "Test case cannot run unless the put change response token equals the expected sub request token."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If both the subRequest tokens are mapping, then MS-FSSHTTP_R1484 and MS-FSSHTTP_R283 can be captured. Site.CaptureRequirement( "MS-FSSHTTP", 1484, @"[In SubResponseType] SubRequestToken: If client sends 2 SubRequest elements in the Request, in the server response, SubRequestToken uniquely identifies the 2 SubRequest element whose subresponse is being generated as part of the SubResponse element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R283 Site.CaptureRequirement( "MS-FSSHTTP", 283, @"[In SubResponseType][SubRequestToken] The mapping subresponse that gets generated for the subrequest references the SubRequestToken to indicate that it is the response for that subrequest."); } }
public void MSFSSHTTP_FSSHTTPB_S04_TC05_ConvertToSchema_ConvertToSchemaFailedFileCheckedOutByCurrentUser() { // Check out one file by a specified user name. if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password{2}", this.DefaultFileUrl, this.UserName01, this.UserName01); } // Record the file check out status. this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); CheckLockAvailability(); // Get the exclusive lock with same user name on the checked out file. this.PrepareExclusiveLock(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultExclusiveLockID); // Convert the current exclusive lock to a coauthoring shared lock on the already check out file, expect the server returns the error code "ConvertToSchemaFailedFileCheckedOutByCurrentUser". ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.ConvertToSchema); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error code equals "FailedFileCheckedOutByCurrentUser", then capture MS-FSSHTTP_R1230,MS-FSSHTTP_R1949 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1230, @"[In ExclusiveLock Subrequest][If the protocol server gets an exclusive lock subrequest of type ""Convert to schema lock with] ""Convert to schema lock"" for a file, and the conversion fails because the file is checked out by the current client, the protocol server returns an error code value set to ""ConvertToSchemaFailedFileCheckedOutByCurrentUser""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1299 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1299, @"[In Convert to Schema Lock] The protocol server returns error codes according to the following rules: If the protocol server is unable to convert the exclusive lock to a shared lock on the file because the file is checked out by the current user, the protocol server returns an error code value set to ""ConvertToSchemaFailedFileCheckedOutByCurrentUser""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R387 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 387, @"[In LockAndCoauthRelatedErrorCodeTypes] ConvertToSchemaFailedFileCheckedOutByCurrentUser indicates an error when converting to a shared lock fails because the file is checked out by the current client."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), @"[In ExclusiveLock Subrequest][If the protocol server gets an exclusive lock subrequest of type ""Convert to schema lock with] ""Convert to schema lock"" for a file, and the conversion fails because the file is checked out by the current client, the protocol server returns an error code value set to ""ConvertToSchemaFailedFileCheckedOutByCurrentUser""."); } }
public void TestCase_S17_TC01_FileOperation_Success() { // Initialize the context using user01 and defaultFileUrl. this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Get the exclusive lock with all valid parameters, expect the server responses the error code "Success". ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); CellStorageResponse cellStoreageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "Test case cannot continue unless the Get Lock of ExclusiveLock sub request succeeds."); // Record the current file status. this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, subRequest.SubRequestData.ExclusiveLockID); string fileName = this.DefaultFileUrl.Substring(this.DefaultFileUrl.LastIndexOf("/", StringComparison.OrdinalIgnoreCase) + 1); string newName = Common.GenerateResourceName(this.Site, "fileName") + ".txt"; FileOperationSubRequestType fileOperationSubRequest = SharedTestSuiteHelper.CreateFileOperationSubRequest(FileOperationRequestTypes.Rename, newName, SharedTestSuiteHelper.DefaultExclusiveLockID, this.Site); cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { fileOperationSubRequest }); FileOperationSubResponseType fileOperationSubResponse = SharedTestSuiteHelper.ExtractSubResponse <FileOperationSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(fileOperationSubResponse, "The object 'versioningSubResponse' should not be null."); this.Site.Assert.IsNotNull(fileOperationSubResponse.ErrorCode, "The object 'versioningSubResponse.ErrorCode' should not be null."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11146 Site.CaptureRequirementIfAreEqual <string>( "Success", fileOperationSubResponse.ErrorCode, "MS-FSSHTTP", 11109, @"[In FileOperationSubRequestDataType] This parameter [ExclusiveLockID] is used to validate that the file operation can be performed even though the file is under exclusive lock."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11120 // This requirement can be captured directly after capturing MS-FSSHTTP_R11109 Site.CaptureRequirement( "MS-FSSHTTP", 11120, @"[In FileOperationSubResponseType] In the case of success, it contains information requested as part of a file operation subrequest."); } else { Assert.AreEqual <string>( "Success", fileOperationSubResponse.ErrorCode, "MS-FSSHTTP", @"[In FileOperationSubRequestDataType] This parameter [ExclusiveLockID] is used to validate that the file operation can be performed even though the file is under exclusive lock."); } }
public void MSFSSHTTP_FSSHTTPB_S04_TC07_ExclusiveLock_CellStorageWebServiceDisabled() { Site.Assume.IsTrue(Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 15181, this.Site), "This test case only runs when WebServiceTurnedOff is returned if this protocol is not enabled on server."); if (!this.SutPowerShellAdapter.SwitchCellStorageService(false)) { this.Site.Assert.Fail("Cannot disable the cell storage web service."); } this.StatusManager.RecordDisableCellStorageService(); // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Call the GetExclusiveLock to expect fail. ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); this.Site.Log.Add( LogEntryKind.Debug, "When the cell storage service is turned off, the error code should be not null but actual {0}", response.ResponseVersion.ErrorCodeSpecified ? "is not null" : "null"); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R15181 Site.CaptureRequirementIfIsTrue( response.ResponseVersion.ErrorCodeSpecified, "MS-FSSHTTP", 15181, @"[In ResponseVersion] This attribute[ErrorCode] MUST be present if any one of the following is true. This protocol is not enabled on the protocol server."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R368 Site.CaptureRequirementIfAreEqual <GenericErrorCodeTypes>( GenericErrorCodeTypes.WebServiceTurnedOff, response.ResponseVersion.ErrorCode, "MS-FSSHTTP", 368, @"[In GenericErrorCodeTypes] WebServiceTurnedOff indicates an error when the web service is turned off during the processing of the cell storage service request."); } else { Site.Assert.IsTrue( response.ResponseVersion.ErrorCodeSpecified, @"[In ResponseVersion] This attribute[ErrorCode] MUST be present if any one of the following is true. This protocol is not enabled on the protocol server."); Site.Assert.AreEqual <GenericErrorCodeTypes>( GenericErrorCodeTypes.WebServiceTurnedOff, response.ResponseVersion.ErrorCode, @"[In GenericErrorCodeTypes] WebServiceTurnedOff indicates an error when the web service is turned off during the processing of the cell storage service request."); } }
public void MSFSSHTTP_FSSHTTPB_S04_TC02_GetExclusiveLock_CheckoutByCurrentClient() { // Check out one file by a specified user name. if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password{2}", this.DefaultFileUrl, this.UserName01, this.Password01); } // Record the file check out status. this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3086, this.Site)) { // Change the authentication mode if (!this.SutPowerShellAdapter.SwitchClaimsAuthentication(false)) { this.Site.Assert.Fail("Cannot change the authentication mode to windows based."); } this.StatusManager.RecordDisableClaimsBasedAuthentication(); } // Initialize the service. this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); CheckLockAvailability(); // Get the exclusive lock using the same user name comparing with the previous step for the already checked out file, expect the server responds the error code "Success". // Now the service channel is initialized using the userName01 account by default. ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error code equals "Success", then capture MS-FSSHTTP_R1247 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1247, @"[In Get Lock] If the checkout of the file has been done by the current client, the protocol server MUST allow an exclusive lock on the file."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), @"[In Get Lock] If the checkout of the file has been done by the current client, the protocol server MUST allow an exclusive lock on the file."); } // Record the file exclusive lock status. this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, subRequest.SubRequestData.ExclusiveLockID); }
public void TestCase_S10_TC04_DependencyTypeOnNotSupported_Support() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); ExclusiveLockSubRequestType exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); // Update the file contents when the coalesce is true. CellSubRequestType putChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedPutChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(10))); putChange.SubRequestData.CoalesceSpecified = true; putChange.SubRequestData.Coalesce = true; // Make a putChanges subRequest dependent on the exclusive lock and the dependency type is OnNotSupported. putChange.DependencyTypeSpecified = true; putChange.DependencyType = DependencyTypes.OnNotSupported; putChange.DependsOn = exclusiveLocksubRequest.SubRequestToken; CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { exclusiveLocksubRequest, putChange }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); CellSubResponseType putChanges = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 1, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "Test case cannot continue unless the get lock sub request succeeds."); this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, exclusiveLocksubRequest.SubRequestData.ExclusiveLockID); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error code equals DependentOnlyOnNotSupportedRequestGetSupported, then capture R324 and R2244 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.DependentOnlyOnNotSupportedRequestGetSupported, SharedTestSuiteHelper.ConvertToErrorCodeType(putChanges.ErrorCode, this.Site), "MS-FSSHTTP", 324, @"[In DependencyCheckRelatedErrorCodeTypes] DependentOnlyOnNotSupportedRequestGetSupported: Indicates an error when the subrequest on which this specific subrequest is dependent is supported and the DependencyType attribute in this subrequest is set to ""OnNotSupported"" or [""OnSuccessOrOnNotSupported""]."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2244 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.DependentOnlyOnNotSupportedRequestGetSupported, SharedTestSuiteHelper.ConvertToErrorCodeType(putChanges.ErrorCode, this.Site), "MS-FSSHTTP", 2244, @"[In DependencyTypes] OnNotSupported: Indicates that the subrequest MUST NOT be processed if the other subrequest is supported."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.DependentOnlyOnNotSupportedRequestGetSupported, SharedTestSuiteHelper.ConvertToErrorCodeType(putChanges.ErrorCode, this.Site), @"[In DependencyCheckRelatedErrorCodeTypes] DependentOnlyOnNotSupportedRequestGetSupported: Indicates an error when the subrequest on which this specific subrequest is dependent is supported and the DependencyType attribute in this subrequest is set to ""OnNotSupported"" or [""OnSuccessOrOnNotSupported""]."); } }
public void MSFSSHTTP_FSSHTTPB_S04_TC08_ExclusiveLock_NoPermissionIssueCellStorageService() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, Common.GetConfigurationPropertyValue("NoPermisionToUseRemoteInterfaceUser", this.Site), Common.GetConfigurationPropertyValue("NoPermisionToUseRemoteInterfaceUserPwd", this.Site), this.Domain); ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); this.Site.Log.Add( LogEntryKind.Debug, "When the user {0} does not have permission to use remote service, the error code should be not null but actual {1}", Common.GetConfigurationPropertyValue("NoPermisionToUseRemoteInterfaceUser", this.Site), response.ResponseVersion.ErrorCodeSpecified ? "is not null" : "null"); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 15171, this.Site)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R15171 Site.CaptureRequirementIfIsTrue( response.ResponseVersion.ErrorCodeSpecified, "MS-FSSHTTP", 15171, @"[In ResponseVersion] This attribute[ErrorCode] MUST be present if any one of the following is true. The user does not have permission to issue a cell storage service request to the file identified by the Url attribute of the Request element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R359 Site.CaptureRequirementIfAreEqual <GenericErrorCodeTypes>( GenericErrorCodeTypes.FileUnauthorizedAccess, response.ResponseVersion.ErrorCode, "MS-FSSHTTP", 359, @"[In GenericErrorCodeTypes] FileUnauthorizedAccess indicates an error when the targeted URL for the file specified as part of the Request element does not have correct authorization."); } } else { Site.Assert.IsTrue( response.ResponseVersion.ErrorCodeSpecified, @"[In ResponseVersion] This attribute[ErrorCode] MUST be present if any one of the following is true. The user does not have permission to issue a cell storage service request to the file identified by the URL attribute of the Request element."); Site.Assert.AreEqual <GenericErrorCodeTypes>( GenericErrorCodeTypes.FileUnauthorizedAccess, response.ResponseVersion.ErrorCode, @"[In GenericErrorCodeTypes] FileUnauthorizedAccess indicates an error when the targeted URL for the file specified as part of the Request element does not have correct authorization."); } }
/// <summary> /// This method is used to test whether the exclusive lock with the specified id exist on the file. /// </summary> /// <param name="file">Specify the file.</param> /// <param name="exclusiveLockId">Specify the exclusive lock.</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> /// <returns>Return true if exist, otherwise return false.</returns> protected bool CheckExclusiveLockExist(string file, string exclusiveLockId, string userName, string password, string domain) { this.InitializeContext(file, userName, password, domain); // Generate a new schema lock id value which is different with the given one. System.Guid newId; do { newId = System.Guid.NewGuid(); }while (newId == new System.Guid(exclusiveLockId)); ExclusiveLockSubRequestType exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.CheckLockAvailability); exclusiveLocksubRequest.SubRequestData.ExclusiveLockID = newId.ToString(); CellStorageResponse response = this.Adapter.CellStorageRequest(file, new SubRequestType[] { exclusiveLocksubRequest }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); ErrorCodeType error = SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site); if (error == ErrorCodeType.FileAlreadyLockedOnServer) { // Now there could be kind of two conditions: // 1) There is an exclusive lock // 2) There is a schema lock // So it is needed to check the exclusive lock with the given exclusive lock id should exist. exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.CheckLockAvailability); exclusiveLocksubRequest.SubRequestData.ExclusiveLockID = exclusiveLockId; response = this.Adapter.CellStorageRequest(file, new SubRequestType[] { exclusiveLocksubRequest }); exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); return(SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site) == ErrorCodeType.Success); } else { if (error != ErrorCodeType.Success) { this.Site.Assert.Fail( "If the exclusive lock {0} does not exist, check the schema lock using the id {0} should success, but actual the result is {2}", exclusiveLockId, newId.ToString(), error.ToString()); } return(false); } }
/// <summary> /// This method is used to prepare an exclusive lock on the file with the specified exclusive lock id. /// </summary> /// <param name="fileUrl">Specify the file which is locked.</param> /// <param name="exclusiveLockId">Specify the exclusive lock 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 PrepareExclusiveLock(string fileUrl, string exclusiveLockId, string userName, string password, string domain, int timeout = SharedTestSuiteHelper.DefaultTimeOut) { this.InitializeContext(fileUrl, userName, password, domain); // Get an exclusive lock ExclusiveLockSubRequestType getExclusiveLockSubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); getExclusiveLockSubRequest.SubRequestData.ExclusiveLockID = exclusiveLockId; getExclusiveLockSubRequest.SubRequestData.Timeout = timeout.ToString(); CellStorageResponse response = this.Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { getExclusiveLockSubRequest }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "Get an exclusive lock with identifier {0} by the user {1}@{2} on the file {3} should succeed.", exclusiveLockId, userName, domain, fileUrl); this.StatusManager.RecordExclusiveLock(fileUrl, exclusiveLockId, userName, password, domain); }
public void MSFSSHTTP_FSSHTTPB_S04_TC09_ExclusiveLock_EmptyUrl() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); CellStorageResponse response = new CellStorageResponse(); bool isR3008Verified = false; try { // Send a GetLock for exclusive subRequest to the protocol server with empty URL. response = this.Adapter.CellStorageRequest(string.Empty, new SubRequestType[] { subRequest }); } catch (System.Xml.XmlException exception) { string message = exception.Message; isR3008Verified = message.Contains("Duplicate attribute"); isR3008Verified &= message.Contains("ErrorCode"); } if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3008 if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3008, this.Site)) { Site.Log.Add( LogEntryKind.Debug, "SharePoint server 2010 and SharePoint Foundation responses two ErrorCode attributes when the URL is empty string."); Site.CaptureRequirementIfIsTrue( isR3008Verified, "MS-FSSHTTP", 3008, @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element is an empty string, the implementation does return two ErrorCode attributes in Response element. <8> Section 2.2.3.5: SharePoint Server 2010 will return 2 ErrorCode attributes in Response element."); } // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3009 if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site)) { Site.CaptureRequirementIfIsNull( response.ResponseCollection, "MS-FSSHTTP", 3009, @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element is an empty string, the implementation does not return Response element. <8> Section 2.2.3.5: SharePoint Server 2013 will not return Response element."); } } else { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3008, this.Site)) { Site.Log.Add( LogEntryKind.Debug, "SharePoint server 2010 and SharePoint Foundation responses two ErrorCode attributes when the URL is empty string."); Site.Assert.IsTrue( isR3008Verified, "[In Appendix B: Product Behavior] If the URL attribute of the corresponding Request element is an empty string, the implementation does return two ErrorCode attributes in Response element. <3> Section 2.2.3.5: SharePoint Server 2010 will return 2 ErrorCode attributes in Response element."); } if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site)) { Site.Assert.IsNull( response.ResponseCollection, @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element is an empty string, the implementation does not return Response element. <8> Section 2.2.3.5: SharePoint Server 2013 will not return Response element."); } } }
public void MSFSSHTTP_FSSHTTPB_S04_TC04_ConvertToSchemaJoinCoauth_ConvertToSchemaFailedFileCheckedOutByCurrentUser() { // Check out one file by a specified user name. if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password{2}", this.DefaultFileUrl, this.UserName01, this.Password01); } // Record the file check out status. this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3086, this.Site)) { // Change the authentication mode if (!this.SutPowerShellAdapter.SwitchClaimsAuthentication(false)) { this.Site.Assert.Fail("Cannot change the authentication mode to windows based."); } this.StatusManager.RecordDisableClaimsBasedAuthentication(); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); CheckLockAvailability(); // Get the exclusive lock using the same user name on the already checked out file, expect the server response the error code "Success". this.PrepareExclusiveLock(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultExclusiveLockID); // Convert current exclusive lock to a coauthoring shared lock with the same exclusive lock id as the previous step on the already checked out file, expect the server returns the error code "ConvertToSchemaFailedFileCheckedOutByCurrentUser". ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.ConvertToSchemaJoinCoauth); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error code equals ConvertToSchemaFailedFileCheckedOutByCurrentUser, then capture MS-FSSHTTP requirement: MS-FSSHTTP_R1229, MS-FSSHTTP_R1279 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1229, @"[In ExclusiveLock Subrequest][The protocol returns results based on the following conditions: ] If the protocol server gets an exclusive lock subrequest of type ""Convert to schema lock with coauthoring transition tracked"" for a file, and the conversion fails because the file is checked out by the current client, the protocol server returns an error code value set to ""ConvertToSchemaFailedFileCheckedOutByCurrentUser""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1279 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1279, @"[In Convert to Schema Lock with Coauthoring Transition Tracked] The protocol server returns error codes according to the following rules: If the protocol server is unable to convert the exclusive lock to a shared lock on the file because the file is checked out by the current user, the protocol server returns an error code value set to ""ConvertToSchemaFailedFileCheckedOutByCurrentUser""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R387 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 387, @"[In LockAndCoauthRelatedErrorCodeTypes] ConvertToSchemaFailedFileCheckedOutByCurrentUser indicates an error when converting to a shared lock fails because the file is checked out by the current client."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.ConvertToSchemaFailedFileCheckedOutByCurrentUser, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), @"[In ExclusiveLock Subrequest][The protocol returns results based on the following conditions: ] If the protocol server gets an exclusive lock subrequest of type ""Convert to schema lock with coauthoring transition tracked"" for a file, and the conversion fails because the file is checked out by the current client, the protocol server returns an error code value set to ""ConvertToSchemaFailedFileCheckedOutByCurrentUser""."); } }
public void MSFSSHTTP_FSSHTTPB_S04_TC03_CheckExclusiveLockAvailability_Success() { // Initialize the service. this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); ExclusiveLockSubRequestType exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.CheckLockAvailability); // Check the exclusive lock availability with all valid parameters on a file on which there is no lock, expect the server responds the error code "Success". CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { exclusiveLocksubRequest }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error code equals "Success", then capture MS-FSSHTTP_RR13122 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 13122, @"[In Check Lock Availability] The protocol server returns error codes according to the following rules: In all other cases[the file is not checked out and there is no current exclusive lock and shared lock on the file], the protocol server returns an error code value set to ""Success"" to indicate the availability of the file for locking."); // If the error code equals "Success", then capture MS-FSSHTTP_R1236 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1236, @"[In ExclusiveLock Subrequest] An ErrorCode value of ""Success"" indicates success in processing the exclusive lock request."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), @"[In Check Lock Availability] The protocol server returns error codes according to the following rules: In all other cases[the file is not checked out and there is no current exclusive lock and shared lock on the file], the protocol server returns an error code value set to ""Success"" to indicate the availability of the file for locking."); } // Prepare an exclusive lock this.PrepareExclusiveLock(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultExclusiveLockID); // Check the exclusive lock availability with all valid parameters on a file which is locked by the same exclusive lock id, expect the server responds the error code "Success". exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.CheckLockAvailability); response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { exclusiveLocksubRequest }); exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error code equals "Success", then capture MS-FSSHTTP_R13121 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 13121, @"[In Check Lock Availability] The protocol server returns error codes according to the following rules: In all other cases[there is a current exclusive lock on the file with a same exclusive lock identifier with the one specified by the current client], the protocol server returns an error code value set to ""Success"" to indicate the availability of the file for locking."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), @"[In Check Lock Availability] The protocol server returns error codes according to the following rules: In all other cases[there is a current exclusive lock on the file with a same exclusive lock identifier with the one specified by the current client], the protocol server returns an error code value set to ""Success"" to indicate the availability of the file for locking."); } if (!this.StatusManager.RollbackStatus()) { this.Site.Assert.Fail("Cannot release the exclusive lock {0}", SharedTestSuiteHelper.DefaultExclusiveLockID); } // Check out one file by a specified user name. if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3086, this.Site)) { // Change the authentication mode if (!this.SutPowerShellAdapter.SwitchClaimsAuthentication(false)) { this.Site.Assert.Fail("Cannot change the authentication mode to windows based."); } this.StatusManager.RecordDisableClaimsBasedAuthentication(); } CheckLockAvailability(); // Check the exclusive lock availability with all valid parameters on a file which is checked out by the same user, expect the server responds the error code "Success". exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.CheckLockAvailability); response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { exclusiveLocksubRequest }); exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error code equals "Success", then capture MS-FSSHTTP_R13123 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "MS-FSSHTTP", 13123, @"[In Check Lock Availability] The protocol server returns error codes according to the following rules: In all other cases[the file has been checked out by the current user and there is no current exclusive lock and shared lock on the file], the protocol server returns an error code value set to ""Success"" to indicate the availability of the file for locking."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), @"[In Check Lock Availability] The protocol server returns error codes according to the following rules: In all other cases[the file has been checked out by the current user and there is no current exclusive lock and shared lock on the file], the protocol server returns an error code value set to ""Success"" to indicate the availability of the file for locking."); } }
public void MSFSSHTTP_FSSHTTPB_S04_TC07_ExclusiveLock_CellStorageWebServiceDisabled() { if (!this.SutPowerShellAdapter.SwitchCellStorageService(false)) { this.Site.Assert.Fail("Cannot disable the cell storage web service."); } this.StatusManager.RecordDisableCellStorageService(); // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Call the GetExclusiveLock to expect fail. ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); this.Site.Log.Add( LogEntryKind.Debug, "When the cell storage service is turned off, the error code should be not null but actual {0}", response.ResponseVersion.ErrorCodeSpecified ? "is not null" : "null"); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 15181, this.Site)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R15181 Site.CaptureRequirementIfIsTrue( response.ResponseVersion.ErrorCodeSpecified, "MS-FSSHTTP", 15181, @"[In Appendix B: Product Behavior] ErrorCode attribute is present if this protocol is not enabled on the protocol server.(<15> Section 2.2.3.7: In SharePoint Foundation 2010, SharePoint Server 2010, SharePoint Foundation 2013 and SharePoint Server 2013, the ErrorCode attribute is present if this protocol is not enabled on the protocol server.)"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R368 Site.CaptureRequirementIfAreEqual <GenericErrorCodeTypes>( GenericErrorCodeTypes.WebServiceTurnedOff, response.ResponseVersion.ErrorCode, "MS-FSSHTTP", 368, @"[In GenericErrorCodeTypes] WebServiceTurnedOff indicates an error when the web service is turned off during the processing of the cell storage service request."); } else { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2458 Site.CaptureRequirementIfIsFalse( response.ResponseVersion.ErrorCodeSpecified, "MS-FSSHTTP", 2458, @"[In Appendix B: Product Behavior] ErrorCode attribute is not present if this protocol is not enabled on the protocol server.(SharePoint Server 2016 and above follow this behavior)"); } } else { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 15181, this.Site)) { Site.Assert.IsTrue( response.ResponseVersion.ErrorCodeSpecified, @"ErrorCode attribute is present if this protocol is not enabled on the protocol server.(<15> Section 2.2.3.7: In SharePoint Foundation 2010, SharePoint Server 2010, SharePoint Foundation 2013 and SharePoint Server 2013, the ErrorCode attribute is present if this protocol is not enabled on the protocol server.)"); Site.Assert.AreEqual <GenericErrorCodeTypes>( GenericErrorCodeTypes.WebServiceTurnedOff, response.ResponseVersion.ErrorCode, @"[In GenericErrorCodeTypes] WebServiceTurnedOff indicates an error when the web service is turned off during the processing of the cell storage service request."); } } }
public void TestCase_S10_TC05_DependencyTypeOnSuccessOrNotSupported_OnSuccess() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); ExclusiveLockSubRequestType exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); // Update the file contents when the coalesce is true. CellSubRequestType putChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedPutChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(10))); putChange.SubRequestData.CoalesceSpecified = true; putChange.SubRequestData.Coalesce = true; // Make a putChanges subRequest dependent on the exclusive lock and the dependency type is success. putChange.DependencyTypeSpecified = true; putChange.DependencyType = DependencyTypes.OnSuccessOrNotSupported; putChange.DependsOn = exclusiveLocksubRequest.SubRequestToken; CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { exclusiveLocksubRequest, putChange }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); CellSubResponseType putChanges = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 1, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "Test case cannot continue unless the get lock sub request succeeds."); this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, exclusiveLocksubRequest.SubRequestData.ExclusiveLockID); this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(putChanges.ErrorCode, this.Site), "Test case cannot continue unless the put changes sub request succeeds."); // Make another GetLock request with a different exclusive lock ID. exclusiveLocksubRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); exclusiveLocksubRequest.SubRequestData.ExclusiveLockID = System.Guid.NewGuid().ToString(); // Also make another putChange request dependent on the new GetLock request. putChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedPutChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), System.Text.Encoding.Unicode.GetBytes(SharedTestSuiteHelper.GenerateRandomString(10))); putChange.SubRequestData.CoalesceSpecified = true; putChange.SubRequestData.Coalesce = true; // Make a putChanges subRequest dependent on the exclusive lock and the dependency type is success. putChange.DependencyTypeSpecified = true; putChange.DependencyType = DependencyTypes.OnSuccessOrNotSupported; putChange.DependsOn = exclusiveLocksubRequest.SubRequestToken; response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { exclusiveLocksubRequest, putChange }); exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); putChanges = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 1, this.Site); this.Site.Assert.AreNotEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "Test case cannot continue unless the get lock sub request fails."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the first putChanges request succeed and the second putChanges request fails, then capture requirement R336 and R32201. Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.DependentOnlyOnSuccessRequestFailed, SharedTestSuiteHelper.ConvertToErrorCodeType(putChanges.ErrorCode, this.Site), "MS-FSSHTTP", 336, @"[In DependencyTypes] OnSuccessOrNotSupported: Indicates that the subrequest MUST be processed only when one of the following conditions is true: On the successful execution of the other subrequest."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R32201 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.DependentOnlyOnSuccessRequestFailed, SharedTestSuiteHelper.ConvertToErrorCodeType(putChanges.ErrorCode, this.Site), "MS-FSSHTTP", 32201, @"[In DependencyCheckRelatedErrorCodeTypes] DependentOnlyOnSuccessRequestFailed: Indicates an error when the subrequest on which this specific subrequest is dependent has failed and the DependencyType attribute in this subrequest is set to [""OnSuccess""] or ""OnSuccessOrNotSupported""."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.DependentOnlyOnSuccessRequestFailed, SharedTestSuiteHelper.ConvertToErrorCodeType(putChanges.ErrorCode, this.Site), @"[In DependencyTypes] OnSuccessOrNotSupported: Indicates that the subrequest MUST be processed only when one of the following conditions is true: On the successful execution of the other subrequest."); } }