/// <summary> /// Capture requirements related with FileOperation Sub-request. /// </summary> /// <param name="fileOperationSubResponse">Containing the FileOperationSubResponse information</param> /// <param name="site">Instance of ITestSite</param> public static void ValidateFileOperationSubResponse(FileOperationSubResponseType fileOperationSubResponse, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11124 site.CaptureRequirement( "MS-FSSHTTP", 11124, @"[In FileOperationSubResponseType] <xs:complexType name=""FileOperationSubResponseType""> <xs:complexContent> <xs:extension base=""tns:SubResponseType""> <xs:sequence minOccurs=""0"" maxOccurs=""1""> < xs:element name = ""SubResponseData"" /> </ xs:sequence > </ xs:extension> </xs:complexContent> </xs:complexType>"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2349 site.CaptureRequirementIfAreEqual <Type>( typeof(FileOperationSubResponseType), fileOperationSubResponse.GetType(), "MS-FSSHTTP", 2349, @"[FileOperation SubRequest]The protocol server responds with a FileOperation SubResponse message, which is of type FileOperationSubResponseType as specified in section 2.3.1.35. "); }
public void TestCase_S17_TC01_FileOperation_Success() { // Initialize the context using user01 and defaultFileUrl. this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Get the exclusive lock with all valid parameters, expect the server responses the error code "Success". ExclusiveLockSubRequestType subRequest = SharedTestSuiteHelper.CreateExclusiveLockSubRequest(ExclusiveLockRequestTypes.GetLock); CellStorageResponse cellStoreageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { subRequest }); ExclusiveLockSubResponseType exclusiveResponse = SharedTestSuiteHelper.ExtractSubResponse <ExclusiveLockSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(exclusiveResponse.ErrorCode, this.Site), "Test case cannot continue unless the Get Lock of ExclusiveLock sub request succeeds."); // Record the current file status. this.StatusManager.RecordExclusiveLock(this.DefaultFileUrl, subRequest.SubRequestData.ExclusiveLockID); string fileName = this.DefaultFileUrl.Substring(this.DefaultFileUrl.LastIndexOf("/", StringComparison.OrdinalIgnoreCase) + 1); string newName = Common.GenerateResourceName(this.Site, "fileName") + ".txt"; FileOperationSubRequestType fileOperationSubRequest = SharedTestSuiteHelper.CreateFileOperationSubRequest(FileOperationRequestTypes.Rename, newName, SharedTestSuiteHelper.DefaultExclusiveLockID, this.Site); cellStoreageResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { fileOperationSubRequest }); FileOperationSubResponseType fileOperationSubResponse = SharedTestSuiteHelper.ExtractSubResponse <FileOperationSubResponseType>(cellStoreageResponse, 0, 0, this.Site); this.Site.Assert.IsNotNull(fileOperationSubResponse, "The object 'versioningSubResponse' should not be null."); this.Site.Assert.IsNotNull(fileOperationSubResponse.ErrorCode, "The object 'versioningSubResponse.ErrorCode' should not be null."); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11146 Site.CaptureRequirementIfAreEqual <string>( "Success", fileOperationSubResponse.ErrorCode, "MS-FSSHTTP", 11109, @"[In FileOperationSubRequestDataType] This parameter [ExclusiveLockID] is used to validate that the file operation can be performed even though the file is under exclusive lock."); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11120 // This requirement can be captured directly after capturing MS-FSSHTTP_R11109 Site.CaptureRequirement( "MS-FSSHTTP", 11120, @"[In FileOperationSubResponseType] In the case of success, it contains information requested as part of a file operation subrequest."); } else { Assert.AreEqual <string>( "Success", fileOperationSubResponse.ErrorCode, "MS-FSSHTTP", @"[In FileOperationSubRequestDataType] This parameter [ExclusiveLockID] is used to validate that the file operation can be performed even though the file is under exclusive lock."); } }
/// <summary> /// Capture requirements related with FileOperation Sub-request. /// </summary> /// <param name="fileOperationSubResponse">Containing the FileOperationSubResponse information</param> /// <param name="site">Instance of ITestSite</param> public static void ValidateFileOperationSubResponse(FileOperationSubResponseType fileOperationSubResponse, ITestSite site) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11124 site.CaptureRequirement( "MS-FSSHTTP", 11124, @"[In FileOperationSubResponseType] <xs:complexType name=""FileOperationSubResponseType""> <xs:complexContent> <xs:extension base=""tns:SubResponseType""> </xs:extension> </xs:complexContent> </xs:complexType>"); }
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_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_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."); }