/// <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); }
/// <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 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> /// A method used to create a CellSubRequest object for QueryChanges and initialize it. /// </summary> /// <param name="subRequestId">A parameter represents the subRequest identifier.</param> /// <returns>A return value represents the CellRequest object for QueryChanges.</returns> private CellSubRequestType CreateCellSubRequestEmbeddedQueryChanges(ulong subRequestId) { FsshttpbCellRequest cellRequest = this.CreateFsshttpbCellRequest(); QueryChangesCellSubRequest queryChange = this.BuildFsshttpbQueryChangesSubRequest(subRequestId); cellRequest.AddSubRequest(queryChange, null); CellSubRequestType cellSubRequest = this.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequest.ToBase64()); return(cellSubRequest); }
public void TestCase_S17_TC02_FileOperation_ErrorCode() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); FileOperationSubRequestType fileOperationSubRequest = new FileOperationSubRequestType(); fileOperationSubRequest.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString(); fileOperationSubRequest.SubRequestData = new FileOperationSubRequestDataType(); fileOperationSubRequest.SubRequestData.FileOperation = FileOperationRequestTypes.Rename; fileOperationSubRequest.SubRequestData.FileOperationSpecified = false; fileOperationSubRequest.SubRequestData.ExclusiveLockID = null; CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { fileOperationSubRequest }); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267 if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11267, this.Site)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267 Site.CaptureRequirementIfAreEqual <GenericErrorCodeTypes>( GenericErrorCodeTypes.InvalidArgument, cellStoreageResponse.ResponseVersion.ErrorCode, "MS-FSSHTTP", 11267, @"[In Appendix B: Product Behavior] If the specified attributes[FileOperation] are not provided, the implementation does return error code. <33> Section 2.3.1.33: SharePoint Server 2010 returns an ""InvalidArgument"" error code as part of the SubResponseData element associated with the file operation subresponse(Microsoft Office 2010 suites/Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010/Microsoft SharePoint Workspace 2010 follow this behavior.)"); } // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11268 if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11268, this.Site)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11268 Site.CaptureRequirementIfAreEqual <GenericErrorCodeTypes>( GenericErrorCodeTypes.HighLevelExceptionThrown, cellStoreageResponse.ResponseVersion.ErrorCode, "MS-FSSHTTP", 11268, @"[In Appendix B: Product Behavior] If the specified attributes[FileOperation] are not provided, the implementation does return error code. <33> Section 2.3.1.33: SharePoint Server 2013 and SharePoint Server 2016, return ""HighLevelExceptionThrown"" error code as part of the SubResponseData element associated with the file operation subresponse(Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013/Microsoft SharePoint Server 2016 follow this behavior)."); } } else { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11267, this.Site)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267 Site.Assert.AreEqual <GenericErrorCodeTypes>( GenericErrorCodeTypes.HighLevelExceptionThrown, cellStoreageResponse.ResponseVersion.ErrorCode, @"[In Appendix B: Product Behavior] If the specified attributes[FileOperation attribute] are not provided, the implementation does return an ""InvalidArgument"" error code as part of the SubResponseData element associated with the file opeartion subresponse. (Microsoft Office 2010 suites/Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010/Microsoft SharePoint Workspace 2010/Microsoft Office 2016/Microsoft SharePoint Server 2016/Microsoft Office 2019/Microsoft SharePoint Server 2019 follow this behavior.)"); } } }
public void TestCase_S17_TC02_FileOperation_ErrorCode() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); FileOperationSubRequestType fileOperationSubRequest = new FileOperationSubRequestType(); fileOperationSubRequest.SubRequestToken = SequenceNumberGenerator.GetCurrentToken().ToString(); fileOperationSubRequest.SubRequestData = new FileOperationSubRequestDataType(); fileOperationSubRequest.SubRequestData.FileOperation = FileOperationRequestTypes.Rename; fileOperationSubRequest.SubRequestData.FileOperationRequestTypeSpecified = false; fileOperationSubRequest.SubRequestData.ExclusiveLockID = null; CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { fileOperationSubRequest }); FileOperationSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <FileOperationSubResponseType>(cellStoreageResponse, 0, 0, this.Site); ErrorCodeType errorCode = SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267 if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11267, this.Site)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.InvalidArgument, errorCode, "MS-FSSHTTP", 11267, @"[In Appendix B: Product Behavior] If the specified attributes[FileOperationRequestType attribute] are not provided, the implementation does return an ""InvalidArgument"" error code as part of the SubResponseData element associated with the file opeartion subresponse. (Microsoft Office 2010 suites/Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010/Microsoft SharePoint Workspace 2010/Microsoft Office 2016/Microsoft SharePoint Server 2016 follow this behavior.)"); } } else { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 11267, this.Site)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11267 Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.InvalidArgument, errorCode, @"[In Appendix B: Product Behavior] If the specified attributes[FileOperationRequestType attribute] are not provided, the implementation does return an ""InvalidArgument"" error code as part of the SubResponseData element associated with the file opeartion subresponse. (Microsoft Office 2010 suites/Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010/Microsoft SharePoint Workspace 2010/Microsoft Office 2016/Microsoft SharePoint Server 2016 follow this behavior.)"); } } }
public void TestCase_S09_TC04_GetVersions_Success_Results_VersioningEnabled() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site); if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true)) { this.Site.Assert.Fail("Cannot disable the version on the document library {0}", 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 1 under "results" element in the sub-response, then capture MS-FSSHTTP_R2305. Site.CaptureRequirementIfAreEqual <byte>( 1, getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled, "MS-FSSHTTP", 2305, @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: a value of ""1"" indicates that versioning is enabled. "); } else { Site.Assert.AreEqual <byte>( 1, getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.versioning.enabled, @"[In GetVersionsSubResponseType][Results complex type] versioning.enabled: a value of ""1"" indicates that versioning is enabled. "); } }
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 }); 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."); } 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 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_S17_TC03_ResourceIDNotChanged() { // 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); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "GetVersions 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."); string resourceID = cellStoreageResponse.ResponseCollection.Response[0].ResourceID; // Rename the file string newName = Common.GenerateResourceName(this.Site, "fileName") + ".txt"; FileOperationSubRequestType fileOperationSubRequest = SharedTestSuiteHelper.CreateFileOperationSubRequest(FileOperationRequestTypes.Rename, newName, null, this.Site); cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { fileOperationSubRequest }); FileOperationSubResponseType fileOperationSubResponse = SharedTestSuiteHelper.ExtractSubResponse <FileOperationSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "Rename file should be succeed."); this.DefaultFileUrl = this.DefaultFileUrl.Substring(0, this.DefaultFileUrl.LastIndexOf('/') + 1) + newName; cellStoreageResponse = Adapter.CellStorageRequest( this.DefaultFileUrl, new SubRequestType[] { getVersionsSubRequest }, "1", 2, 2, null, null, null, null, null, null, true); getVersionsSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetVersionsSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "GetVersions should be succeed."); string resourceID2 = cellStoreageResponse.ResponseCollection.Response[0].ResourceID; if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11026 Site.CaptureRequirementIfAreEqual <string>( resourceID, resourceID2, "MS-FSSHTTP", 11026, @"[In Response] [ResourceID] A ResourceID MUST NOT change over the lifetime of a file, even if the URL of the file changes."); } else { Site.Assert.AreEqual <string>( resourceID, resourceID2, "ResourceID MUST NOT change over the lifetime of a file, even if the URL of the file changes."); } }
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 TestCase_S14_TC01_AllocateExtendedGuidRange_Success() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Allocate Extended GUID Range Compact64bitInt requestIdCount = new Compact64bitInt(8000); CellSubRequestType allocateRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedAllocateExtendedGuidRange((int)SequenceNumberGenerator.GetCurrentToken(), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), requestIdCount); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { allocateRequest }); CellSubResponseType cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.", this.DefaultFileUrl); FsshttpbResponse fsshttpbResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(cellSubResponse, this.Site); SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(fsshttpbResponse, this.Site); // Extract the Allocate ExtendedGuid Range sub-response info this.Site.Assert.IsTrue(fsshttpbResponse.CellSubResponses.Count > 0, "The protocol server should return SubResponse for Allocate ExtendedGuid Range sub-request processing."); this.Site.Assert.IsNotNull(fsshttpbResponse.CellSubResponses[0].GetSubResponseData <AllocateExtendedGuidRangeSubResponseData>(), "The protocol server should return SubResponseData for Allocate ExtendedGuid Range sub-request processing."); AllocateExtendedGuidRangeSubResponseData allocateResponse = fsshttpbResponse.CellSubResponses[0].GetSubResponseData <AllocateExtendedGuidRangeSubResponseData>(); // Assert for elements in Allocate Extended Guid Range sub-response this.Site.Assert.IsNotNull(allocateResponse.AllocateExtendedGUIDRangeResponse, "The protocol server should return Allocate Extended GUID Range Response."); this.Site.Assert.IsNotNull(allocateResponse.GUIDComponent, "The protocol server should allocate ExtendedGuids as requested."); this.Site.Assert.IsNotNull(allocateResponse.IntegerRangeMin, "The protocol server should return an integer Range Min in the sub-response."); this.Site.Assert.IsNotNull(allocateResponse.IntegerRangeMax, "The protocol server should return an integer Range Max in the sub-response."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTPB requirement: MS-FSSHTTPB_R9005 Site.CaptureRequirement( "MS-FSSHTTPB", 99099, @"[In Appendix B: Product Behavior] The implementation does support this sub-request [Allocate ExtendedGuid Range Sub-Request]( SharePoint Server 2013 and above follow this behavior.)"); } // Allocate Extended GUID Range value less than 1000. requestIdCount = new Compact64bitInt(100); allocateRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedAllocateExtendedGuidRange((int)SequenceNumberGenerator.GetCurrentToken(), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), requestIdCount); response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { allocateRequest }); cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.", this.DefaultFileUrl); // Allocate Extended GUID Range value less than 100000. requestIdCount = new Compact64bitInt(150000); allocateRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedAllocateExtendedGuidRange((int)SequenceNumberGenerator.GetCurrentToken(), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), requestIdCount); response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { allocateRequest }); cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.", this.DefaultFileUrl); }
public void TestCase_S05_TC01_WhoAmI_Success() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Invoke "WhoAmI"sub-request with correct input parameters. WhoAmISubRequestType whoAmISubRequest = SharedTestSuiteHelper.CreateWhoAmISubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { whoAmISubRequest }); WhoAmISubResponseType whoAmISubResponse = SharedTestSuiteHelper.ExtractSubResponse <WhoAmISubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(whoAmISubResponse, "The object 'whoAmISubResponse' should not be null."); this.Site.Assert.IsNotNull(whoAmISubResponse.ErrorCode, "The object 'whoAmISubResponse.ErrorCode' should not be null."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error code in the sub-response equals "Success", then capture MS-FSSHTTP_R1327, MS-FSSHTTP_R1434. Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(whoAmISubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1327, @"[In WhoAmI Subrequest] The protocol server returns results based on the following conditions: Otherwise[except: the processing of the WhoAmI subrequest by the protocol server failed to get the client-specific user information or encountered an unknown exception], the protocol server sets the error code value to ""Success"" to indicate success in processing the WhoAmI subrequest."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1434 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(whoAmISubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1434, @"[In WhoAmISubResponseType] The protocol server sets the value of the ErrorCode attribute to ""Success"" if the protocol server succeeds in processing the WhoAmI subrequest."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R7681 Site.CaptureRequirementIfIsNotNull( whoAmISubResponse.SubResponseData, "MS-FSSHTTP", 7681, @"[In WhoAmISubResponseType] As part of processing the WhoAmI subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true: The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success""."); bool isVerifyR904 = whoAmISubResponse.SubResponseData.UserName.IndexOf(this.UserName01, System.StringComparison.OrdinalIgnoreCase) >= 0; this.Site.Log.Add( LogEntryKind.Debug, "For MS-FSSHTTP_R904, expect the UserName attribute contains the value {0}, the actual UserName attribute value is {1}", this.UserName01, whoAmISubResponse.SubResponseData.UserName); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R904 Site.CaptureRequirementIfIsTrue( isVerifyR904, "MS-FSSHTTP", 904, @"[In WhoAmISubResponseDataOptionalAttributes] UserName: [A UserNameType] that specifies the user name for the protocol client."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(whoAmISubResponse.ErrorCode, this.Site), @"[In WhoAmI Subrequest] The protocol server returns results based on the following conditions: Otherwise[except: the processing of the WhoAmI subrequest by the protocol server failed to get the client-specific user information or encountered an unknown exception], the protocol server sets the error code value to ""Success"" to indicate success in processing the WhoAmI subrequest."); Site.Assert.IsNotNull( whoAmISubResponse.SubResponseData, @"[In WhoAmISubResponseType] As part of processing the WhoAmI subrequest, the SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the following condition is true: The ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success""."); bool isVerifyR904 = whoAmISubResponse.SubResponseData.UserName.IndexOf(this.UserName01, System.StringComparison.OrdinalIgnoreCase) >= 0; Site.Assert.IsTrue( isVerifyR904, @"[In WhoAmISubResponseDataOptionalAttributes] UserName: [A UserNameType] that specifies the user name for the client."); } }
public void TestCase_S20_TC01_Properties_Success() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); string[] ids = new string[] { "RealtimeTypingEndpointUrl", "DocumentAccessToken", "DocumentAccessTokenTtl" }; PropertyIdType propertyId = new PropertyIdType(); PropertyIdType[] propertyIds = new PropertyIdType[3]; for (int i = 0; i < ids.Length; i++) { propertyId.id = ids[i]; propertyIds[i] = propertyId; } PropertiesSubRequestType properties = SharedTestSuiteHelper.CreatePropertiesSubRequest(SequenceNumberGenerator.GetCurrentToken(), PropertiesRequestTypes.PropertyGet, propertyIds, this.Site); CellStorageResponse cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { properties }); PropertiesSubResponseType propertiesResponse = SharedTestSuiteHelper.ExtractSubResponse <PropertiesSubResponseType>(cellStorageResponse, 0, 0, this.Site); SubResponseType subresponse = cellStorageResponse.ResponseCollection.Response[0].SubResponse[0]; if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Capture the requirement MS-FSSHTTP_R246801 Site.CaptureRequirement( "MS-FSSHTTP", 246801, @"[In Appendix B: Product Behavior] Implementation does support Properties operation. (SharePoint Server 2016 and above follow this behavior.)"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2301011 Site.CaptureRequirementIfAreEqual <string>( GenericErrorCodeTypes.Success.ToString(), subresponse.ErrorCode, "MS-FSSHTTP", 2301011, @"[PropertiesSubResponseType]In the case of success, it contains information requested as part of a Properties subrequest. "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2443 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subresponse.ErrorCode, this.Site), "MS-FSSHTTP", 2443, @"[Properties Subrequest][The protocol server returns results based on the following conditions:]An ErrorCode value of ""Success"" indicates success in processing the Properties request."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2447 Site.CaptureRequirement( "MS-FSSHTTP", 2447, @"[Property Get]If the Properties attribute is set to ""PropertyGet"", the protocol server considers the Properties subrequest to be of type ""Property Get "". "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2299 Site.CaptureRequirementIfIsNotNull( propertiesResponse.SubResponseData.PropertyValues, "MS-FSSHTTP", 2299, @"[PropertiesSubResponseDataType][PropertyValues]This element MUST only be included in the response if the Properties attribute value is set to ""PropertyGet""."); } else { Site.Assert.AreEqual <string>( GenericErrorCodeTypes.Success.ToString(), subresponse.ErrorCode, "[PropertiesSubResponseType]In the case of success, it contains information requested as part of a Properties subrequest. "); } }
public void TestCase_S10_TC09_DependencyTypeOnExecute() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Create a coauthoring subRequest with all valid parameters. CoauthSubRequestType firstCoauthSubRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); // Create another coauthoring subRequest which depends on the previous coauthoring subRequest and set the dependency type to OnFail so as to make the second subRequest not executed. CoauthSubRequestType secondCoauthSubRequest = SharedTestSuiteHelper.CreateCoauthSubRequestForJoinCoauthSession(Guid.NewGuid().ToString(), SharedTestSuiteHelper.ReservedSchemaLockID); secondCoauthSubRequest.DependencyType = DependencyTypes.OnFail; secondCoauthSubRequest.DependencyTypeSpecified = true; secondCoauthSubRequest.DependsOn = firstCoauthSubRequest.SubRequestToken; // Create a serverTime subRequest which depends on the second coauthoring subRequest and set the dependency type to OnExecute. // Create a ServerTime subRequest which depends on the coauthoring subRequest. ServerTimeSubRequestType serverTimeSubRequest = SharedTestSuiteHelper.CreateServerTimeSubRequest(SequenceNumberGenerator.GetCurrentToken()); serverTimeSubRequest.DependsOn = secondCoauthSubRequest.SubRequestToken; serverTimeSubRequest.DependencyType = DependencyTypes.OnExecute; serverTimeSubRequest.DependencyTypeSpecified = true; // Send these three subRequests to the protocol server, expect the protocol server returns error code "Success" for the first coauthoring subRequest, returns "DependentOnlyOnFailRequestSucceeded" for the second coauthoring subRequest and returns "DependentRequestNotExecuted" for the severTime subRequest. CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { firstCoauthSubRequest, secondCoauthSubRequest, serverTimeSubRequest }); this.StatusManager.RecordCoauthSession(this.DefaultFileUrl, SharedTestSuiteHelper.DefaultClientID, SharedTestSuiteHelper.ReservedSchemaLockID); CoauthSubResponseType firstCoauthSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(response, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(firstCoauthSubResponse.ErrorCode, this.Site), "The first coauthoring operation should succeed."); CoauthSubResponseType secondCoauthSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CoauthSubResponseType>(response, 0, 1, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.DependentOnlyOnFailRequestSucceeded, SharedTestSuiteHelper.ConvertToErrorCodeType(secondCoauthSubResponse.ErrorCode, this.Site), "The second coauthoring operation should not be executed."); ServerTimeSubResponseType serverTimeSubResponse = SharedTestSuiteHelper.ExtractSubResponse <ServerTimeSubResponseType>(response, 0, 2, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 332, this.Site)) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R332 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.DependentRequestNotExecuted, SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 332, @"[In DependencyTypes] OnExecute:Indicates that the subrequest MUST be processed only on the execution of the other subrequest. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 follow this behavior.)"); Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.DependentRequestNotExecuted, SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 321, @"[In DependencyCheckRelatedErrorCodeTypes] DependentRequestNotExecuted: Indicates an error when the subrequest on which this specific subrequest is dependent has not been executed and the DependencyType attribute in this subrequest is set to ""OnExecute""."); } } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.DependentRequestNotExecuted, SharedTestSuiteHelper.ConvertToErrorCodeType(serverTimeSubResponse.ErrorCode, this.Site), @"[In DependencyTypes] OnExecute:Indicates that the subrequest MUST be processed only on the execution of the other subrequest. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 follow this behavior.)"); } }
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_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_TC01_GetVersions_Success() { // 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); 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) { // If the value of attribute "ErrorCode" in the sub-response equals "Success", then capture MS-FSSHTTP_R2029. Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 2029, @"[In GetVersions Subrequest][The protocol returns results based on the following conditions:] Otherwise[the processing of the GetVersions subrequest by the protocol server get the requested versions information successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetVersions subrequest."); // Capture the requirement MS-FSSHTTP_R10004 Site.CaptureRequirement( "MS-FSSHTTP", 10004, @"[In Appendix B: Product Behavior] Implementation does support this operation[GetVersions]. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 and above follow this behavior.)"); VersionType version = cellStoreageResponse.ResponseVersion as VersionType; // MinorVersion 3 indicates the protocol server is capable of performing ResourceID specific behavior. if (Common.IsRequirementEnabled(11275, this.Site) && version.MinorVersion == 3) { // Capture the requirement MS-FSSHTTP_R11275 Site.CaptureRequirementIfIsNotNull( cellStoreageResponse.ResponseCollection.Response[0].ResourceID, "MS-FSSHTTP", 11275, @"[In Appendix B: Product Behavior] The ResourceID attribute is present when the UseResourceID attribute is set to true in the corresponding Request element, [and SHOULD NOT be present otherwise]. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11025 Site.CaptureRequirementIfIsNotNull( cellStoreageResponse.ResponseCollection.Response[0].ResourceID, "MS-FSSHTTP", 11025, @"[In Response] ResourceID: A string that specifies the invariant ResourceID for a file, which uniquely identifies the file whose response is being generated."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11029 Site.CaptureRequirementIfIsTrue( !string.IsNullOrEmpty(cellStoreageResponse.ResponseCollection.Response[0].ResourceID), "MS-FSSHTTP", 11029, @"[In Response] [ResourceID] If present, the string value MUST NOT be an empty string."); // Capture the requirement MS-FSSHTTP_R11271 Site.CaptureRequirementIfIsNotNull( cellStoreageResponse.ResponseCollection.Response[0].ResourceID, "MS-FSSHTTP", 11271, @"[In Appendix B: Product Behavior] [UseResourceID] When true, the implementation sets the ResourceID attribute on the corresponding Response element to the ResourceID of the file. (Microsoft SharePoint Foundation 2010/Microsoft SharePoint Server 2010 and above follow this behavior.)"); } } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), @"[In GetVersions Subrequest][The protocol returns results based on the following conditions:] Otherwise[the processing of the GetVersions subrequest by the protocol server get the requested versions information successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetVersions subrequest."); } }
public void TestCase_S09_TC05_GetVersions_Success_Results_VersionData() { string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site); if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true)) { this.Site.Assert.Fail("Cannot disable the version on the document library {0}", documentLibraryName); } // Prepare a file. string fileUrl = this.PrepareFile(); // Initialize the context this.InitializeContext(fileUrl, this.UserName01, this.Password01, this.Domain); // Check out one file by a specified user name. if (!this.SutPowerShellAdapter.CheckOutFile(fileUrl, 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}", fileUrl, this.UserName01, this.Password01); } this.StatusManager.RecordFileCheckOut(fileUrl, this.UserName01, this.Password01, this.Domain); string checkInComments1 = "New Comment1 for testing purpose on the operation GetVersions."; if (!SutPowerShellAdapter.CheckInFile(fileUrl, this.UserName01, this.Password01, this.Domain, checkInComments1)) { this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", fileUrl, this.UserName01, this.Password01); } this.StatusManager.CancelRecordCheckOut(fileUrl); // Check out one file by a specified user name again. if (!this.SutPowerShellAdapter.CheckOutFile(fileUrl, this.UserName02, this.Password02, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", fileUrl, this.UserName02, this.Password02); } this.StatusManager.RecordFileCheckOut(fileUrl, this.UserName02, this.Password02, this.Domain); string checkInComments2 = "New Comment2 for testing purpose on the operation GetVersions."; if (!SutPowerShellAdapter.CheckInFile(fileUrl, this.UserName02, this.Password02, this.Domain, checkInComments2)) { this.Site.Assert.Fail("Cannot change the file {0} to check in status using the user name {1} and password {2}", fileUrl, this.UserName02, this.Password02); } this.StatusManager.CancelRecordCheckOut(fileUrl); // Query changes from the protocol server CellSubRequestType queryChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); CellStorageResponse queryResponse = Adapter.CellStorageRequest(fileUrl, new SubRequestType[] { queryChange }); CellSubResponseType querySubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(queryResponse, 0, 0, this.Site); this.Site.Assert.AreEqual(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(querySubResponse.ErrorCode, this.Site), "The operation QueryChanges should succeed."); FsshttpbResponse fsshttpbResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(querySubResponse, this.Site); SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(fsshttpbResponse, this.Site); int contentLength = new RootNodeObject.RootNodeObjectBuilder().Build( fsshttpbResponse.DataElementPackage.DataElements, fsshttpbResponse.CellSubResponses[0].GetSubResponseData <QueryChangesSubResponseData>().StorageIndexExtendedGUID).GetContent().Count; // Invoke "GetVersions" sub-request with the test file URL that under a document list which is enable versioning. GetVersionsSubRequestType getVersionsSubRequest = SharedTestSuiteHelper.CreateGetVersionsSubRequest(SequenceNumberGenerator.GetCurrentToken()); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(fileUrl, 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."); // 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 (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the result contains 3 versions (1.the original, 2. User01 checked in, 3 User02 checked in), then the MS-FSSHTTP requirement: MS-FSSHTTP_R2307 is verified. Site.CaptureRequirementIfAreEqual <int>( 3, getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result.Length, "MS-FSSHTTP", 2307, @"[In GetVersionsSubResponseType][Results complex type] result: A separate result element MUST exist for each version of the file that the user can access."); // If the result contains 3 versions (1.the original, 2. User01 checked in, 3 User02 checked in), then the MS-FSSHTTP requirement: MS-FSSHTTP_R30841 is verified. Site.CaptureRequirementIfAreEqual <int>( 3, getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result.Length, "MS-FSSHTTP", 30841, @"[In GetVersionsResponse] GetVersionsResult: An XML node that contains the details about all the versions of the specified file that the user can access."); } else { Site.Assert.AreEqual <int>( 3, getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result.Length, @"[In GetVersionsSubResponseType][Results complex type] result: A separate result element MUST exist for each version of the file that the user can access."); } bool isFindVersion = false; bool isNotStartWithAt = false; foreach (VersionData item in getVersionsSubResponse.GetVersionsResponse.GetVersionsResult.results.result) { if (string.Compare(checkInComments2, item.comments, StringComparison.OrdinalIgnoreCase) == 0) { bool isCreatedBy = item.createdBy != null && item.createdBy.IndexOf(this.UserName02, System.StringComparison.OrdinalIgnoreCase) >= 0; this.Site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2312, expect the CreatedBy contains the user name {0}, the actual value is {1}", this.UserName02, item.createdBy); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2312 Site.CaptureRequirementIfIsTrue( isCreatedBy, "MS-FSSHTTP", 2312, @"[In GetVersionsSubResponseType][VersionData complex type] createdBy: The creator of the version of the file."); bool isCreatedByName = item.createdByName != null && item.createdByName.IndexOf(this.UserName02, System.StringComparison.OrdinalIgnoreCase) >= 0; this.Site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2313, expect the createdByName contains the user name {0}, the actual value is {1}", this.UserName02, item.createdByName); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2313 Site.CaptureRequirementIfIsTrue( isCreatedByName, "MS-FSSHTTP", 2313, @"[In GetVersionsSubResponseType][VersionData complex type] createdByName: The display name of the creator of the version of the file."); bool isVersion = item.version != null && item.version.StartsWith("@", StringComparison.OrdinalIgnoreCase); this.Site.Log.Add( LogEntryKind.Debug, "For requirement MS-FSSHTTP_R2309, expect the version start with @, the actual value is {0}", item.version); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2309 Site.CaptureRequirementIfIsTrue( isVersion, "MS-FSSHTTP", 2309, @"[In GetVersionsSubResponseType][VersionData complex type] version: The most recent version of the file MUST be preceded with an at sign (@)."); // Using UNICODE, so the actual file size will double the length 5. Site.CaptureRequirementIfAreEqual <ulong>( (ulong)contentLength, item.size, "MS-FSSHTTP", 2314, @"[In GetVersionsSubResponseType][VersionData complex type] size: The size, in bytes, of the version of the file."); // If go through here, then the requirement MS-FSSHTTP_R2315 can be directly captured. Site.CaptureRequirement( "MS-FSSHTTP", 2315, @"[In GetVersionsSubResponseType][VersionData complex type] comments: The comment entered when the version of the file was replaced on the protocol server during check in."); } else { Site.Assert.IsTrue( isCreatedBy, @"[In GetVersionsSubResponseType][VersionData complex type] createdBy: The creator of the version of the file."); Site.Assert.IsNotNull( item.createdRaw, @"[In GetVersionsSubResponseType] Implementation does return this attribute[createdRaw]. [In VersionData] createdRaw: The creation date and time for the version of the file in DateTime format, as specified in [ISO-8601]. (Microsoft SharePoint Foundation 2010 and above follow this behavior.)"); bool isCreatedByName = item.createdByName != null && item.createdByName.IndexOf(this.UserName02, System.StringComparison.OrdinalIgnoreCase) >= 0; Site.Assert.IsTrue( isCreatedByName, @"[In GetVersionsSubResponseType][VersionData complex type] createdByName: The display name of the creator of the version of the file."); bool isVersion = item.version != null && item.version.StartsWith("@", StringComparison.OrdinalIgnoreCase); Site.Assert.IsTrue( isVersion, @"[In GetVersionsSubResponseType][VersionData complex type] version: The most recent version of the file MUST be preceded with an at sign (@)."); Site.Assert.AreEqual <ulong>( (ulong)contentLength, item.size, @"[In GetVersionsSubResponseType][VersionData complex type] size: The size, in bytes, of the version of the file."); } isFindVersion = true; } else { isNotStartWithAt = !item.version.StartsWith("@", StringComparison.OrdinalIgnoreCase); } } if (!isFindVersion) { this.Site.Assert.Fail("Cannot find the Version record for the comment {0}", checkInComments2); } Site.Log.Add( LogEntryKind.Debug, "All the other versions MUST exist without any prefix, and actually they {0} have prefix.", isNotStartWithAt ? "do not" : "do"); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2310 Site.CaptureRequirementIfIsTrue( isNotStartWithAt, "MS-FSSHTTP", 2310, @"[In GetVersionsSubResponseType][VersionData complex type] version: All the other versions MUST exist without any prefix. "); } else { Site.Assert.IsTrue( isNotStartWithAt, @"[In GetVersionsSubResponseType][VersionData complex type] version: All the other versions MUST exist without any prefix. "); } }
public void TestCase_S09_TC01_GetVersions_Success() { // 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 }); 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) { // If the value of attribute "ErrorCode" in the sub-response equals "Success", then capture MS-FSSHTTP_R2029. Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 2029, @"[In GetVersions Subrequest][The protocol returns results based on the following conditions:] Otherwise[the processing of the GetVersions subrequest by the protocol server get the requested versions information successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetVersions subrequest."); // Capture the requirement MS-FSSHTTP_R10004 Site.CaptureRequirement( "MS-FSSHTTP", 10004, @"[In Appendix B: Product Behavior] Implementation does support this operation[GetVersions]. (Microsoft SharePoint Foundation 2013/Microsoft SharePoint Server 2013 follow this behavior.)"); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getVersionsSubResponse.ErrorCode, this.Site), @"[In GetVersions Subrequest][The protocol returns results based on the following conditions:] Otherwise[the processing of the GetVersions subrequest by the protocol server get the requested versions information successfully], the protocol server sets the error code value to ""Success"" to indicate success in processing the GetVersions subrequest."); } }
public void MSFSSHTTP_FSSHTTPB_TestCase_S16_TC01_Versioning_EmptyUrl() { // 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(string.Empty, new SubRequestType[] { versioningSubRequest }); if (Common.IsRequirementEnabled(11151, this.Site)) { SubResponseType subResponse = cellStoreageResponse.ResponseCollection.Response[0].SubResponse[0]; ErrorCodeType errorCode = SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11151 Site.CaptureRequirementIfAreNotEqual <ErrorCodeType>( ErrorCodeType.Success, errorCode, "MS-FSSHTTP", 11151, @"[In VersioningSubResponseType] 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 <ErrorCodeType>( ErrorCodeType.Success, errorCode, "Error should occur if call versioning request with empty url."); } } }
public void TestCase_S14_TC02_AllocateExtendedGuidRange_ReservedIgnore() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); FsshttpbCellRequest fsshttpRequest = SharedTestSuiteHelper.CreateFsshttpbCellRequest(); AllocateExtendedGuidRangeCellSubRequest allocateExtendedGuidRange = new AllocateExtendedGuidRangeCellSubRequest(new Compact64bitInt(8000), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); // Make the reserved value equal to 0. allocateExtendedGuidRange.Reserved = 0; fsshttpRequest.AddSubRequest(allocateExtendedGuidRange, null); CellSubRequestType cellSubRequest = SharedTestSuiteHelper.CreateCellSubRequest((ulong)SequenceNumberGenerator.GetCurrentToken(), fsshttpRequest.ToBase64()); CellStorageResponse response = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest }); CellSubResponseType cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.", this.DefaultFileUrl); FsshttpbResponse fsshttpbResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(cellSubResponse, this.Site); SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(fsshttpbResponse, this.Site); FsshttpbCellRequest fsshttpRequestSecond = SharedTestSuiteHelper.CreateFsshttpbCellRequest(); AllocateExtendedGuidRangeCellSubRequest allocateExtendedGuidRangeSecond = new AllocateExtendedGuidRangeCellSubRequest(new Compact64bitInt(8000), SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); // Make the reserved value equal to 1. allocateExtendedGuidRangeSecond.Reserved = 1; fsshttpRequestSecond.AddSubRequest(allocateExtendedGuidRangeSecond, null); CellSubRequestType cellSubRequestSecond = SharedTestSuiteHelper.CreateCellSubRequest((ulong)SequenceNumberGenerator.GetCurrentToken(), fsshttpRequestSecond.ToBase64()); CellStorageResponse responseSecond = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequestSecond }); CellSubResponseType cellSubResponseSecond = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(responseSecond, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponseSecond.ErrorCode, this.Site), "Test case cannot continue unless the allocate extended guid range operation on the file {0} succeed.", this.DefaultFileUrl); FsshttpbResponse fsshttpbResponseSecond = SharedTestSuiteHelper.ExtractFsshttpbResponse(cellSubResponseSecond, this.Site); SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(fsshttpbResponseSecond, this.Site); // Compare this two responses roughly, and if these two responses are identical in main part, then capture the requirement MS-FSSHTTPB_R2189 bool isVerifyR2189 = SharedTestSuiteHelper.ComapreSucceedFsshttpAllocateExtendedGuidRangeResposne(fsshttpbResponse, fsshttpbResponseSecond, this.Site); this.Site.Log.Add(TestTools.LogEntryKind.Debug, "Expect the two allocate extended GUID range responses are same, actual {0}", isVerifyR2189); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTPB requirement: MS-FSSHTTPB_R2189 Site.CaptureRequirementIfIsTrue( isVerifyR2189, "MS-FSSHTTPB", 2189, @"[In Allocate Extended GUID Range] A - Reserved (8 bits): Whenever A - Reserved is set to one or zero, the protocol server must return the same response."); } else { Site.Assert.IsTrue( isVerifyR2189, @"[In Allocate Extended GUID Range] A - Reserved (8 bits): Whenever A - Reserved is set to one or zero, the protocol server must return the same response."); } }
public void MSFSSHTTP_FSSHTTPB_S05_TC01_WhoAmI_ClaimsBased() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3086, this.Site)) { // Enable the windows-based authentication bool isSwitchedSuccessfully = SutPowerShellAdapter.SwitchClaimsAuthentication(false); this.Site.Assert.IsTrue(isSwitchedSuccessfully, "The windows-based authentication should be enabled successfully."); this.StatusManager.RecordDisableClaimsBasedAuthentication(); } int waitTime = Common.GetConfigurationPropertyValue <int>("WaitTime", this.Site); int retryCount = Common.GetConfigurationPropertyValue <int>("RetryCount", this.Site); WhoAmISubRequestType subRequest = null; CellStorageResponse response = null; WhoAmISubResponseType subResponse = null; while (retryCount > 0) { // Create a WhoAmI subRequest with all valid parameters subRequest = SharedTestSuiteHelper.CreateWhoAmISubRequest(SequenceNumberGenerator.GetCurrentToken()); response = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); subResponse = SharedTestSuiteHelper.ExtractSubResponse <WhoAmISubResponseType>(response, 0, 0, this.Site); Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), "WhoAmI subRequest should be succeed."); Regex regex = new Regex(@"^[a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*"); if (regex.IsMatch(subResponse.SubResponseData.UserLogin)) { break; } retryCount--; if (retryCount == 0) { Site.Assert.Fail("Additional authentication prefix should not exist in UserLogin if claim-based authentication mode is enabled"); } System.Threading.Thread.Sleep(waitTime); } if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3087 Regex regex = new Regex(@"^[a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*"); bool isVerifiedR3087 = regex.IsMatch(subResponse.SubResponseData.UserLogin); Site.Log.Add( LogEntryKind.Debug, @"The UserLoginType will match pattern ^[a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*, actually its value is {0}", subResponse.SubResponseData.UserLogin); this.Site.CaptureRequirementIfIsTrue( isVerifiedR3087, "MS-FSSHTTP", 3087, @"[In Appendix B: Product Behavior] If claims-based authentication mode isn't enabled, the implementation does return the UserLogin attribute which apply the following schema: <xs:simpleType name=""UserLoginType""> <xs:restriction base=""xs:string""> <xs:pattern value=""^[a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*""/> </xs:restriction> </xs:simpleType>"); } // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3086 if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3086, this.Site)) { // Enable the claims-based authentication bool isSwitchedSuccessfully = SutPowerShellAdapter.SwitchClaimsAuthentication(true); this.Site.Assert.IsTrue(isSwitchedSuccessfully, "The claims-based authentication should be enabled successfully."); waitTime = Common.GetConfigurationPropertyValue <int>("WaitTime", this.Site); retryCount = Common.GetConfigurationPropertyValue <int>("RetryCount", this.Site); while (retryCount > 0) { // Send the WhoAmI subRequest to the protocol server response = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); subResponse = SharedTestSuiteHelper.ExtractSubResponse <WhoAmISubResponseType>(response, 0, 0, this.Site); Site.Assert.AreEqual <ErrorCodeType>(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(subResponse.ErrorCode, this.Site), "WhoAmI subRequest should be succeed."); Regex r2 = new Regex(@"([a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*)$"); Match match = r2.Match(subResponse.SubResponseData.UserLogin); if (r2.IsMatch(subResponse.SubResponseData.UserLogin) && match.Success && match.Index > 0) { break; } retryCount--; if (retryCount == 0) { Site.Assert.Fail("Additional authentication prefix should not exist in UserLogin if claim-based authentication mode is enabled"); } System.Threading.Thread.Sleep(waitTime); } Regex regex2 = new Regex(@"([a-zA-Z]([a-zA-Z0-9\-_])*\\[a-zA-Z]([a-zA-Z0-9])*)$"); Match m = regex2.Match(subResponse.SubResponseData.UserLogin); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { Site.Log.Add( LogEntryKind.Debug, string.Format("The UserLogin should have prefix when the authentication is claims based, actual the prefix {0}", m.Index > 0 ? "exists" : "does not exist")); this.Site.CaptureRequirementIfIsTrue( m.Success && m.Index > 0, "MS-FSSHTTP", 3086, @"[In Appendix B: Product Behavior] Implementation does add an additional authentication prefix for the UserLogin attribute. (Microsoft SharePoint Foundation 2016/Microsoft SharePoint Server 2016 and above follow this behavior.)"); } else { Site.Log.Add( LogEntryKind.Debug, string.Format("The UserLogin should have prefix when the authentication is claims based, actual the prefix {0}", m.Index > 0 ? "exists" : "does not exist")); this.Site.Assert.IsTrue( m.Success && m.Index > 0, @"[In Appendix B: Product Behavior] Implementation does add an additional authentication prefix for the UserLogin attribute. <28> Section 2.3.2.6: There is an additional authentication prefix if claims-based authentication mode is enabled. (Microsoft SharePoint Foundation 2016/Microsoft SharePoint Server 2016 and above follow this behavior.)"); } } }
public void MSFSSHTTP_FSSHTTPB_S09_TC01_GetVersions_EmptyUrl() { // 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 response = Adapter.CellStorageRequest(string.Empty, new SubRequestType[] { getVersionsSubRequest }); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3009 if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site)) { if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { 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 { 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 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_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."); } }
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."); } }