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_S16_TC01_Versioning_GetVersionList_Success() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); 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."); VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.GetVersionList, null, this.Site); cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { versioningSubRequest }); VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(versioningSubResponse, "The object 'versioningSubResponse' should not be null."); this.Site.Assert.IsNotNull(versioningSubResponse.ErrorCode, "The object 'versioningSubResponse.ErrorCode' should not be null."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11146 Site.CaptureRequirementIfIsNotNull( versioningSubResponse.SubResponseData.UserTable, "MS-FSSHTTP", 11146, @"[In VersioningSubResponseDataType] The UserTable element MUST be included in the response if the SubResponseType of the parent VersioningSubResponseType is of type ""GetVersionList."""); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11053 Site.CaptureRequirementIfIsNotNull( versioningSubResponse.SubResponseData.UserTable, "MS-FSSHTTP", 11053, @"[In SubResponseDataGenericType] The UserTable element MUST be included in the response if the SubResponseType of the parent VersioningSubResponseType is of type ""GetVersionList."""); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11148 Site.CaptureRequirementIfIsNotNull( versioningSubResponse.SubResponseData.Versions, "MS-FSSHTTP", 11148, @"[In VersioningSubResponseDataType] The Versions element MUST be included in the response if the SubResponseType of the parent VersioningSubResponseType is of type ""GetVersionList."""); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11055 Site.CaptureRequirementIfIsNotNull( versioningSubResponse.SubResponseData.Versions, "MS-FSSHTTP", 11055, @"[In SubResponseDataGenericType] The Versions element MUST be included in the response if the SubResponseType of the parent VersioningSubResponseType is of type ""GetVersionList."""); bool isR1117501Verified = bool.Parse(versioningSubResponse.SubResponseData.Versions.Version[0].IsCurrent); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1117501 Site.CaptureRequirementIfIsTrue( isR1117501Verified, "MS-FSSHTTP", 1117501, @"[In FileVersionDataType] IsCurrent: True specifies this version is the most recent version of the file."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11150 // This requirement can be captured directly after capturing MS-FSSHTTP_R11146 and MS-FSSHTTP_R11148 Site.CaptureRequirement( "MS-FSSHTTP", 11150, @"[In VersioningSubResponseType] In the case of success, it contains information requested as part of a versioning subrequest."); GetDocMetaInfoPropertyType lastModifiedProperty = null; foreach (GetDocMetaInfoPropertyType property in getDocMetaInfoSubResponse.SubResponseData.DocProps.Property) { if (property.Key.ToLower().Contains("timelastmodified")) { lastModifiedProperty = property; } } Site.Assert.IsNotNull(lastModifiedProperty, "Property for last modified time should be found."); System.DateTime time = Convert.ToDateTime(lastModifiedProperty.Value); long lastModifiedTime = long.Parse(versioningSubResponse.SubResponseData.Versions.Version[0].LastModifiedTime); bool isR11179Verified = ((lastModifiedTime / 10000000) == (time - new System.DateTime(1601, 1, 1, 0, 0, 0)).TotalSeconds); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11179 Site.CaptureRequirementIfIsTrue( isR11179Verified, "MS-FSSHTTP", 11179, @"[In FileVersionDataType] LastModifiedTime specifies the number of 100-nanosecond intervals that have elapsed since 00:00:00 on January 1, 1601, which MUST be Coordinated Universal Time (UTC)."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11178 // Calculate expected last modified time by multiple the time span with ten million, this requirement can be captured. Site.CaptureRequirementIfIsTrue( isR11179Verified, "MS-FSSHTTP", 11178, @"[In FileVersionDataType] A single tick represents 100 nanoseconds, or one ten-millionth of a second."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11180 Site.CaptureRequirementIfAreEqual <string>( versioningSubResponse.SubResponseData.UserTable.User[0].UserId, versioningSubResponse.SubResponseData.Versions.Version[0].UserId, "MS-FSSHTTP", 11180, @"[In FileVersionDataType] UserId: An integer that specifies the user that last modified the version of the file."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11181 Site.CaptureRequirementIfAreEqual <string>( versioningSubResponse.SubResponseData.UserTable.User[0].UserId, versioningSubResponse.SubResponseData.Versions.Version[0].UserId, "MS-FSSHTTP", 11181, @"[In FileVersionDataType] The number MUST match the UserId attribute of a UserDataType (section 2.3.1.42) described in the VersioningUserTableType in the current VersioningSubResponseDataType."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11249 Site.CaptureRequirement( "MS-FSSHTTP", 11249, @"[In Get Version List] If the VersioningRequestType attribute is set to ""GetVersionList"", the protocol server considers the versioning subrequest to be of type ""Get Version List""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11250 Site.CaptureRequirement( "MS-FSSHTTP", 11250, @"[In Get Version List] The protocol server processes this request to return a list of the most recent versions of the file."); } else { Site.Assert.IsNotNull( versioningSubResponse.SubResponseData.UserTable, @"The UserTable element must be included in the response if the SubResponseType of the parent VersioningSubResponseType is of type ""GetVersionList."""); Site.Assert.IsNotNull( versioningSubResponse.SubResponseData.Versions, @"The UserTable element must be included in the response if the SubResponseType of the parent VersioningSubResponseType is of type ""GetVersionList."""); } }
public void TestCase_S16_TC04_FileVersionEventDataType_Restore() { string documentLibraryName = Common.GetConfigurationPropertyValue("MSFSSHTTPFSSHTTPBLibraryName", this.Site); if (!SutPowerShellAdapter.SwitchMajorVersioning(documentLibraryName, true)) { this.Site.Assert.Fail("Cannot enable the version on the document library {0}", documentLibraryName); } // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Check out one file by a specified user name. if (!this.SutManagedAdapter.CheckOutFile(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain)) { this.Site.Assert.Fail("Cannot change the file {0} to check out status using the user name {1} and password {2}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.RecordFileCheckOut(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); string checkInComments1 = "New Comment1 for testing purpose on the operation Versioning."; if (!SutManagedAdapter.CheckInFile(this.DefaultFileUrl, 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}", this.DefaultFileUrl, this.UserName01, this.Password01); } this.StatusManager.CancelRecordCheckOut(this.DefaultFileUrl); VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.RestoreVersion, "1.0", this.Site); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest( this.DefaultFileUrl, new SubRequestType[] { versioningSubRequest }); VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "Restore file version should succeed."); GetDocMetaInfoSubRequestType getDocMetaInfoSubRequest = SharedTestSuiteHelper.CreateGetDocMetaInfoSubRequest(SequenceNumberGenerator.GetCurrentToken()); cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { getDocMetaInfoSubRequest }); GetDocMetaInfoSubResponseType getDocMetaInfoSubResponse = SharedTestSuiteHelper.ExtractSubResponse <GetDocMetaInfoSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(getDocMetaInfoSubResponse.ErrorCode, this.Site), "Get doc meta info should succeed."); versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.GetVersionList, null, this.Site); cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { versioningSubRequest }); versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "Get version list should succeed."); this.Site.Assert.AreEqual <int>( 3, versioningSubResponse.SubResponseData.Versions.Version.Length, "There should be 3 version numbers."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11190 Site.CaptureRequirementIfAreEqual <string>( "3", versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].Type, "MS-FSSHTTP", 11190, @"[In FileVersionEventDataType] 3 means A user restored the file content to its state at a previous version."); GetDocMetaInfoPropertyType lastModifiedProperty = null; foreach (GetDocMetaInfoPropertyType property in getDocMetaInfoSubResponse.SubResponseData.DocProps.Property) { if (property.Key.ToLower().Contains("timelastmodified")) { lastModifiedProperty = property; } } Site.Assert.IsNotNull(lastModifiedProperty, "Property for last modified time should be found."); System.DateTime time = Convert.ToDateTime(lastModifiedProperty.Value); long createTime = long.Parse(versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].CreateTime); bool isR11193Verified = ((System.Math.Round((double)createTime / 10000000)) == (time - new System.DateTime(1601, 1, 1, 0, 0, 0)).TotalSeconds); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11193 Site.CaptureRequirementIfIsTrue( isR11193Verified, "MS-FSSHTTP", 11193, @"[In FileVersionEventDataType] CreateTime specifies the number of 100-nanosecond intervals that have elapsed since 00:00:00 on January 1, 1601, which MUST be Coordinated Universal Time (UTC)."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11192 Site.CaptureRequirementIfIsTrue( isR11193Verified, "MS-FSSHTTP", 11192, @"[In FileVersionEventDataType] A single tick represents 100 nanoseconds, or one ten-millionth of a second."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11194 Site.CaptureRequirementIfAreEqual <string>( versioningSubResponse.SubResponseData.UserTable.User[0].UserId, versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].UserId, "MS-FSSHTTP", 11194, @"[In FileVersionEventDataType] UserId: An integer which specifies which user performed this event."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11195 Site.CaptureRequirementIfAreEqual <string>( versioningSubResponse.SubResponseData.UserTable.User[0].UserId, versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].UserId, "MS-FSSHTTP", 11195, @"[In FileVersionEventDataType] The UserId MUST match the UserId attribute of a UserDataType (section 2.3.1.42) described in the VersioningUserTableType in the current VersioningSubResponseDataType."); }
/// <summary> /// Capture requirements related to GetDocMetaInfo sub response. /// </summary> /// <param name="getDocMetaInfoSubResponse">Containing the GetDocMetaInfoSubResponse information.</param> /// <param name="site">An object provides logging, assertions, and SUT adapters for test code onto its execution context.</param> public static void ValidateGetDocMetaInfoSubResponse(GetDocMetaInfoSubResponseType getDocMetaInfoSubResponse, ITestSite site) { ValidateSubResponseType(getDocMetaInfoSubResponse as SubResponseType, site); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1797 // if can launch this method, the schema matches. site.CaptureRequirement( "MS-FSSHTTP", 1797, @"[In GetDocMetaInfoSubResponseType][The schema of GetDocMetaInfoSubResponseType is] <xs:complexType name=""GetDocMetaInfoSubResponseType""> <xs:complexContent> <xs:extension base=""tns:SubResponseType""> <xs:sequence minOccurs=""0"" maxOccurs=""1""> <xs:element name=""SubResponseData"" type=""tns:GetDocMetaInfoSubResponseDataType""/> </xs:sequence> </xs:extension> </xs:complexContent> </xs:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2003 // if can launch this method, the schema matches. site.CaptureRequirement( "MS-FSSHTTP", 2003, @"[In GetDocMetaInfo Subrequest][The protocol client sends a GetDocMetaInfo SubRequest message, which is of type GetDocMetaInfoSubRequestType] The protocol server responds with a GetDocMetaInfo SubResponse message, which is of type GetDocMetaInfoSubResponseType as specified in section 2.3.1.30."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R4694 // if can launch this method, the schema matches. site.CaptureRequirementIfAreEqual <Type>( typeof(GetDocMetaInfoSubResponseType), getDocMetaInfoSubResponse.GetType(), "MS-FSSHTTP", 4694, @"[In SubResponseElementGenericType] Depending on the Type attribute specified in the SubRequest element, the SubResponseElementGenericType MUST take one of the forms: GetDocMetaInfoSubResponseType."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R5748 // if can launch this method, the schema matches. site.CaptureRequirementIfAreEqual <Type>( typeof(GetDocMetaInfoSubResponseType), getDocMetaInfoSubResponse.GetType(), "MS-FSSHTTP", 5748, @"[In SubResponseType] The SubResponseElementGenericType takes one of the following forms: GetDocMetaInfoSubResponseType."); if (getDocMetaInfoSubResponse.SubResponseData != null) { ValidateGetDocMetaInfoSubResponseData(site); } if (string.Compare("Success", getDocMetaInfoSubResponse.ErrorCode, StringComparison.OrdinalIgnoreCase) == 0) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1693 bool isVerifyR1693 = getDocMetaInfoSubResponse.SubResponseData != null; // If popup the assert, the case run fail. site.Assert.IsTrue( isVerifyR1693, "For requirement MS-FSSHTTPB_R1693, the SubResponseData should not be NULL."); // If the above logic is right, MS-FSSHTTP_R1693 can be captured. site.CaptureRequirement( "MS-FSSHTTP", 1693, @"[In SubResponseElementGenericType][The SubResponseData element MUST be sent as part of the SubResponse element in a cell storage service response message if the ErrorCode attribute that is part of the SubResponse element is set to a value of ""Success"" and one of the following conditions is true:] The Type attribute that is specified in the SubRequest element is set to a value of ""GetDocMetaInfo""."); // If the value of element "SubResponseData" in the sub-response is not null, then capture MS-FSSHTTP_R1800. site.CaptureRequirementIfIsNotNull( getDocMetaInfoSubResponse.SubResponseData, "MS-FSSHTTP", 1800, @"[In GetDocMetaInfoSubResponseType] [In GetDocMetaInfoSubResponseType] As part of processing the GetDocMetaInfo 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""."); } // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2013 // if can launch this method, the schema matches. site.CaptureRequirement( "MS-FSSHTTP", 2013, @"[In GetDocMetaInfo Subrequest] The GetDocMetaInfoPropertySetType elements have one Property element per metadata item of type GetDocMetaInfoPropertyType as defined in section 2.3.1.29."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1685 // if can launch this method, the schema matches. site.CaptureRequirement( "MS-FSSHTTP", 1685, @"[In SubResponseDataGenericType][SubResponseDataGenericType MUST take one of the forms described in the following table] GetDocMetaInfoSubResponseDataType: Type definition for Get Doc Meta Info subresponse data."); }