public void MSFSSHTTP_FSSHTTPB_S01_TC03_DownloadContents_InvalidUrl() { // Query the updated file content using the invalid url. string invalidUrl = this.DefaultFileUrl + "Invalid"; // Initialize the context using user01 and invalid url. this.InitializeContext(invalidUrl, this.UserName01, this.Password01, this.Domain); CellSubRequestType queryChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); CellStorageResponse response = Adapter.CellStorageRequest(invalidUrl, new SubRequestType[] { queryChange }); CellSubResponseType cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R1875 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.CellRequestFail, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 1875, @"[In Cell Subrequest][The protocol server returns results based on the following conditions:] If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""CellRequestFail"" in the ErrorCode attribute sent back in the SubResponse element. [and the binary data in the returned SubRequestData element indicates an HRESULT Error as described in [MS-FSSHTTPB] section 2.2.3.2.4.]"); // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R11230 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.CellRequestFail, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 11230, @"[In Cell Subrequest][The protocol server returns results based on the following conditions:] [If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""CellRequestFail"" in the ErrorCode attribute sent back in the SubResponse element, and] the binary data in the returned SubRequestData element indicates an HRESULT Error as described in [MS-FSSHTTPB] section 2.2.3.2.4."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.CellRequestFail, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), @"[In Cell Subrequest][The protocol server returns results based on the following conditions:] If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""CellRequestFail"" in the ErrorCode attribute sent back in the SubResponse element. [and the binary data in the returned SubRequestData element indicates an HRESULT Error as described in [MS-FSSHTTPB] section 2.2.3.2.4.]"); Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.CellRequestFail, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), @"[In Cell Subrequest][The protocol server returns results based on the following conditions:] [If the protocol server was unable to find the URL for the file specified in the Url attribute, the protocol server reports a failure by returning an error code value set to ""CellRequestFail"" in the ErrorCode attribute sent back in the SubResponse element, and] the binary data in the returned SubRequestData element indicates an HRESULT Error as described in [MS-FSSHTTPB] section 2.2.3.2.4."); } }
public void TestCase_S11_TC01_QueryAccessReadWrite() { // Initialize the service this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); // Query changes from the protocol server CellSubRequestType queryChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); CellStorageResponse queryResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, 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); ExGuid storageIndex = fsshttpbResponse.CellSubResponses[0].GetSubResponseData <QueryChangesSubResponseData>().StorageIndexExtendedGUID; // Create a putChanges cellSubRequest FsshttpbCellRequest cellRequest = SharedTestSuiteHelper.CreateFsshttpbCellRequest(); ExGuid storageIndexExGuid; List <DataElement> dataElements = DataElementUtils.BuildDataElements(System.Text.Encoding.Unicode.GetBytes("bad"), out storageIndexExGuid); PutChangesCellSubRequest putChange = new PutChangesCellSubRequest(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), storageIndexExGuid); putChange.ExpectedStorageIndexExtendedGUID = storageIndex; dataElements.AddRange(fsshttpbResponse.DataElementPackage.DataElements); cellRequest.AddSubRequest(putChange, dataElements); CellSubRequestType putChangesSubRequest = SharedTestSuiteHelper.CreateCellSubRequest(SequenceNumberGenerator.GetCurrentToken(), cellRequest.ToBase64()); // Put changes to the protocol server CellStorageResponse response = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { putChangesSubRequest }); CellSubResponseType cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site); // Expect the Put changes operation succeeds this.Site.Assert.AreEqual(ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "The PutChanges operation should succeed."); SharedTestSuiteHelper.ExpectMsfsshttpbSubResponseSucceed(SharedTestSuiteHelper.ExtractFsshttpbResponse(cellSubResponse, this.Site), this.Site); // Call QueryAccess. CellSubRequestType cellSubRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryAccess(0); CellStorageResponse cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest }); CellSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(cellStorageResponse, 0, 0, this.Site); FsshttpbResponse queryAccessResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site); // Get readAccessResponse and writeAccessResponse Data. HRESULTError dataRead = queryAccessResponse.CellSubResponses[0] .GetSubResponseData <QueryAccessSubResponseData>() .ReadAccessResponse.ReadResponseError .GetErrorData <HRESULTError>(); this.Site.Assert.AreEqual <int>( 0, dataRead.ErrorCode, "Test case cannot continue unless the read HRESULTError code equals 0 when the user have read/write permission."); HRESULTError dataWrite = queryAccessResponse.CellSubResponses[0] .GetSubResponseData <QueryAccessSubResponseData>() .WriteAccessResponse.WriteResponseError .GetErrorData <HRESULTError>(); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error type is HRESULTError, then capture R946. Site.CaptureRequirementIfIsNotNull( dataWrite, "MS-FSSHTTPB", 946, @"[In Query Access] Response Error (variable): If the Put Changes operation will succeed, the response error will have an error type of HRESULT error."); // If the error type is HRESULTError and error code equals 0, then capture R2229. Site.CaptureRequirementIfAreEqual <int>( 0, dataWrite.ErrorCode, "MS-FSSHTTPB", 2229, @"[In Query Access] Response Error (variable): [If the Put Changes operation will succeed, ]the HRESULT error code will be zero."); // If error code equals 0, then capture R2231. Site.CaptureRequirementIfAreEqual <int>( 0, dataWrite.ErrorCode, "MS-FSSHTTPB", 2231, @"[In HRESULT Error] Error Code (4 bytes): Zero means that no error occurred."); } else { Site.Assert.IsNotNull( dataWrite, @"[In Query Access] Response Error (variable): If the Put Changes operation will succeed, the response error will have an error type of HRESULT error."); Site.Assert.AreEqual <int>( 0, dataWrite.ErrorCode, @"[In Query Access] Response Error (variable): [If the Put Changes operation will succeed, ]the HRESULT error code will be zero."); } }
public void TestCase_S11_TC02_QueryAccessRead() { string readOnlyUser = Common.GetConfigurationPropertyValue("ReadOnlyUser", this.Site); string readOnlyUserPassword = Common.GetConfigurationPropertyValue("ReadOnlyUserPwd", this.Site); // Initialize the service this.InitializeContext(this.DefaultFileUrl, readOnlyUser, readOnlyUserPassword, this.Domain); // Query changes from the protocol server CellSubRequestType queryChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); CellStorageResponse queryResponse = Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { queryChange }); CellSubResponseType querySubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(queryResponse, 0, 0, this.Site); FsshttpbResponse fsshttpbResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(querySubResponse, this.Site); this.Site.Assert.AreEqual( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(querySubResponse.ErrorCode, this.Site), "The operation QueryChanges should succeed when the user {0} only has ViewOnly permission.", readOnlyUser); this.Site.Assert.IsFalse( fsshttpbResponse.CellSubResponses[0].Status, "The operation QueryChanges should succeed when the user {0} only has ViewOnly permission.", readOnlyUser); // Call QueryAccess CellSubRequestType cellSubRequest = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryAccess(0); CellStorageResponse cellStorageResponse = this.Adapter.CellStorageRequest(this.DefaultFileUrl, new SubRequestType[] { cellSubRequest }); CellSubResponseType subResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(cellStorageResponse, 0, 0, this.Site); FsshttpbResponse queryAccessResponse = SharedTestSuiteHelper.ExtractFsshttpbResponse(subResponse, this.Site); // Get readAccessResponse and writeAccessResponse Data. HRESULTError dataRead = queryAccessResponse.CellSubResponses[0] .GetSubResponseData <QueryAccessSubResponseData>() .ReadAccessResponse.ReadResponseError .GetErrorData <HRESULTError>(); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // If the error type is HRESULTError, then capture R944. Site.CaptureRequirementIfIsNotNull( dataRead, "MS-FSSHTTPB", 944, @"[In Query Access] Response Error (variable): If read operations will succeed, the response error will have an error type of HRESULT error."); // If HResult is 0,MS-FSSHTTPB_R2228 should be covered. Site.CaptureRequirementIfAreEqual <int>( 0, dataRead.ErrorCode, "MS-FSSHTTPB", 2228, @"[In Query Access] Response Error (variable): [If read operations will succeed, ]the HRESULT error code will be zero."); } else { Site.Assert.IsNotNull( dataRead, @"[In Query Access] Response Error (variable): If read operations will succeed, the response error will have an error type of HRESULT error."); Site.Assert.AreEqual <int>( 0, dataRead.ErrorCode, @"[In Query Access] Response Error (variable): [If read operations will succeed, ]the HRESULT error code will be zero."); } HRESULTError dataWrite = queryAccessResponse.CellSubResponses[0] .GetSubResponseData <QueryAccessSubResponseData>() .WriteAccessResponse.WriteResponseError .GetErrorData <HRESULTError>(); this.Site.Assert.AreNotEqual <int>( 0, dataWrite.ErrorCode, "Test case cannot continue unless the write HRESULTError code not equals 0 when the user have read permission."); }
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 MSFSSHTTP_FSSHTTPB_S01_TC01_DownloadContents_EmptyUrl() { if ((!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3008, this.Site)) && (!Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site))) { Site.Assume.Inconclusive("Implementation does not have same behaviors as Microsoft products."); } // Initialize the context using user01 and defaultFileUrl. this.InitializeContext(this.DefaultFileUrl, this.UserName01, this.Password01, this.Domain); CellStorageResponse response = new CellStorageResponse(); bool isR3008Verified = false; try { // Query the updated file content. CellSubRequestType queryChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); response = Adapter.CellStorageRequest(string.Empty, new SubRequestType[] { queryChange }); } catch (System.Xml.XmlException exception) { string message = exception.Message; isR3008Verified = message.Contains("Duplicate attribute"); isR3008Verified &= message.Contains("ErrorCode"); } if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3008 if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3008, this.Site)) { Site.Log.Add( LogEntryKind.Debug, "SharePoint server 2010 and SharePoint Foundation responses two ErrorCode attributes when the URL is empty."); Site.CaptureRequirementIfIsTrue( isR3008Verified, "MS-FSSHTTP", 3008, @"[In Appendix B: Product Behavior] If the Url attribute of the corresponding Request element is an empty string, the implementation does return two ErrorCode attributes in Response element. <11> Section 2.2.3.5: SharePoint Server 2010 will return 2 ErrorCode attributes in Response element."); } // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3009 if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site)) { 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. <11> Section 2.2.3.5: SharePoint Server 2013 will not return Response element."); } } else { if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3008, this.Site)) { Site.Log.Add( LogEntryKind.Debug, "SharePoint server 2010 and SharePoint Foundation responses two ErrorCode attributes when the URL is non exists."); Site.Assert.IsTrue( isR3008Verified, "SharePoint server 2010 and SharePoint Foundation responses two ErrorCode attributes when the URL is non exists."); } if (Common.IsRequirementEnabled("MS-FSSHTTP-FSSHTTPB", 3009, this.Site)) { 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_S15_TC01_CreateFile() { string randomFileUrl = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site); // Initialize the context using user01 and defaultFileUrl. this.InitializeContext(randomFileUrl, this.UserName01, this.Password01, this.Domain); CellSubRequestType putChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedPutChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID(), SharedTestSuiteHelper.GenerateRandomFileContent(this.Site)); putChange.SubRequestData.CoalesceSpecified = true; putChange.SubRequestData.Coalesce = true; CellStorageResponse response = Adapter.CellStorageRequest(randomFileUrl, new SubRequestType[] { putChange }); CellSubResponseType cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site); this.Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "When uploading contents if the protocol server was unable to find the URL for the file specified in the Url attribute,, the server returns success and create a new file using the specified contents in the file URI."); // Query the updated file content. CellSubRequestType queryChange = SharedTestSuiteHelper.CreateCellSubRequestEmbeddedQueryChanges(SequenceNumberGenerator.GetCurrentFSSHTTPBSubRequestID()); response = Adapter.CellStorageRequest(randomFileUrl, new SubRequestType[] { queryChange }); cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R3103 // If queryChange subrequest can download a file from randomFileUrl, then capture MS-FSSHTTP_R3103. Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 3103, @"[In Cell Subrequest] But for Put Changes subrequest, as described in [MS-FSSHTTPB] section 2.2.2.1.4, [If the protocol server was unable to find the URL for the file specified in the Url attribute] the protocol server creates a new file using the specified Url."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), @"[In Cell Subrequest] But for Put Changes subrequest, as described in [MS-FSSHTTPB] section 2.2.2.1.4, [If the protocol server was unable to find the URL for the file specified in the Url attribute] the protocol server creates a new file using the specified Url."); } this.StatusManager.RecordFileUpload(randomFileUrl); // Re-generate the non-exist file URL again. randomFileUrl = SharedTestSuiteHelper.GenerateNonExistFileUrl(this.Site); this.InitializeContext(randomFileUrl, this.UserName01, this.Password01, this.Domain); putChange.SubRequestData.ExpectNoFileExistsSpecified = true; putChange.SubRequestData.ExpectNoFileExists = true; putChange.SubRequestData.Etag = string.Empty; putChange.SubRequestData.CoalesceSpecified = true; putChange.SubRequestData.Coalesce = true; response = Adapter.CellStorageRequest(randomFileUrl, new SubRequestType[] { putChange }); cellSubResponse = SharedTestSuiteHelper.ExtractSubResponse <CellSubResponseType>(response, 0, 0, this.Site); if (SharedContext.Current.IsMsFsshttpRequirementsCaptured) { // Verify MS-FSSHTTP requirement: MS-FSSHTTP_R2252 Site.CaptureRequirementIfAreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), "MS-FSSHTTP", 2252, @"[In Cell Subrequest] In this case[If the ExpectNoFileExists attribute is set to true in a file content upload cell subrequest, the Etag attribute MUST be an empty string], the protocol server MUST NOT cause the cell subrequest to fail with a coherency error if the file does not exist on the server."); } else { Site.Assert.AreEqual <ErrorCodeType>( ErrorCodeType.Success, SharedTestSuiteHelper.ConvertToErrorCodeType(cellSubResponse.ErrorCode, this.Site), @"[In Cell Subrequest] In this case[If the ExpectNoFileExists attribute is set to true in a file content upload cell subrequest, the Etag attribute MUST be an empty string], the protocol server MUST NOT cause the cell subrequest to fail with a coherency error if the file does not exist on the server."); } this.StatusManager.RecordFileUpload(randomFileUrl); }