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."); } }
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 }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(response, 0, 0, this.Site); CellSubResponseType putChangeResponse = 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(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 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""]."); } }