public void MSFSSHTTP_FSSHTTPB_TestCase_S16_TC02_Versioning_FileNotExistsOrCannotBeCreated() { string fileUrlNotExit = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site); // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.GetVersionList, null, this.Site); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(fileUrlNotExit, new SubRequestType[] { versioningSubRequest }); VersioningSubResponseType versioningSubResponse = SharedTestSuiteHelper.ExtractSubResponse <VersioningSubResponseType>(cellStoreageResponse, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11246 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11246, @"[In Versioning Subrequest] [The protocol returns results based on the following conditions:]If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""FileNotExistsOrCannotBeCreated"" in the ErrorCode attribute sent back in the SubResponse element."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.FileNotExistsOrCannotBeCreated, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "Error FileNotExistsOrCannotBeCreated should be returned if the protocol server was unable to find the URL for the file."); } }
/// <summary> /// Capture requirements related with Versioning Sub-request. /// </summary> /// <param name="versioningSubResponse">Containing the VersioningSubResponse information</param> /// <param name="site">Instance of ITestSite</param> public static void ValidateVersioningSubResponse(VersioningSubResponseType versioningSubResponse, ITestSite site) { ErrorCodeType errorCode = (ErrorCodeType)Enum.Parse(typeof(ErrorCodeType), versioningSubResponse.ErrorCode); if (errorCode == ErrorCodeType.VersionNotFound) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11081 site.CaptureRequirement( "MS-FSSHTTP", 11081, @"[In VersioningRelatedErrorCodeTypes] [The schema of VersioningRelatedErrorCodeTypes is:] <xs:simpleType name=""VersioningRelatedErrorCodeTypes""> < xs:restriction base = ""xs:string"" > < xs:enumeration value = ""VersionNotFound"" /> </ xs:restriction > </ xs:simpleType > "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11082 site.CaptureRequirement( "MS-FSSHTTP", 11082, @"[In VersioningRelatedErrorCodeTypes] The value of VersioningRelatedErrorCodeTypes MUST be one of value [VersionNotFound] in the following table."); } // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11236 site.CaptureRequirement( "MS-FSSHTTP", 11236, @"[In Versioning Subrequest] The protocol server responds with a versioning SubResponse message, which is of type VersioningSubResponseType as specified in section 2.3.1.39."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11242 site.CaptureRequirement( "MS-FSSHTTP", 11242, @"[In Versioning Subrequest] The VersioningSubResponseDataType defines the type of the SubResponseData element inside the versioning SubResponse element."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11154 site.CaptureRequirement( "MS-FSSHTTP", 11154, @"[In VersioningSubResponseType] <xs:complexType name=""VersioningSubResponseType""> < xs:complexContent > < xs:extension base = ""tns:SubResponseType"" > < xs:sequence minOccurs = ""0"" maxOccurs = ""1"" > < xs:element name = ""SubResponseData"" type = ""tns:VersioningSubResponseDataType"" /> </ xs:sequence > </ xs:extension > </ xs:complexContent > </ xs:complexType > "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11155 site.CaptureRequirement( "MS-FSSHTTP", 11155, @"[In VersioningSubResponseType] SubResponseData: A VersioningSubResponseDataType that specifies versioning related information provided by the protocol server that was requested as part of the versioning subrequest."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11144 site.CaptureRequirement( "MS-FSSHTTP", 11144, @"[In VersioningSubResponseDataType] <xs:complexType name=""VersioningSubResponseDataType""> <xs:sequence minOccurs=""0"" maxOccurs=""1""> <xs:sequence minOccurs=""0"" maxOccurs=""1""> <xs:element name=""UserTable"" type=""tns:VersioningUserTableType""/> </xs:sequence> <xs:element name=""Versions"" type=""tns:VersioningVersionListType""/> </xs:sequence> </xs:complexType>"); if (versioningSubResponse.SubResponseData.UserTable != null) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11145 site.CaptureRequirement( "MS-FSSHTTP", 11145, @"[In VersioningSubResponseDataType] UserTable: An element of type VersioningUserTableType (section 2.3.1.40) that specifies data for the users represented in the version list."); ValidateVersioningUserTableType(versioningSubResponse.SubResponseData.UserTable, site); } if (versioningSubResponse.SubResponseData.Versions != null) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11147 site.CaptureRequirement( "MS-FSSHTTP", 11147, @"[In VersioningSubResponseDataType] Versions: An element of type VersioningVersionListType (section 2.3.1.41) that specifies the list of versions of this file that exist on the server."); ValidateVersioningVersionListType(versioningSubResponse.SubResponseData.Versions, site); } }
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_TC05_FileVersionEventDataType_Rename() { 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); 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); string fileName = this.DefaultFileUrl.Substring(this.DefaultFileUrl.LastIndexOf("/", StringComparison.OrdinalIgnoreCase) + 1); string newName = Common.GenerateResourceName(this.Site, "fileName") + ".txt"; FileOperationSubRequestType fileOperationSubRequest = SharedTestSuiteHelper.CreateFileOperationSubRequest(FileOperationRequestTypes.Rename, newName, null, this.Site); CellStorageResponse cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { fileOperationSubRequest }); FileOperationSubResponseType fileOperationSubResponse = SharedTestSuiteHelper.ExtractSubResponse <FileOperationSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(fileOperationSubResponse, "The object 'versioningSubResponse' should not be null."); this.Site.Assert.IsNotNull(fileOperationSubResponse.ErrorCode, "The object 'versioningSubResponse.ErrorCode' should not be null."); string fileUrl = this.DefaultFileUrl.Substring(0, this.DefaultFileUrl.LastIndexOf("/", StringComparison.OrdinalIgnoreCase) + 1) + newName; VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.GetVersionList, null, this.Site); cellStoreageResponse = Adapter.CellStorageRequest(fileUrl, 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), "Get version list should succeed."); this.Site.Assert.AreEqual <int>( 2, versioningSubResponse.SubResponseData.Versions.Version.Length, "There should be 2 version numbers."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1117502 Site.CaptureRequirementIfIsNull( versioningSubResponse.SubResponseData.Versions.Version[1].IsCurrent, "MS-FSSHTTP", 1117502, @"[In FileVersionDataType] IsCurrent: This attribute is not present if this version is not the most recent version of the file."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11189 Site.CaptureRequirementIfAreEqual <string>( "2", versioningSubResponse.SubResponseData.Versions.Version[0].Events[0].Type, "MS-FSSHTTP", 11189, @"[In FileVersionEventDataType] 2 means A user renamed the file."); }
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."); }
public void TestCase_S16_TC03_Versioning_RestoreVersion_VersionNotFound() { 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); 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); VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.RestoreVersion, "3.0", 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_R11247 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.VersionNotFound, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11247, @"[In Versioning Subrequest] [The protocol returns results based on the following conditions:]If the protocol server gets a versioning subrequest of type ""Restore version"" and the restore fails because the version number specifies a non-existent version, the protocol server returns an error code value set to ""VersionNotFound""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11256 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.VersionNotFound, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11256, @"[In Restore Version] If the Version attribute specifies a version that doesn't exist, the protocol server returns an error status set to ""VersionNotFound""."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11083 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.VersionNotFound, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11083, @"[In VersioningRelatedErrorCodeTypes] The value ""VersionNotFound"" indicates that the version number specified by the protocol client doesn’t match a version of the file on the protocol server."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.VersionNotFound, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), @"Error VersionNotFound should be returned if restore version with not found version."); } }
public void TestCase_S16_TC02_Versioning_RestoreVersion_Success() { 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); 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); VersioningSubRequestType versioningSubRequest = SharedTestSuiteHelper.CreateVersioningSubRequest(SequenceNumberGenerator.GetCurrentToken(), VersioningRequestTypes.RestoreVersion, "1.0", 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_R11248 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11248, @"[In Versioning Subrequest] [The protocol returns results based on the following conditions:]An ErrorCode value of ""Success"" indicates success in processing the versioning request."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11254 Site.CaptureRequirement( "MS-FSSHTTP", 11254, @"[In Restore Version] If the VersioningRequestType attribute is set to ""RestoreVersion"", the protocol server considers the versioning subrequest to be of type ""Restore Version"". "); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11255 Site.CaptureRequirement( "MS-FSSHTTP", 11255, @"[In Restore Version] The protocol server processes this request by restoring the file to its state in the version specified by the Version attribute."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(versioningSubResponse.ErrorCode, this.Site), @"Restore version should succeed."); } }