public void MSFSSHTTP_FSSHTTPB_S03_TC01_GetLock_FileNotExistsOrCannotBeCreated() { // Get a schema lock with a nonexistent file, expect the server returns the error code "FileNotExistsOrCannotBeCreated". string fileUrlNotExit = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site); // Initialize the service this.InitializeContext(fileUrlNotExit, this.UserName01, this.Password01, this.Domain); SchemaLockSubRequestType subRequest = SharedTestSuiteHelper.CreateSchemaLockSubRequest(SchemaLockRequestTypes.GetLock, false, null); CellStorageResponse response = Adapter.CellStorageRequest(fileUrlNotExit, new SubRequestType[] { subRequest }); SchemaLockSubResponseType schemaLockSubResponse = SharedTestSuiteHelper.ExtractSubResponse <SchemaLockSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1913 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(schemaLockSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1913, @"[In SchemaLock Subrequest][The protocol server 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 ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(schemaLockSubResponse.ErrorCode, this.Site), @"[In SchemaLock Subrequest][The protocol server 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 ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element."); } }
public void MSFSSHTTP_FSSHTTPB_S02_TC06_JoinCoauthoringSession_PathNotFound() { Site.Assume.IsTrue(Common.IsRequirementEnabled(11265, this.Site), "This test case only runs PathNotFound is returned when the file path is not found."); string fileUrlNotExit = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site); string path = fileUrlNotExit.Substring(0, fileUrlNotExit.LastIndexOf('/')); // Initialize the service this.InitializeContext(path, this.UserName01, this.Password01, this.Domain); CoauthSubRequestType subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID, null, null, 3600); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(path, new SubRequestType[] { subRequest }); CoauthSubResponseType joinResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.PathNotFound, SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11265, @"[In Appendix B: Product Behavior] Implementation does return the value ""PathNotFound"" of GenericErrorCodeTypes when the file path is not found. (Microsoft Office 2016/Microsoft SharePoint Server 2016 follow this behavior.)"); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.PathNotFound, SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site), @"Error ""PathNotFound"" should be returned when the file path is not found."); } }
public void MSFSSHTTP_FSSHTTPB_TestCase_S16_TC02_Versioning_FileNotExistsOrCannotBeCreated() { string fileUrlNotExit = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site); // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.GetVersionList, null, this.Site); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(fileUrlNotExit, new SubRequestType[] { versioningSubRequest }); VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11246 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11246, @"[In Versioning 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 ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "Error FileNotExistsOrCannotBeCreated should be returned if the protocol server was unable to find the URL for the file."); } }
/// <summary> /// This method is used to fetch editor table on the specified file. /// </summary> /// <param name="file">Specify the file URL.</param> /// <returns>Return the editors table on the file if the server support the editor tables, otherwise return null.</returns> protected EditorsTable FetchEditorTable(string file) { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 2053, this.Site)) { // Call QueryEditorsTable to get editors table this.InitializeContext(file, this.UserName01, this.Password01, this.Domain); CellSubRequestType cellSubRequestEditorsTable = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryEditorsTable(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); CellStorageResponse cellStorageResponseEditorsTable = this.Adapter.CellStorageRequest(file, new SubRequestType[] { cellSubRequestEditorsTable }); CellSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(cellStorageResponseEditorsTable, 0, 0, this.Site); FsshttpbResponse queryEditorsTableResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site); // Get EditorsTable EditorsTable editorsTable = EditorsTableUtils.GetEditorsTableFromResponse(queryEditorsTableResponse, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If can fetch the editors table, then the following requirement can be directly captured. this.Site.CaptureRequirement( "MS-FSSHTTP", 2053, @"[In Appendix B: Product Behavior] Implementation does represent the editors table as a compressed XML fragment. (<42> Section 3.1.4.8: On servers running Office 2013, the editors table is represented as a compressed XML fragment.)"); } return(editorsTable); } return(null); }
/// <summary> /// This method is used to record the exclusive lock status with specified exclusive lock ID for the file URL. /// </summary> /// <param name="fileUrl">Specify the file URL which get the exclusive lock.</param> /// <param name="exclusiveId">Specify the exclusive lock ID of 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> public void RecordExclusiveLock(string fileUrl, string exclusiveId, string userName, string password, string domain) { Action function = () => { ExclusiveLockSubRequestType coauthLockRequest = new ExclusiveLockSubRequestType(); coauthLockRequest.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString(); coauthLockRequest.SubRequestData = new ExclusiveLockSubRequestDataType(); coauthLockRequest.SubRequestData.ExclusiveLockRequestType = ExclusiveLockRequestTypes.ReleaseLock; coauthLockRequest.SubRequestData.ExclusiveLockRequestTypeSpecified = true; coauthLockRequest.SubRequestData.ExclusiveLockID = exclusiveId; IMS_FSSHTTP_FSSHTTPBAdapter adapter = site.GetAdapter <IMS_FSSHTTP_FSSHTTPBAdapter>(); this.intializeContext(fileUrl, userName, password, domain); CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(adapter.CellStorageRequest(fileUrl, new SubRequestType[] { coauthLockRequest }), 0, 0, site); if (!string.Equals("Success", subResponse.ErrorCode, StringComparison.OrdinalIgnoreCase)) { this.errorMessage.Add(string.Format("Failed to release the exclusive lock for the exclusive lock id {1} on the file {0} using the following user: {2}/{3}and password:{4}", fileUrl, exclusiveId, userName, domain, password)); this.isEnvironmentRollbackSuccess = false; } }; this.AddOrUpdate(fileUrl, function, KeyStatus.ExclusiveLock); }
/// <summary> /// This method is used to prepare a coauthoring session on the file with the specified schema lock id and client id. /// </summary> /// <param name="fileUrl">Specify the file which is locked.</param> /// <param name="clientId">Specify the client ID.</param> /// <param name="schemaLockId">Specify the schemaLock 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> /// <returns>Return the current coauthoring status when the user join the coauthoring session.</returns> protected CoauthStatusType PrepareCoauthoringSession(string fileUrl, string clientId, string schemaLockId, string userName, string password, string domain, int timeout = SharedTestSuiteHelper.DefaultTimeOut) { this.InitializeContext(fileUrl, userName, password, domain); // Join a Coauthoring session CoauthSubRequestType subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(clientId, schemaLockId, null, null, timeout); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { subRequest }); CoauthSubResponseType joinResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); this.Site.Assert.AreEqual( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site), "Join coauthoring session with client ID {0} and schema lock ID {4} by the user {1}@{2} on the file {3} should succeed.", clientId, userName, domain, fileUrl, schemaLockId); this.StatusManager.RecordCoauthSession(fileUrl, clientId, schemaLockId, userName, password, domain); this.Site.Assert.IsTrue( joinResponse.SubResponseData.CoauthStatusSpecified, "When join the coauthoring session succeeds, the coauth status should be returned."); return(joinResponse.SubResponseData.CoauthStatus); }
/// <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> /// This method is used to record the coauth lock status with specified client ID and schema lock ID for the file URL. /// </summary> /// <param name="fileUrl">Specify the file URL which get the coauth lock.</param> /// <param name="clientId">Specify the client ID of the coauth lock.</param> /// <param name="schemaLockId">Specify the schema ID of the coauth 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> public void RecordCoauthSession(string fileUrl, string clientId, string schemaLockId, string userName, string password, string domain) { Action function = () => { CoauthSubRequestType coauthLockRequest = new CoauthSubRequestType(); coauthLockRequest.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString(); coauthLockRequest.SubRequestData = new CoauthSubRequestDataType(); coauthLockRequest.SubRequestData.CoauthRequestType = CoauthRequestTypes.ExitCoauthoring; coauthLockRequest.SubRequestData.CoauthRequestTypeSpecified = true; coauthLockRequest.SubRequestData.SchemaLockID = schemaLockId; coauthLockRequest.SubRequestData.ClientID = clientId; IMS_FSSHTTP_FSSHTTPBAdapter adapter = site.GetAdapter <IMS_FSSHTTP_FSSHTTPBAdapter>(); this.intializeContext(fileUrl, userName, password, domain); CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(adapter.CellStorageRequest(fileUrl, new SubRequestType[] { coauthLockRequest }), 0, 0, site); if (!string.Equals("Success", subResponse.ErrorCode, StringComparison.OrdinalIgnoreCase)) { this.errorMessage.Add(string.Format("Failed to leave the coauth session for the client id {1} and schema lock id {5} on the file {0} using the following user: {2}/{3}and password:{4}", fileUrl, clientId, userName, domain, password, schemaLockId)); this.isEnvironmentRollbackSuccess = false; } }; this.AddOrUpdate(new SharedLockKey(fileUrl, clientId, schemaLockId), function); }
public void MSFSSHTTP_FSSHTTPB_TestCase_S19_TC02_LockStatus_Error() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); LockStatusSubRequestType lockStatus = SharedTestSuiteHelper.CreateLockStatusSubRequest(); CellStorageResponse response = this.Adapter.CellStorageRequest(null, new SubRequestType[] { lockStatus }); if (Common.IsRequirementEnabled(2273, this.Site)) { LockStatusSubResponseType lockStatusResponse = SharedTestSuiteHelper.ExtractSubResponse <LockStatusSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2273 Site.CaptureRequirementIfAreNotEqual <string>( "Success", lockStatusResponse.ErrorCode, "MS-FSSHTTP", 2273, @"[LockStatusSubResponseType]In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. "); } else { Site.Assert.AreNotEqual <string>( "Success", lockStatusResponse.ErrorCode, "In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. "); } } }
public void MSFSSHTTP_FSSHTTPB_TestCase_S18_TC02_AmIAlone_Error() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); AmIAloneSubRequestType amIAlone = SharedTestSuiteHelper.CreateAmIAloneSubRequest(); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { amIAlone }); AmIAloneSubResponseType amIAloneResponse = SharedTestSuiteHelper.ExtractSubResponse <AmIAloneSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R22522 Site.CaptureRequirementIfAreNotEqual <string>( "Success", amIAloneResponse.ErrorCode, "MS-FSSHTTP", 22522, @"[In AmIAloneSubResponseType]In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this subrequest. "); } else { Site.Assert.AreNotEqual <string>( "Success", amIAloneResponse.ErrorCode, "In the case of failure, the ErrorCode attribute that is part of a SubResponse element specifies the error code result for this 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 }); 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_S02_TC04_JoinCoauthSession_FileNotExistsOrCannotBeCreated() { // Join a coauthoring session on a nonexistent file, expect the server returns the error code "FileNotExistsOrCannotBeCreated". string fileUrlNotExit = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site); // Initialize the service this.InitializeContext(fileUrlNotExit, this.UserName01, this.Password01, this.Domain); // Join a Coauthoring session with the non-exist URL. CoauthSubRequestType subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID, null, null, 3600); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(fileUrlNotExit, new SubRequestType[] { subRequest }); CoauthSubResponseType joinResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the ErrorCode attribute returned equals "FileNotExistsOrCannotBeCreated", MS-FSSHTTP_R4003 can be covered. Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site), "MS-FSSHTTP", 4003, @"[In Coauth Subrequest][The protocol server 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 ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(joinResponse.ErrorCode, this.Site), @"[In Coauth Subrequest][The protocol server 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 ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element."); } }
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_S09_TC06_ResourceIDDifferentWithUrl() { Site.Assume.IsTrue(Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11272, this.Site), "This test case runs only when implementation uses the value of the ResourceID attribute to identify the file instead of the Url attribute when UseResourceID set to true and the ResourceID attribute is set on the Request element."); string anotherFile = this.PrepareFile(); // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Invoke "GetVersions"sub-request with correct input parameters. GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest( this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest }, "1", 2, 2, null, null, null, null, null, null, true); GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site); Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "Get versions should be succeed."); VersionType version = cellStoreageResponse.ResponseVersion as VersionType; Site.Assume.AreEqual <ushort>(3, version.MinorVersion, "This test case runs only when MinorVersion is 3 which indicates the protocol server is capable of performing ResourceID specific behavior."); // Set both Url and ResourceID attribute cellStoreageResponse = Adapter.CellStorageRequest( anotherFile, new SubRequestType[] { getVersionsSubRequest }, "1", 2, 2, null, null, null, null, null, cellStoreageResponse.ResponseCollection.Response[0].ResourceID, true); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11272 Site.CaptureRequirementIfIsTrue( cellStoreageResponse.ResponseCollection.Response[0].Url.Equals(this.DefaultFileUrl, StringComparison.CurrentCultureIgnoreCase), "MS-FSSHTTP", 11272, @"[In Appendix B: Product Behavior] [UseResourceID] Also when true and the ResourceID attribute is set on the Request element, the implementation does use the value of the ResourceID attribute to identify the file instead of the Url attribute. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11074 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11074, @"[In MinorVersionNumberType][The value of MinorVersionNumberType] 3: In responses, indicates that the protocol server is capable of performing ResourceID specific behavior."); } else { Site.Assert.IsTrue( cellStoreageResponse.ResponseCollection.Response[0].Url.Equals(this.DefaultFileUrl, StringComparison.CurrentCultureIgnoreCase), "[In Appendix B: Product Behavior] [UseResourceID] Also when true and the ResourceID attribute is set on the Request element, the implementation does use the value of the ResourceID attribute to identify the file instead of the Url attribute. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)"); Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), @"[In MinorVersionNumberType][The value of MinorVersionNumberType] 3: In responses, indicates that the protocol server is capable of performing ResourceID specific behavior."); } }
public void MSFSSHTTP_FSSHTTPB_TestCase_S18_TC01_AmIAlone_False() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Join Coauthoring session using the first user CoauthSubRequestType subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); this.Site.Assert.AreEqual( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), string.Format("Account {0} with client ID {1} and schema lock ID {2} should join the coauthoring session successfully.", this.UserName01, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID)); this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); // Join the Coauthoring session using the second user with same SchemaLockId this.InitializeContext(this.DefaultFileUrl, this.UserName02, this.Password02, this.Domain); string secondClientId = System.Guid.NewGuid().ToString(); subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(secondClientId, SharedTestSuiteHelper.ReservedSchemaLockID); cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); CoauthSubResponseType secondResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, secondClientId, SharedTestSuiteHelper.ReservedSchemaLockID, this.UserName02, this.Password02, this.Domain); string transitionId = secondResponse.SubResponseData.TransitionID; AmIAloneSubRequestType amIAlone = SharedTestSuiteHelper.CreateAmIAloneSubRequest(); amIAlone.SubRequestData.TransitionID = transitionId; CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { amIAlone }); AmIAloneSubResponseType amIAloneResponse = SharedTestSuiteHelper.ExtractSubResponse <AmIAloneSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R224912 Site.CaptureRequirementIfAreEqual <string>( "False", amIAloneResponse.SubResponseData.AmIAlone, "MS-FSSHTTP", 224912, @"[In AmIAloneSubResponseDataType]AmIAlone: False means the user is not alone in the coauthoring session."); //Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2181012 //If MS-FSSHTTP224912 is verified, this requirement can be verified directly Site.CaptureRequirement( "MS-FSSHTTP", 2181012, @"[In SubResponseDataOptionalAttributes]AmIAlone: False means the user is not alone in the coauthoring session."); } else { Site.Assert.AreEqual <string>( "False", amIAloneResponse.SubResponseData.AmIAlone, "AmIAlone: False means the user is not alone in the coauthoring session."); } }
public void TestCase_S08_TC01_GetDocMetaInfo_Success() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Invoke "GetDocMetaInfo"sub-request with correct input parameters. GetDocMetaInfoSubRequestType getDocMetaInfoSubRequest = SharedTestSuiteHelper.CreateGetDocMetaInfoSubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getDocMetaInfoSubRequest }); GetDocMetaInfoSubResponseType getDocMetaInfoSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetDocMetaInfoSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(getDocMetaInfoSubResponse, "The object 'getDocMetaInfoSubResponse' should not be null."); this.Site.Assert.IsNotNull(getDocMetaInfoSubResponse.ErrorCode, "The object 'getDocMetaInfoSubResponse.ErrorCode' should not be null."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the value of "ErrorCode" in the sub-response equals "Success", then capture MS-FSSHTTP_R2016, and MS-FSSHTTP_R1802. Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getDocMetaInfoSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 2016, @"[In GetDocMetaInfo Subrequest][The protocol returns results based on the following conditions:] Otherwise[the processing of the GetDocMetaInfo subrequest by the protocol server get the requested metadata successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetDocMetaInfo subrequest."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1802 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getDocMetaInfoSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1802, @"[In GetDocMetaInfoSubResponseType] The protocol server sets the value of the ErrorCode attribute to ""Success"" if the protocol server succeeds in processing the GetDocMetaInfo subrequest."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R9003 Site.CaptureRequirement( "MS-FSSHTTP", 9003, @"[In Appendix B: Product Behavior] Implementation does support GetDocMetaInfo operation. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 and above follow this behavior.)"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11050 Site.CaptureRequirementIfIsNotNull( getDocMetaInfoSubResponse.SubResponseData.DocProps, "MS-FSSHTTP", 11050, @"[In SubResponseDataGenericType] DocProps: An element of type GetDocMetaInfoPropertySetType (section 2.3.1.28) that specifies metadata properties pertaining to the server file."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11051 Site.CaptureRequirementIfIsNotNull( getDocMetaInfoSubResponse.SubResponseData.FolderProps, "MS-FSSHTTP", 11051, @"[In SubResponseDataGenericType] FolderProps: An element of type GetDocMetaInfoPropertySetType (section 2.3.1.28) that specifies metadata properties pertaining to the parent directory of the server file."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getDocMetaInfoSubResponse.ErrorCode, this.Site), @"[In GetDocMetaInfo Subrequest][The protocol returns results based on the following conditions:] Otherwise[the processing of the GetDocMetaInfo subrequest by the protocol server get the requested metadata successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetDocMetaInfo subrequest."); } }
public void TestCase_S09_TC02_GetVersions_Success_Results_ListId() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Get the GUID of expected list using SUT control Adapter method. string listName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site); string expectedListGuid = SutPowerShellAdapter.GetListGuidByName(listName); // Invoke "GetVersions"sub-request with correct input parameters. GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest( this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest }, "1", 2, 2, null, null, null, null, null, null, false); GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(getVersionsSubResponse, "The object 'getVersionsSubResponse' should not be null."); this.Site.Assert.IsNotNull(getVersionsSubResponse.ErrorCode, "The object 'getVersionsSubResponse.ErrorCode' should not be null."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Make sure the error code value in the response equals "Success" Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), @"The response of the ""getVersions"" sub-request on the file {0} should succeed.", this.DefaultFileUrl); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2302 Site.CaptureRequirementIfAreEqual <System.Guid>( new System.Guid(expectedListGuid), new System.Guid(getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.list.id), "MS-FSSHTTP", 2302, @"[In GetVersionsSubResponseType][Results complex type] list.id: Specifies the GUID of the document library in which the file resides."); VersionType version = cellStoreageResponse.ResponseVersion as VersionType; // MinorVersion 3 indicates the protocol server is capable of performing ResourceID specific behavior. if (Common.IsRequirementEnabled(11276, this.Site) && version.MinorVersion == 3) { // Capture the requirement MS-FSSHTTP_R11276 Site.CaptureRequirementIfIsNull( cellStoreageResponse.ResponseCollection.Response[0].ResourceID, "MS-FSSHTTP", 11276, @"[In Appendix B: Product Behavior] The ResourceID attribute [MAY be present when the UseResourceID attribute is set to true in the corresponding Request element, and] is not present otherwise[when the UseResourceID attribute is set to false in the corresponding Request element]. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)"); } } else { Site.Assert.AreEqual <System.Guid>( new System.Guid(expectedListGuid), new System.Guid(getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.list.id), @"[In GetVersionsSubResponseType][Results complex type] list.id: Specifies the GUID of the document library in which the file resides."); } }
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""."); } }
/// <summary> /// This method is used to check the user with specified client whether exist in a coauthoring session. /// </summary> /// <param name="fileUrl">Specify the file which is locked.</param> /// <param name="clientId">Specify the client ID.</param> /// <param name="schemaLockId">Specify the schemaLock 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> /// <returns>Return true is exist in the coauthoring session, otherwise return false.</returns> protected bool IsPresentInCoauthSession(string fileUrl, string clientId, string schemaLockId, string userName, string password, string domain) { this.InitializeContext(fileUrl, userName, password, domain); CoauthSubRequestType subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForMarkTransitionComplete(clientId, schemaLockId); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { subRequest }); CoauthSubResponseType response = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); return(SharedTestSuiteHelper.ConvertToErrorCodeType(response.ErrorCode, this.Site) == ErrorCodeType.Success); }
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_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_S02_TC05_JoinCoauthoringSession_CheckedOutByCurrentUser() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Check out the file 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); CheckLockAvailability(); // Join a Coauthoring session CoauthSubRequestType request = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID, true, SharedTestSuiteHelper.DefaultExclusiveLockID); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { request }); CoauthSubResponseType response = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); this.Site.Assert.AreEqual( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(response.ErrorCode, this.Site), "The test case cannot continue unless the server response succeeds when the user join the coauthoring session with allowFallback set to true on an already checked out file by the same user."); this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultExclusiveLockID); this.Site.Assert.AreEqual( "ExclusiveLock", response.SubResponseData.LockType, "The test case cannot continue unless the server responses an exclusive lock type when the user join the coauthoring session with allowFallback set to true on an already checked out file by the same user."); this.Site.Assert.IsTrue( response.SubResponseData.ExclusiveLockReturnReasonSpecified, "The test case cannot continue unless the server returns ExclusiveLockReturnReason attribute when the user join the coauthoring session with allowFallback set to true on an already checked out file by the same user."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R350 Site.CaptureRequirementIfAreEqual <ExclusiveLockReturnReasonTypes>( ExclusiveLockReturnReasonTypes.CheckedOutByCurrentUser, response.SubResponseData.ExclusiveLockReturnReason, "MS-FSSHTTP", 350, @"[In ExclusiveLockReturnReasonTypes] CheckedOutByCurrentUser: The string value ""CheckedOutByCurrentUser"", indicating that an exclusive lock is granted on the file because the file is checked out by the current user who sent the cell storage service request message."); } else { Site.Assert.AreEqual <ExclusiveLockReturnReasonTypes>( ExclusiveLockReturnReasonTypes.CheckedOutByCurrentUser, response.SubResponseData.ExclusiveLockReturnReason, "The server should response when an exclusive lock is granted on the file because the file is checked out by the current user who sent the cell storage service request message."); } }
public void TestCase_S10_TC08_OnSuccessOrNotSupported_OnNotSupport() { if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 337, this.Site)) { Site.Assume.Inconclusive("Implementation does not return Success when its sub-request dependency type is OnSuccessOrNotSupported and the dependent subRequest is not supported"); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Disable the coauthoring feature. bool isSwitchedSuccessfully = SutPowerShellAdapter.SwitchCoauthoringFeature(true); this.Site.Assert.IsTrue(isSwitchedSuccessfully, "The Coauthoring Feature should be disabled."); this.StatusManager.RecordDisableCoauth(); // create a coauthoring subRequest with all valid parameters. CoauthSubRequestType coauthSubRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); // Create a serverTime subRequest with DependencyType set to "OnSuccessOrNotSupported", which depends on the coauthoring subRequest. ServerTimeSubRequestType serverTimeSubRequest = SharedTestSuiteHelper.CreateServerTimeSubRequest(SequenceNumberGenerator.GetCurrentToken()); serverTimeSubRequest.DependencyType = DependencyTypes.OnSuccessOrNotSupported; serverTimeSubRequest.DependencyTypeSpecified = true; serverTimeSubRequest.DependsOn = coauthSubRequest.SubRequestToken; // Send these two subRequests to the protocol server, expect the protocol server returns error code "Success" for the serverTimeSubRequest. CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { coauthSubRequest, serverTimeSubRequest }); CoauthSubResponseType coauthSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(response, 0, 0, this.Site); this.Site.Assert.AreNotEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(coauthSubResponse.ErrorCode, this.Site), "The coauthoring operation should be failed."); ServerTimeSubResponseType serverTimeSubResponse = SharedTestSuiteHelper.ExtractSubResponse <ServerTimeSubResponseType>(response, 0, 1, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R337 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 337, @"[In DependencyTypes] OnSuccessOrNotSupported: Indicates that the subrequest MUST be processed only when one of the following conditions is true: If the other subrequest is not supported. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 follow this behavior.)"); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site), @"[In DependencyTypes] OnSuccessOrNotSupported: Indicates that the subrequest MUST be processed only when one of the following conditions is true: If the other subrequest is not supported. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 follow this behavior.)"); } }
public void TestCase_S19_TC01_LockStatus_Success() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); CoauthSubRequestType subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); this.Site.Assert.AreEqual( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), string.Format("Account {0} with client ID {1} and schema lock ID {2} should join the coauthoring session successfully.", this.UserName01, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID)); this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); LockStatusSubRequestType lockStatus = SharedTestSuiteHelper.CreateLockStatusSubRequest(); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { lockStatus }); LockStatusSubResponseType lockStatusResponse = SharedTestSuiteHelper.ExtractSubResponse <LockStatusSubResponseType>(response, 0, 0, this.Site); SubResponseType subresponse = response.ResponseCollection.Response[0].SubResponse[0]; if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Capture the requirement MS-FSSHTTP_R246601 Site.CaptureRequirement( "MS-FSSHTTP", 246601, @"[In Appendix B: Product Behavior] Implementation does support LockStatus operation. (SharePoint Server 2016 and above follow this behavior.)"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2272 Site.CaptureRequirementIfAreEqual <string>( GenericErrorCodeTypes.Success.ToString(), subresponse.ErrorCode, "MS-FSSHTTP", 2272, @"[LockStatusSubResponseType]In the case of success, it contains information requested as part of a LockStatus subrequest. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R401011 Site.CaptureRequirementIfAreEqual <int>( 1, int.Parse(lockStatusResponse.SubResponseData.LockType), "MS-FSSHTTP", 401011, @"[In LockTypes] 1: The integer value ""1"", indicating a shared lock on the file."); } else { Site.Assert.AreEqual <string>( GenericErrorCodeTypes.Success.ToString(), subresponse.ErrorCode, "In the case of success, it contains information requested as part of a LockStatus subrequest. "); } }
public void TestCase_S06_TC01_ServerTime_Success() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Invoke "ServerTime"sub-request with correct input parameters. ServerTimeSubRequestType serverTimeSubRequest = SharedTestSuiteHelper.CreateServerTimeSubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { serverTimeSubRequest }); ServerTimeSubResponseType serverTimeSubResponse = SharedTestSuiteHelper.ExtractSubResponse <ServerTimeSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(serverTimeSubResponse, "The object 'serverTimeSubResponse' should not be null."); this.Site.Assert.IsNotNull(serverTimeSubResponse.ErrorCode, "The object 'serverTimeSubResponse.ErrorCode' should not be null."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error code in the sub-response equals "Success", then capture MS-FSSHTTP_R1342 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1342, @"[In ServerTime Subrequest] The protocol returns results based on the following conditions: Otherwise [except: the processing of the ServerTime subrequest by the server fails to get the server time or encountered an unknown exception], the protocol server sets the error code value to ""Success"" to indicate success in processing the ServerTime subrequest."); bool isVerifyR737 = System.Convert.ToInt64(serverTimeSubResponse.SubResponseData.ServerTime) > 0; this.Site.Log.Add( LogEntryKind.Debug, "For MS-FSSHTTP_R737, expect the serverTime larger than 0, the actual value is " + serverTimeSubResponse.SubResponseData.ServerTime); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R737 Site.CaptureRequirementIfIsTrue( isVerifyR737, "MS-FSSHTTP", 737, @"[In ServerTimeSubResponseDataType] ServerTime: A positive integer that specifies the server time, which is expressed as a tick count."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site), @"[In ServerTime Subrequest] The protocol returns results based on the following conditions: Otherwise [except: the processing of the ServerTime subrequest by the server fails to get the server time or encountered an unknown exception], the protocol server sets the error code value to ""Success"" to indicate success in processing the ServerTime subrequest."); bool isVerifyR737 = System.Convert.ToInt64(serverTimeSubResponse.SubResponseData.ServerTime) > 0; this.Site.Log.Add( LogEntryKind.Debug, "For MS-FSSHTTP_R737, expect the serverTime larger than 0, the actual value is " + serverTimeSubResponse.SubResponseData.ServerTime); Site.Assert.IsTrue( isVerifyR737, @"[In ServerTimeSubResponseDataType] ServerTime: A positive integer that specifies the server time, which is expressed as a tick count."); } }
public void MSFSSHTTP_FSSHTTPB_TestCase_S19_TC01_LockStatus_ExclusiveLock() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Disable the Coauthoring Feature bool isSwitchedSuccessfully = SutPowerShellAdapter.SwitchCoauthoringFeature(true); this.Site.Assert.IsTrue(isSwitchedSuccessfully, "The Coauthoring Feature should be disabled."); this.StatusManager.RecordDisableCoauth(); // Waiting change takes effect System.Threading.Thread.Sleep(30 * 1000); // Join a Coauthoring session CoauthSubRequestType subRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID, true, SharedTestSuiteHelper.DefaultExclusiveLockID); CellStorageResponse cellResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); CoauthSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(cellResponse, 0, 0, this.Site); this.Site.Assert.AreEqual( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), string.Format("Account {0} with client ID {1} and schema lock ID {2} should join the coauthoring session successfully.", this.UserName01, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.DefaultExclusiveLockID)); this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.DefaultExclusiveLockID); LockStatusSubRequestType lockStatus = SharedTestSuiteHelper.CreateLockStatusSubRequest(); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { lockStatus }); LockStatusSubResponseType lockStatusResponse = SharedTestSuiteHelper.ExtractSubResponse <LockStatusSubResponseType>(response, 0, 0, this.Site); SubResponseType subresponse = response.ResponseCollection.Response[0].SubResponse[0]; if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R404011 Site.CaptureRequirementIfAreEqual <int>( 2, int.Parse(lockStatusResponse.SubResponseData.LockType), "MS-FSSHTTP", 404011, @"[In LockTypes] 2: The integer value ""2"", indicating an exclusive lock on the file."); } else { Site.Assert.AreEqual <int>( 2, int.Parse(lockStatusResponse.SubResponseData.LockType), @"2: The integer value ""2"", indicating an exclusive lock on the file."); } }
public void TestCase_S17_TC04_ResourceIdDoesNotExist() { string invalidUrl = this.DefaultFileUrl + "Invalid"; // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Invoke "GetVersions"sub-request with correct invalid parameters. GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest( invalidUrl, new SubRequestType[] { getVersionsSubRequest }, "1", 2, 2, null, null, null, null, null, "test", true); if (Common.IsRequirementEnabled(11023, this.Site)) { GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site); VersionType version = cellStoreageResponse.ResponseVersion as VersionType; Site.Assume.AreEqual <ushort>(3, version.MinorVersion, "This test case runs only when MinorVersion is 3 which indicates the protocol server is capable of performing ResourceID specific behavior."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2171 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.ResourceIdDoesNotExist, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 2171, @"[In GenericErrorCodeTypes] InvalidArgument indicates an error when any of the cell storage service subrequests for the targeted URL for the file contains input parameters that are not valid."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11023 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.ResourceIdDoesNotExist, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11023, @"[In Request] [UseResourceID]In the case where the protocol server is using the ResourceID attribute but the ResourceID attribute does not identify a valid file the protocol server SHOULD set an error code in the ErrorCode attribute of the corresponding Response attribute."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.ResourceIdDoesNotExist, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), @"[In GenericErrorCodeTypes] InvalidArgument indicates an error when any of the cell storage service subrequests for the targeted URL for the file contains input parameters that are not valid."); } } }
public void TestCase_S10_TC07_InvalidRequestDependencyType() { if (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 325, this.Site)) { Site.Assume.Inconclusive("Implementation does not return InvalidRequestDependencyType when the sub-request dependency type that is not valid."); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Create a serverTime subRequest with all valid parameters. ServerTimeSubRequestType serverTimeSubRequest = SharedTestSuiteHelper.CreateServerTimeSubRequest(SequenceNumberGenerator.GetCurrentToken()); // Create a WhoAmI subRequest with all valid parameters and depends on the serverTime subRequest. WhoAmISubRequestType whoAmiSubRequest = SharedTestSuiteHelper.CreateWhoAmISubRequest(SequenceNumberGenerator.GetCurrentToken()); whoAmiSubRequest.DependencyType = DependencyTypes.Invalid; whoAmiSubRequest.DependencyTypeSpecified = true; whoAmiSubRequest.DependsOn = serverTimeSubRequest.SubRequestToken; // Send the subRequest to the protocol server, expect the protocol server returns error code "InvalidRequestDependencyType". CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { serverTimeSubRequest, whoAmiSubRequest }); ServerTimeSubResponseType serverTimeSubResponse = SharedTestSuiteHelper.ExtractSubResponse <ServerTimeSubResponseType>(response, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site), "The serverTime operation should succeed."); SchemaLockSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <SchemaLockSubResponseType>(response, 0, 1, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R325 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.InvalidRequestDependencyType, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), "MS-FSSHTTP", 325, @"[In DependencyCheckRelatedErrorCodeTypes] InvalidRequestDependencyType: Indicates an error when a subrequest dependency type that is not valid is specified. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 follow this behavior.)"); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.InvalidRequestDependencyType, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), @"[In DependencyCheckRelatedErrorCodeTypes] InvalidRequestDependencyType: Indicates an error when a subrequest dependency type that is not valid is specified. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 follow this behavior.)"); } }
public void TestCase_S09_TC03_GetVersions_Success_Results_VersioningDiabled() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site); if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, false)) { this.Site.Assert.Fail("Cannot disable the version on the document library {0}", documentLibraryName); } this.StatusManager.RecordDisableVersioning(documentLibraryName); // Invoke GetVersions sub-request with the file URL that under a document list whose versioning is disabled. GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest }); GetVersionsSubResponseType getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(getVersionsSubResponse, "The object 'getVersionsSubResponse' should not be null."); this.Site.Assert.IsNotNull(getVersionsSubResponse.ErrorCode, "The object 'getVersionsSubResponse.ErrorCode' should not be null."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Make sure the error code value in the response equals "Success". Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), @"The response of the ""getVersions"" sub-request on the file {0} should succeed.", this.DefaultFileUrl); // If the value of "versioning enabled" is 0 under "results" element in the sub-response, then capture MS-FSSHTTP_R2304. Site.CaptureRequirementIfAreEqual <byte>( 0, getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled, "MS-FSSHTTP", 2304, @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: A value of ""0"" indicates that versioning is disabled."); } else { Site.Assert.AreEqual <byte>( 0, getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled, @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: A value of ""0"" indicates that versioning is disabled."); } }