public void MSOXCFOLD_S03_TC04_RopGetSearchCriteriaSuccess() { this.CheckWhetherSupportTransport(); this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. The client calls RopCreateFolder to create a search folder [MSOXCFOLDSearchFolder1] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = 0x02, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder), Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 2. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder1]. ulong[] folderIds = new ulong[] { this.DefaultFolderIds[0], this.DefaultFolderIds[1], this.DefaultFolderIds[3], this.DefaultFolderIds[4], this.DefaultFolderIds[5], this.DefaultFolderIds[6], this.DefaultFolderIds[7], this.DefaultFolderIds[8], this.DefaultFolderIds[9], this.DefaultFolderIds[10], this.DefaultFolderIds[11], }; byte[] restrictionData = { 0x08, 0x1f, 0x00, 0x1a, 0x00 }; RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, RestrictionDataSize = 0x0005, RestrictionData = restrictionData, FolderIdCount = (ushort)folderIds.Length, FolderIds = folderIds, SearchFlags = (uint)SetSearchFlags.RestartSearch }; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSetSearchCriteria ROP operation performs successfully!"); #endregion #region Step 3. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. RopGetSearchCriteriaRequest getSearchCriteriaRequest = new RopGetSearchCriteriaRequest { RopId = (byte)RopId.RopGetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, UseUnicode = 0x00, IncludeRestriction = 0x01, IncludeFolders = 0x01 }; RopGetSearchCriteriaResponse getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); RopGetSearchCriteriaResponse getSearchCriteriaResponse1 = getSearchCriteriaResponse; // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1100"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1100. // The method GetSearchCriteria succeeds indicates that the server responds with a RopGetSearchCriteria ROP response buffer. Site.CaptureRequirement( 1100, @"[In Processing a RopGetSearchCriteria ROP Request] The server responds with a RopGetSearchCriteria ROP response buffer."); #region Verify the requirements: MS-OXCFOLD_R129, MS-OXCFOLD_R131, MS-OXCFOLD_R959, MS-OXCFOLD_R2141, MS-OXCFOLD_R1103, and MS-OXCFOLD_R1104. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R129"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R129 Site.CaptureRequirementIfIsTrue( getSearchCriteriaResponse1.RestrictionData != null && getSearchCriteriaResponse1.RestrictionData.Length > 0, 129, @"[In RopGetSearchCriteria ROP Request Buffer] IncludeRestriction (1 byte): A Boolean value that is nonzero (TRUE) if the restriction data is required in the response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R131"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R131 Site.CaptureRequirementIfIsTrue( getSearchCriteriaResponse1.FolderIds != null && getSearchCriteriaResponse1.FolderIds.Length > 0, 131, @"[In RopGetSearchCriteria ROP Request Buffer] IncludeFolders (1 byte): A Boolean value that is nonzero (TRUE) if the list of folders being searched is required in the response."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1103"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1103 Site.CaptureRequirementIfIsTrue( getSearchCriteriaResponse1.RestrictionData != null && getSearchCriteriaResponse1.RestrictionData.Length > 0, 1103, @"[In Processing a RopGetSearchCriteria ROP Request] The server returns the search criteria only if the IncludeRestriction field of the ROP [RopGetSearchCriteria] request buffer is set to nonzero (TRUE), as specified in section 2.2.1.5.1."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1104, the count of folders that are being searched is {0}.", getSearchCriteriaResponse1.FolderIds.Length); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1104 bool isVerifyR1104 = getSearchCriteriaResponse1.FolderIds.Length > 0; Site.CaptureRequirementIfIsTrue( isVerifyR1104, 1104, @"[In Processing a RopGetSearchCriteria ROP Request] The server returns a list of the folders that are being searched only if the IncludeFolders field of the ROP [RopGetSearchCriteria] request buffer is set to nonzero (TRUE)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R959, field RestrictionData is {0}, the value of the RestrictionDataSize field is {1}.", getSearchCriteriaResponse1.RestrictionData, getSearchCriteriaResponse1.RestrictionDataSize); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R959 bool isVerifyR959 = getSearchCriteriaResponse1.RestrictionDataSize != 0 && getSearchCriteriaResponse1.RestrictionData != null && getSearchCriteriaResponse1.RestrictionData.Length > 0; Site.CaptureRequirementIfIsTrue( isVerifyR959, 959, @"[In RopGetSearchCriteria ROP Response Buffer] This field [RestrictionData] is present only if the value of the RestrictionDataSize field is nonzero (TRUE)."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R2141, the field FolderIds is {0}, the value of the FolderIdCount field is {1}.", getSearchCriteriaResponse1.FolderIds, getSearchCriteriaResponse1.FolderIdCount); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R2141 bool isVerifyR2141 = getSearchCriteriaResponse1.FolderIdCount != 0 && getSearchCriteriaResponse1.FolderIds != null && getSearchCriteriaResponse1.FolderIds.Length > 0; Site.CaptureRequirementIfIsTrue( isVerifyR2141, 2141, @"[InRopGetSearchCriteria ROP Response Buffer] This field [FolderIds] is present only if the value of the FolderIdCount field is nonzero (TRUE)."); #endregion #endregion #region Step 4. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1] without setting IncludeRestriction and IncludeFolders. getSearchCriteriaRequest.IncludeRestriction = 0x00; getSearchCriteriaRequest.IncludeFolders = 0x00; getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); RopGetSearchCriteriaResponse getSearchCriteriaResponse2 = getSearchCriteriaResponse; #region Verify the requirements: MS-OXCFOLD_R130, MS-OXCFOLD_R132, MS-OXCFOLD_R136, and MS-OXCFOLD_R139. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R130"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R130 Site.CaptureRequirementIfIsNull( getSearchCriteriaResponse2.RestrictionData, 130, @"[In RopGetSearchCriteria ROP Request Buffer] IncludeRestriction (1 byte): [A Boolean value that is] zero (FALSE) otherwise [if the restriction data is not required in the response]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R132"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R132 Site.CaptureRequirementIfIsNull( getSearchCriteriaResponse2.FolderIds, 132, @"[In RopGetSearchCriteria ROP Request Buffer] IncludeFolders (1 byte): [A Boolean value that is] zero (FALSE) otherwise [if the list of folders being searched is not required in the response]."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R136"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R136 Site.CaptureRequirementIfAreEqual<ushort>( 0, getSearchCriteriaResponse2.RestrictionDataSize, 136, @"[InRopGetSearchCriteria ROP Response Buffer] RestrictionDataSize (2 bytes): If the IncludeRestriction field of the request buffer was set to zero (FALSE), the value of RestrictionDataSize will be 0."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R139"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R139 Site.CaptureRequirementIfAreEqual<ushort>( 0, getSearchCriteriaResponse2.FolderIdCount, 139, @"[InRopGetSearchCriteria ROP Response Buffer] FolderIdCount (2 bytes): If the IncludeFolders field of the request buffer was set to zero (FALSE), the FolderIdCount field will be set to 0."); #endregion #endregion }
/// <summary> /// Create the active search folder in Inbox folder. /// </summary> /// <param name="folderName">The search folder name</param> /// <param name="searchFolderHandle">The search folder handle</param> /// <param name="searchFolderId">The created search folder ID</param> protected void CreateSearchFolder(string folderName, out uint searchFolderHandle, out ulong searchFolderId) { #region Open Inbox folder RopOpenFolderRequest openFolderRequest; RopOpenFolderResponse openFolderResponse; openFolderRequest.RopId = 0x02; openFolderRequest.LogonId = 0x0; openFolderRequest.InputHandleIndex = 0x0; openFolderRequest.OutputHandleIndex = 0x01; openFolderRequest.FolderId = this.logonResponse.FolderIds[4]; // Inbox folder openFolderRequest.OpenModeFlags = 0x0; // opening an existing folder this.oxcstorAdapter.DoRopCall(openFolderRequest, this.outObjHandle, ROPCommandType.Others, out this.outputBuffer); openFolderResponse = (RopOpenFolderResponse)this.outputBuffer.RopsList[0]; Site.Assert.AreEqual<uint>( 0x00000000, openFolderResponse.ReturnValue, "0 indicates the ROP succeeds, other value indicates error occurs."); uint openedFolderHandle = this.outputBuffer.ServerObjectHandleTable[openFolderResponse.OutputHandleIndex]; // Create a general folder RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = 0x00, InputHandleIndex = 0x00, OutputHandleIndex = 0x01, FolderType = 0x01, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0 }; string generalFolder = Common.GenerateResourceName(Site, "Folder") + "\0"; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(generalFolder); createFolderRequest.Comment = Encoding.ASCII.GetBytes(generalFolder); this.oxcstorAdapter.DoRopCall(createFolderRequest, openedFolderHandle, ROPCommandType.Others, out this.outputBuffer); RopCreateFolderResponse createFolderResponse = (RopCreateFolderResponse)this.outputBuffer.RopsList[0]; Site.Assert.AreEqual<uint>(0, createFolderResponse.ReturnValue, "0 indicates the ROP succeeds, other value indicates error occurs."); ulong subfolderId1 = createFolderResponse.FolderId; #endregion #region Call RopCreateFolder to create the search folder under the Inbox folder. string folderNameWithNull = folderName + "\0"; createFolderRequest.FolderType = 0x02; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(folderNameWithNull); createFolderRequest.Comment = Encoding.ASCII.GetBytes(folderNameWithNull); this.oxcstorAdapter.DoRopCall(createFolderRequest, openedFolderHandle, ROPCommandType.Others, out this.outputBuffer); createFolderResponse = (RopCreateFolderResponse)this.outputBuffer.RopsList[0]; Site.Assert.AreEqual<uint>(0, createFolderResponse.ReturnValue, "0 indicates the ROP succeeds, other value indicates error occurs."); searchFolderHandle = this.outputBuffer.ServerObjectHandleTable[createFolderResponse.OutputHandleIndex]; searchFolderId = createFolderResponse.FolderId; #endregion #region Call RopSetSearchCriteria to establish search criteria for created general folder. RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = 0x00, InputHandleIndex = 0x00 }; byte[] restrictData = new byte[] { 0x08, 0x1F, 0x00, 0x1A, 0x00 }; setSearchCriteriaRequest.RestrictionDataSize = (ushort)restrictData.Length; setSearchCriteriaRequest.RestrictionData = restrictData; setSearchCriteriaRequest.FolderIds = new ulong[] { subfolderId1 }; setSearchCriteriaRequest.FolderIdCount = (ushort)setSearchCriteriaRequest.FolderIds.Length; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.ContentIndexedSearch | (uint)SetSearchFlags.RestartSearch | (uint)SetSearchFlags.ForGroundSearch | (uint)SetSearchFlags.RecursiveSearch; this.oxcstorAdapter.DoRopCall(setSearchCriteriaRequest, searchFolderHandle, ROPCommandType.Others, out this.outputBuffer); RopSetSearchCriteriaResponse setSearchCriteriaResponse = (RopSetSearchCriteriaResponse)this.outputBuffer.RopsList[0]; Site.Assert.AreEqual<uint>(0, setSearchCriteriaResponse.ReturnValue, "0 indicates the ROP succeeds, other value indicates error occurs."); #endregion }
public void MSOXCFOLD_S03_TC01_StaticSearchVerification() { this.CheckWhetherSupportTransport(); this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. The client calls RopCreateFolder to create the general folder [MSOXCFOLDSubfolder1] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = (byte)FolderType.Genericfolder, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder1), Comment = Encoding.ASCII.GetBytes(Constants.Subfolder1) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint subfolderHandle1 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; ulong subfolderId1 = createFolderResponse.FolderId; #endregion #region Step 2. The client creates two general messages under the folder [MSOXCFOLDSubfolder1]. uint messageHandle1 = 0; ulong messageId1 = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageId1, ref messageHandle1); uint messageHandle2 = 0; ulong messageId2 = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageId2, ref messageHandle2); #endregion #region Step 3. The client calls RopCreateFolder to create the search folder [MSOXCFOLDSearchFolder2] under the root folder. createFolderRequest.FolderType = (byte)FolderType.Searchfolder; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder2); createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder2); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle2 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 4. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder2]. RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex }; PropertyTag propertyTag = new PropertyTag { PropertyId = (ushort)MessagePropertyId.PidTagMessageClass, PropertyType = (ushort)PropertyType.PtypString }; ExistRestriction existRestriction = new ExistRestriction { PropTag = propertyTag }; setSearchCriteriaRequest.RestrictionDataSize = (ushort)existRestriction.Size(); setSearchCriteriaRequest.RestrictionData = existRestriction.Serialize(); setSearchCriteriaRequest.FolderIds = new ulong[] { subfolderId1 }; setSearchCriteriaRequest.FolderIdCount = (ushort)setSearchCriteriaRequest.FolderIds.Length; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.ContentIndexedSearch | (uint)SetSearchFlags.StaticSearch | (uint)SetSearchFlags.RestartSearch; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 5. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder2]. RopGetSearchCriteriaRequest getSearchCriteriaRequest = new RopGetSearchCriteriaRequest { RopId = (byte)RopId.RopGetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, UseUnicode = 0x00, IncludeRestriction = 0x01, IncludeFolders = 0x01 }; RopGetSearchCriteriaResponse getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); #region Verify the requirements: MS-OXCFOLD_R1200 and MS-OXCFOLD_R1233. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1200"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1200 // SHALLOW_SEARCH bit in the RopSetSearchCriteria ROP request means the search includes only the search folder containers that are specified in the FolderIds field. // If the bit SEARCH_RECURSIVE in the RopGetSearchCriteria ROP response is not set means only the search folder containers that are specified in the last RopSetSearchCriteria ROP request are being searched. // So, if the bit SEARCH_RECURSIVE in getSearchCriteriaResponse is not set, R1200 can be verified. Site.CaptureRequirementIfAreNotEqual<uint>( (uint)GetSearchFlags.Recursive, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Recursive, 1200, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): If neither bit [RECURSIVE_SEARCH or SHALLOW_SEARCH] is set, the default is SHALLOW_SEARCH."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1233"); List<ulong> folderIdsInGetSearchCriteriaResponse = new List<ulong>(); folderIdsInGetSearchCriteriaResponse.AddRange(getSearchCriteriaResponse.FolderIds); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1233 this.Site.CaptureRequirementIfIsFalse( folderIdsInGetSearchCriteriaResponse.Contains(createFolderResponse.FolderId), 1233, @"[In Setting Up a Search Folder] [A search folder cannot be included in its own search scope] Therefore, the FolderIds field MUST NOT include the FID of the search folder."); #endregion #endregion #region Step 6. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder2]. RopGetContentsTableRequest getContentsTableRequest = new RopGetContentsTableRequest(); RopGetContentsTableResponse getContentsTableResponse; getContentsTableRequest.RopId = (byte)RopId.RopGetContentsTable; getContentsTableRequest.LogonId = Constants.CommonLogonId; getContentsTableRequest.InputHandleIndex = Constants.CommonInputHandleIndex; getContentsTableRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; getContentsTableRequest.TableFlags = (byte)FolderTableFlags.None; int count = 0; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != 2) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); uint rowCountBeforeHardDel = getContentsTableResponse.RowCount; Site.Assert.AreEqual<uint>(2, rowCountBeforeHardDel, "The two general messages created in step 2 were fetched in search folder."); #endregion #region Step 7. The client calls RopHardDeleteMessage ROP operation to hard delete a message in the general folder [MSOXCFOLDSubfolder1] under the root folder. ulong[] messageIds = new ulong[] { messageId1 }; RopHardDeleteMessagesRequest hardDeleteMessagesRequest = new RopHardDeleteMessagesRequest { RopId = (byte)RopId.RopHardDeleteMessages, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, WantAsynchronous = 0x00, NotifyNonRead = 0x00, MessageIdCount = (ushort)messageIds.Length, MessageIds = messageIds }; RopHardDeleteMessagesResponse hardDeleteMessagesResponse = this.Adapter.HardDeleteMessages(hardDeleteMessagesRequest, subfolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, hardDeleteMessagesResponse.ReturnValue, "RopHardDeleteMessages ROP operation performs successfully!"); Site.Assert.AreEqual<uint>(0x00, hardDeleteMessagesResponse.PartialCompletion, "RopHardDeleteMessages ROP operation is complete!"); #endregion #region Step 8. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder2]. count = 0; bool searchFolderNotChange = false; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != rowCountBeforeHardDel) { Thread.Sleep(this.WaitTime); } else { searchFolderNotChange = true; break; } count++; } while (count < this.RetryCount); #region Verify the requirements: MS-OXCFOLD_R795, MS-OXCFOLD_R784, MS-OXCFOLD_R1084, MS-OXCFOLD_R549, MS-OXCFOLD_R1093, MS-OXCFOLD_R1094. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R795"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R795 // The search folder contents didn't change after the message has been hard deleted, it indicates the current search is static search. Site.CaptureRequirementIfIsTrue( searchFolderNotChange, 795, @"[In RopGetSearchCriteria ROP Response Buffer] SearchFlags (4 bytes): SEARCH_STATIC (0x00010000) means that the search is static."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R784"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R784 Site.CaptureRequirementIfIsTrue( searchFolderNotChange, 784, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): STATIC_SEARCH (0x00040000) means that the search is static, if set."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1084"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1084 Site.CaptureRequirementIfIsTrue( searchFolderNotChange, 1084, @"[In Processing a RopSetSearchCriteria ROP Request] For static search folders, the contents of the search folder are not updated after the initial population is complete."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R549"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R549 Site.CaptureRequirementIfIsTrue( searchFolderNotChange, 549, @"[In Processing a RopSetSearchCriteria ROP Request] A static search causes the search folder to be populated once with all messages that match the search criteria at the point in time when the search is started or restarted."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1093"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1093 Site.CaptureRequirementIfIsTrue( searchFolderNotChange, 1093, @"[In Processing a RopSetSearchCriteria ROP Request] The server MUST NOT update the search folder after the initial population when new messages that match the search criteria arrive in the search scope."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1094"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1094 Site.CaptureRequirementIfIsTrue( searchFolderNotChange, 1094, @"[In Processing a RopSetSearchCriteria ROP Request] Or the server MUST NOT update the search folder after the initial population when existing messages that fit the search criteria are deleted."); #endregion #endregion #region Step 9. The client calls RopSetSearchCriteria to restart the search for [MSOXCFOLDSearchFolder2]. setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.ContentIndexedSearch | (uint)SetSearchFlags.RestartSearch; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 10. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder2]. count = 0; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != 1) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R551"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R551 // There should be 1 message found and copy to the search folder, so the RowCount should be 1. Site.CaptureRequirementIfAreEqual<uint>( 1, getContentsTableResponse.RowCount, 551, @"[In Processing a RopSetSearchCriteria ROP Request] To trigger an update, another RopSetSearchCriteria ROP request with the RESTART_SEARCH bit set in the SearchFlags field, as specified in section 2.2.1.4.1, is required."); #endregion #region Step 11. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder2] by a new RestrictionData. setSearchCriteriaRequest = new RopSetSearchCriteriaRequest(); setSearchCriteriaRequest.RopId = (byte)RopId.RopSetSearchCriteria; setSearchCriteriaRequest.LogonId = Constants.CommonLogonId; setSearchCriteriaRequest.InputHandleIndex = Constants.CommonInputHandleIndex; ContentRestriction contentRestriction = new ContentRestriction { FuzzyLevelLow = FuzzyLevelLowValues.FL_PREFIX, FuzzyLevelHigh = FuzzyLevelHighValues.FL_IGNORECASE }; propertyTag = new PropertyTag { PropertyId = (ushort)MessagePropertyId.PidTagMessageClass, PropertyType = (ushort)PropertyType.PtypString }; contentRestriction.PropertyTag = propertyTag; TaggedPropertyValue taggedProperty = new TaggedPropertyValue { PropertyTag = propertyTag, Value = Encoding.Unicode.GetBytes("IPM.Task" + Constants.StringNullTerminated) }; contentRestriction.TaggedValue = taggedProperty; setSearchCriteriaRequest.RestrictionDataSize = (ushort)contentRestriction.Size(); setSearchCriteriaRequest.RestrictionData = contentRestriction.Serialize(); setSearchCriteriaRequest.FolderIds = new ulong[] { subfolderId1 }; setSearchCriteriaRequest.FolderIdCount = (ushort)setSearchCriteriaRequest.FolderIds.Length; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.ContentIndexedSearch | (uint)SetSearchFlags.RestartSearch | (uint)SetSearchFlags.StaticSearch; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 12. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder2]. count = 0; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != 0) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R519"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R519 // For no message should be found so the search folder should empty, which means the RowCount is 0. Site.CaptureRequirementIfAreEqual<uint>( 0, getContentsTableResponse.RowCount, 519, @"[In Processing a RopSetSearchCriteria ROP Request] When new search criteria are applied, the server modifies the search folder to include only the messages that match the new search criteria."); #endregion }
public void MSOXCFOLD_S03_TC03_RopSetSearchCriteriaSuccess() { this.CheckWhetherSupportTransport(); this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. The client create a non-FAI message under the root folder. ulong messageId = 0; uint messageHandle = 0; this.CreateSaveMessage(this.RootFolderHandle, this.RootFolderId, ref messageId, ref messageHandle); #endregion #region Step 2. The client calls RopCreateFolder to create a search folder [MSOXCFOLDSearchFolder1] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = 0x02, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder), Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 3. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder1]. ulong[] folderIds = new ulong[] { this.DefaultFolderIds[0] }; RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, RestrictionDataSize = 0x0005 }; byte[] restrictionData = { 0x08, 0x1f, 0x00, 0x1a, 0x00 }; setSearchCriteriaRequest.RestrictionData = restrictionData; setSearchCriteriaRequest.FolderIdCount = (ushort)folderIds.Length; setSearchCriteriaRequest.FolderIds = folderIds; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.RestartSearch; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSetSearchCriteria ROP operation performs successfully!"); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R512"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R512. // Method SetSearchCriteria succeeds indicates that the server responds with a RopSetSearchCriteria ROP response buffer. Site.CaptureRequirement( 512, @"[In Processing a RopSetSearchCriteria ROP Request] The server responds with a RopSetSearchCriteria ROP response buffer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R98"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R98 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, 98, @"[In RopSetSearchCriteria ROP] The RopSetSearchCriteria ROP ([MS-OXCROPS] section 2.2.4.4) establishes search criteria for a search folder."); #region Verify the requirements: MS-OXCFOLD_R766, MS-OXCFOLD_R409, and MS-OXCFOLD_R47. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R766"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R766 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, 766, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): RESTART_SEARCH (0x00000002) means that the search is initiated, if this is the first RopSetSearchCriteria ROP request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R409"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R409 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, 409, @"[In Setting Up a Search Folder] The client creates a search folder by using the RopCreateFolder ROP ([MS-OXCROPS] section 2.2.4.2) with the FolderType field set to the value 2, as specified in section 2.2.1.2.1."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R47"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R47 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, 47, @"[InRopCreateFolder ROP Request Buffer] FolderType (1 byte): The value 2 indicates the folder type is Search folder."); #endregion #endregion #region Step 4. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. RopGetSearchCriteriaRequest getSearchCriteriaRequest = new RopGetSearchCriteriaRequest { RopId = (byte)RopId.RopGetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, UseUnicode = 0x00, IncludeRestriction = 0x01, IncludeFolders = 0x01 }; RopGetSearchCriteriaResponse getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); #region Verify the requirements: MS-OXCFOLD_R1200, MS-OXCFOLD_R772. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1200"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1200 Site.CaptureRequirementIfAreEqual<ushort>( (ushort)folderIds.Length, getSearchCriteriaResponse.FolderIdCount, 1200, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): If neither bit [RECURSIVE_SEARCH or SHALLOW_SEARCH] is set, the default is SHALLOW_SEARCH."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R772"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R772 Site.CaptureRequirementIfAreEqual<ushort>( (ushort)folderIds.Length, getSearchCriteriaResponse.FolderIdCount, 772, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): SHALLOW_SEARCH (0x00000008) means that the search includes only the search folder containers that are specified in the FolderIds field."); #endregion #endregion #region Step 5. The client calls RopSetSearchCriteria with no folder ID specified for search folder [MSOXCFOLDSearchFolder1] which is initialized in previous request. setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, RestrictionData = restrictionData, SearchFlags = (uint)SetSearchFlags.RestartSearch, FolderIdCount = 0, FolderIds = null }; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 6. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. getSearchCriteriaRequest = new RopGetSearchCriteriaRequest { RopId = (byte)RopId.RopGetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, UseUnicode = 0x00, IncludeRestriction = 0x01, IncludeFolders = 0x01 }; RopGetSearchCriteriaResponse getSearchCriteriaResponseForNoFolderID = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1241"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1241 this.Site.CaptureRequirementIfIsTrue( this.CompareFolderIDs(getSearchCriteriaResponse.FolderIds, getSearchCriteriaResponseForNoFolderID.FolderIds), 1241, @"[In Processing a RopSetSearchCriteria ROP Request] If the client does not specify FIDs in a subsequent RopSetSearchCriteria ROP request, the server uses the FIDs that were specified in the previous request."); #endregion }
public void MSOXCFOLD_S03_TC17_RopSetSearchCriteriaRegardlessOfSTATIC_SEARCH() { this.CheckWhetherSupportTransport(); this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. The client calls RopCreateFolder to create the general folder [MSOXCFOLDSubfolder1] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = (byte)FolderType.Genericfolder, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder1), Comment = Encoding.ASCII.GetBytes(Constants.Subfolder1) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint subfolderHandle1 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; ulong subfolderId1 = createFolderResponse.FolderId; #endregion #region Step 2. The client creates two general messages under the folder [MSOXCFOLDSubfolder1]. uint messageHandle1 = 0; ulong messageId1 = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageId1, ref messageHandle1); uint messageHandle2 = 0; ulong messageId2 = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageId2, ref messageHandle2); #endregion #region Step 3. The client calls RopCreateFolder to create the search folder [MSOXCFOLDSearchFolder2] under the root folder. createFolderRequest.FolderType = (byte)FolderType.Searchfolder; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder2); createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder2); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle2 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 4. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder2] without setting STATIC_SEARCH bit. RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex }; PropertyTag propertyTag = new PropertyTag { PropertyId = (ushort)MessagePropertyId.PidTagMessageClass, PropertyType = (ushort)PropertyType.PtypString }; ExistRestriction existRestriction = new ExistRestriction { PropTag = propertyTag }; setSearchCriteriaRequest.RestrictionDataSize = (ushort)existRestriction.Size(); setSearchCriteriaRequest.RestrictionData = existRestriction.Serialize(); setSearchCriteriaRequest.FolderIds = new ulong[] { subfolderId1 }; setSearchCriteriaRequest.FolderIdCount = (ushort)setSearchCriteriaRequest.FolderIds.Length; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.ContentIndexedSearch; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 5. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder2]. RopGetSearchCriteriaRequest getSearchCriteriaRequest = new RopGetSearchCriteriaRequest { RopId = (byte)RopId.RopGetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, UseUnicode = 0x00, IncludeRestriction = 0x01, IncludeFolders = 0x01 }; RopGetSearchCriteriaResponse getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); if (Common.IsRequirementEnabled(1238001, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1238001"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1238001 Site.CaptureRequirementIfAreEqual<uint>( (uint)GetSearchFlags.Static, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Static, 1238001, @"[In Appendix A: Product Behavior] Implementation does be regardless of the value of the STATIC_SEARCH bit in the RopSetSearchCriteria ROP request. <14> Section 3.2.5.4: A content-indexed search is always static on the initial release version of Exchange 2010 and Exchange 2007 regardless of the value of the STATIC_SEARCH bit in the RopSetSearchCriteria request."); } if (Common.IsRequirementEnabled(1238002, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1238002"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1238002 Site.CaptureRequirementIfAreNotEqual<uint>( (uint)GetSearchFlags.Static, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Static, 1238002, @"[In Appendix A: Product Behavior] Implementation does not be regardless of the value of the STATIC_SEARCH bit in the RopSetSearchCriteria ROP request.(Exchange 2013 and above follow this hebavior)."); } #endregion }
public void MSOXCFOLD_S03_TC02_DynamicSearchVerification() { this.CheckWhetherSupportTransport(); this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. The client calls RopCreateFolder to create the general folder [MSOXCFOLDSubfolder1] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest(); createFolderRequest.RopId = (byte)RopId.RopCreateFolder; createFolderRequest.LogonId = Constants.CommonLogonId; createFolderRequest.InputHandleIndex = Constants.CommonInputHandleIndex; createFolderRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; createFolderRequest.FolderType = 0x01; createFolderRequest.UseUnicodeStrings = 0x0; createFolderRequest.OpenExisting = 0x00; createFolderRequest.Reserved = 0x0; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder1); createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.Subfolder1); RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint subfolderHandle1 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; ulong subfolderId1 = createFolderResponse.FolderId; #endregion #region Step 2. The client creates a non-FAI message under the general folder [MSOXCFOLDSubfolder1]. uint messageNonFAIHandle1 = 0; ulong messageNonFAIId1 = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageNonFAIId1, ref messageNonFAIHandle1); #endregion #region Step 3. The client calls RopCreateFolder to create the search folder [MSOXCFOLDSearchFolder1] under the root folder. createFolderRequest.FolderType = 0x02; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder); createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 4. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder1]. RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex }; PropertyTag propertyTag = new PropertyTag { PropertyId = (ushort)MessagePropertyId.PidTagMessageClass, PropertyType = (ushort)PropertyType.PtypString }; ExistRestriction existRestriction = new ExistRestriction { PropTag = propertyTag }; setSearchCriteriaRequest.RestrictionDataSize = (ushort)existRestriction.Size(); setSearchCriteriaRequest.RestrictionData = existRestriction.Serialize(); setSearchCriteriaRequest.FolderIds = new ulong[] { subfolderId1 }; setSearchCriteriaRequest.FolderIdCount = (ushort)setSearchCriteriaRequest.FolderIds.Length; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.NonContentIndexedSearch | (uint)SetSearchFlags.RestartSearch; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R783"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R783 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, 783, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): NON_CONTENT_INDEXED_SEARCH (0x00020000) means that the search does not use a content-indexed search."); #endregion #region Step 5. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. RopGetSearchCriteriaRequest getSearchCriteriaRequest = new RopGetSearchCriteriaRequest { RopId = (byte)RopId.RopGetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, UseUnicode = 0x00, IncludeRestriction = 0x01, IncludeFolders = 0x01 }; RopGetSearchCriteriaResponse getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R785"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R785 Site.CaptureRequirementIfAreEqual<uint>( (uint)GetSearchFlags.Running, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Running, 785, @"[In RopGetSearchCriteria ROP Response Buffer] SearchFlags (4 bytes): SEARCH_RUNNING (0x00000001) means that the search is running, which means that the initial population of the search folder still being compiled."); #endregion #region Step 6. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder1]. RopGetContentsTableRequest getContentsTableRequest = new RopGetContentsTableRequest(); RopGetContentsTableResponse getContentsTableResponse; getContentsTableRequest.RopId = (byte)RopId.RopGetContentsTable; getContentsTableRequest.LogonId = Constants.CommonLogonId; getContentsTableRequest.InputHandleIndex = Constants.CommonInputHandleIndex; getContentsTableRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; getContentsTableRequest.TableFlags = (byte)FolderTableFlags.None; int count = 0; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != 1) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); #region Verify the requirements: MS-OXCFOLD_R552, MS-OXCFOLD_R526. Site.Assert.AreEqual<uint>((uint)GetSearchFlags.Running, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Running, "The RopSearchCriteria ROP operation has not been complete."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R526"); // If the client has received the success code from the server after sending a RopSetSearchCriteria request. // If the client has received a 'SEARCH_RUNNING' SearchFlags in the RopGetSearchCriteria response after sending a RopGetSearchCriteria response later. // If the client has got the messages which according to the search criteria and search scope that are specified in the RopSetSearchCriteria ROP request in the RopGetContentsTable response after sending a RopGetContentsTable request later. // Satisfy the above conditions, then this requirement can be verified directly. Site.CaptureRequirement( 526, @"[In Processing a RopSetSearchCriteria ROP Request] The server can return the RopSetSearchCriteria ROP response before the search folder is fully updated."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R552"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R552 // There should have 1 message macthed the search criteria, so the RowCount should be 1. Site.CaptureRequirementIfAreEqual<uint>( 1, getContentsTableResponse.RowCount, 552, @"[In Processing a RopSetSearchCriteria ROP Request] A dynamic search causes the search folder to be initially populated with all messages that match the search criteria at the point in time when the search is started or restarted."); #endregion #endregion #region Step 7. The client calls RopSetSearchCriteria without setting the SearchFlags to establish search criteria for [MSOXCFOLDSearchFolder1]. setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.None; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 8. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); #endregion #region Step 9. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder1]. count = 0; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != 1) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); #endregion #region Step 10. The client creates a non-FAI message under the general folder [MSOXCFOLDSubfolder1]. uint messageNonFAIHandle3 = 0; ulong messageNonFAIId3 = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageNonFAIId3, ref messageNonFAIHandle3); #endregion #region Step 11. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder1]. count = 0; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != 2) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); #region Verify the requirements: MS-OXCFOLD_R1095, MS-OXCFOLD_R1210, MS-OXCFOLD_R1096, and MS-OXCFOLD_R1097. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1096"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1096 // There should have 2 messages found so the RowCount should be 2. Site.CaptureRequirementIfAreEqual<uint>( 2, getContentsTableResponse.RowCount, 1096, @"[In Processing a RopSetSearchCriteria ROP Request] For dynamic search folders, the contents of the search folder MUST continue to be updated as messages start to match or cease to match the search criteria. "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1210"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1210 Site.CaptureRequirementIfAreEqual<uint>( 2, getContentsTableResponse.RowCount, 1210, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): STATIC_SEARCH (0x00040000) means that the search is dynamic, if not set."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1095"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1095 // There should have 2 messages found so the RowCount should be 2. Site.CaptureRequirementIfAreEqual<uint>( 2, getContentsTableResponse.RowCount, 1095, @"[In Processing a RopSetSearchCriteria ROP Request] For dynamic search folders, the contents of the search folder MUST continue to be updated as messages move around the mailbox. "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1097"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1097 Site.CaptureRequirementIfAreEqual<uint>( 2, getContentsTableResponse.RowCount, 1097, @"[In Processing a RopSetSearchCriteria ROP Request] The server continues to update the search folder with messages that enter or exit the search criteria."); #endregion #endregion }
public void MSOXCFOLD_S03_TC15_NonContentIndexedSearchVerification() { this.CheckWhetherSupportTransport(); this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. The client calls RopCreateFolder to create the general folder [MSOXCFOLDSubfolder1] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = 0x01, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder1), Comment = Encoding.ASCII.GetBytes(Constants.Subfolder1) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint subfolderHandle1 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; ulong subfolderId1 = createFolderResponse.FolderId; #endregion #region Step 2. The client creates a non-FAI message under the general folder [MSOXCFOLDSubfolder1]. uint messageNonFAIHandle1 = 0; ulong messageNonFAIId1 = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageNonFAIId1, ref messageNonFAIHandle1); #endregion #region Step 3. The client calls RopCreateFolder to create the search folder [MSOXCFOLDSearchFolder1] under the root folder. createFolderRequest.FolderType = (byte)FolderType.Searchfolder; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder); createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 4. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder1]. RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex }; PropertyTag propertyTag = new PropertyTag { PropertyId = (ushort)MessagePropertyId.PidTagMessageClass, PropertyType = (ushort)PropertyType.PtypString }; ExistRestriction existRestriction = new ExistRestriction { PropTag = propertyTag }; setSearchCriteriaRequest.RestrictionDataSize = (ushort)existRestriction.Size(); setSearchCriteriaRequest.RestrictionData = existRestriction.Serialize(); setSearchCriteriaRequest.FolderIds = new ulong[] { subfolderId1 }; setSearchCriteriaRequest.FolderIdCount = (ushort)setSearchCriteriaRequest.FolderIds.Length; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.NonContentIndexedSearch | (uint)SetSearchFlags.RestartSearch; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R783"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R783 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, 783, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): NON_CONTENT_INDEXED_SEARCH (0x00020000) means that the search does not use a content-indexed search."); #endregion #region Step 5. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder1]. RopGetContentsTableRequest getContentsTableRequest = new RopGetContentsTableRequest(); RopGetContentsTableResponse getContentsTableResponse; getContentsTableRequest.RopId = (byte)RopId.RopGetContentsTable; getContentsTableRequest.LogonId = Constants.CommonLogonId; getContentsTableRequest.InputHandleIndex = Constants.CommonInputHandleIndex; getContentsTableRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; getContentsTableRequest.TableFlags = (byte)FolderTableFlags.None; int count = 0; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != 1) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); #endregion #region Step 6. The client calls RopSetSearchCriteria to stop establish search criteria for [MSOXCFOLDSearchFolder1]. setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.StopSearch; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 7. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. RopGetSearchCriteriaRequest getSearchCriteriaRequest = new RopGetSearchCriteriaRequest { RopId = (byte)RopId.RopGetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, UseUnicode = 0x00, IncludeRestriction = 0x01, IncludeFolders = 0x01 }; RopGetSearchCriteriaResponse getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); #region Verify the requirements: MS-OXCFOLD_R673, MS-OXCFOLD_R54301. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R673"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R673 Site.CaptureRequirementIfAreNotEqual<uint>( (uint)GetSearchFlags.Running, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Running, 673, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes):STOP_SEARCH (0x00000001) means that the search is aborted."); if (Common.IsRequirementEnabled(54301, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R54301"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R54301 Site.CaptureRequirementIfAreNotEqual<uint>( (uint)GetSearchFlags.Running, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Running, 54301, @"[In Processing a RopSetSearchCriteria ROP Request] Implementation does stop the initial population of the search folder if the STOP_SEARCH bit is set in the SearchFlags field. (Exchange 2007 and above follow this behavior)."); } #endregion #endregion #region Step 8. The client calls RopSetSearchCriteria to restart establish search criteria for [MSOXCFOLDSearchFolder1]. setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.RestartSearch; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 9. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); Site.Assert.AreEqual<uint>((uint)GetSearchFlags.Running, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Running, "The SearchFlags field contains the 'SEARCH_RUNNING' bits."); #region Verify the requirements: MS-OXCFOLD_R546, MS-OXCFOLD_R768, and MS-OXCFOLD_R767. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R767"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R767 Site.CaptureRequirementIfAreEqual<uint>( (uint)GetSearchFlags.Running, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Running, 767, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): RESTART_SEARCH (0x00000002) means that the search is initiated, if the search is restarted."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R768"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R768 Site.CaptureRequirementIfAreEqual<uint>( (uint)GetSearchFlags.Running, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Running, 768, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): RESTART_SEARCH (0x00000002) means that the search is initiated, if the search is inactive."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R546"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R546 Site.CaptureRequirementIfAreEqual<uint>( (uint)GetSearchFlags.Running, getSearchCriteriaResponse.SearchFlags & (uint)GetSearchFlags.Running, 546, @"[In Processing a RopSetSearchCriteria ROP Request] If the RESTART_SEARCH bit is set in the SearchFlags field, the server restarts the population of the search folder."); #endregion #endregion }
public void MSOXCFOLD_S03_TC16_GetPropertyPidTagFolderFlags() { this.CheckWhetherSupportTransport(); this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. Call RopCreateFolder to create [MSOXCFOLDSubfolder1] under the root folder. uint subfolderHandle1 = 0; ulong subfolderId1 = 0; this.CreateFolder(this.RootFolderHandle, Constants.Subfolder1, ref subfolderId1, ref subfolderHandle1); #endregion #region Step 2. Creates a none-FAI message in [MSOXCFOLDSubfolder1]. ulong messageId = 0; uint messageHandle = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageId, ref messageHandle); #endregion #region Step 3. Create a FAI message and saves it in [MSOXCFOLDSubfolder1]. uint messageHandle2 = 0; ulong messageId2 = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, 0x01, ref messageId2, ref messageHandle2); #endregion #region Step 4. The client calls RopCreateFolder to create the search folder [MSOXCFOLDSearchFolder1] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = (byte)FolderType.Searchfolder, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder), Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 5. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder1]. RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex }; PropertyTag propertyTag = new PropertyTag { PropertyId = (ushort)MessagePropertyId.PidTagMessageClass, PropertyType = (ushort)PropertyType.PtypString }; ExistRestriction existRestriction = new ExistRestriction { PropTag = propertyTag }; setSearchCriteriaRequest.RestrictionDataSize = (ushort)existRestriction.Size(); setSearchCriteriaRequest.RestrictionData = existRestriction.Serialize(); setSearchCriteriaRequest.FolderIds = new ulong[] { subfolderId1 }; setSearchCriteriaRequest.FolderIdCount = (ushort)setSearchCriteriaRequest.FolderIds.Length; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.NonContentIndexedSearch | (uint)SetSearchFlags.RestartSearch; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 6. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder1]. RopGetContentsTableRequest getContentsTableRequest = new RopGetContentsTableRequest(); RopGetContentsTableResponse getContentsTableResponse; getContentsTableRequest.RopId = (byte)RopId.RopGetContentsTable; getContentsTableRequest.LogonId = Constants.CommonLogonId; getContentsTableRequest.InputHandleIndex = Constants.CommonInputHandleIndex; getContentsTableRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; getContentsTableRequest.TableFlags = (byte)FolderTableFlags.None; int count = 0; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != 1) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); #endregion #region Step 7. The client creates rules on [MSOXCFOLDSubfolder1] folder. RuleData[] sampleRuleDataArray; object ropResponse = null; sampleRuleDataArray = this.CreateSampleRuleDataArrayForAdd(); RopModifyRulesRequest modifyRulesRequest = new RopModifyRulesRequest() { RopId = (byte)RopId.RopModifyRules, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, ModifyRulesFlags = 0x00, RulesCount = (ushort)sampleRuleDataArray.Length, RulesData = sampleRuleDataArray, }; modifyRulesRequest.RopId = (byte)RopId.RopModifyRules; modifyRulesRequest.LogonId = Constants.CommonLogonId; modifyRulesRequest.InputHandleIndex = Constants.CommonInputHandleIndex; sampleRuleDataArray = this.CreateSampleRuleDataArrayForAdd(); modifyRulesRequest.ModifyRulesFlags = 0x00; modifyRulesRequest.RulesCount = (ushort)sampleRuleDataArray.Length; modifyRulesRequest.RulesData = sampleRuleDataArray; this.Adapter.DoRopCall(modifyRulesRequest, subfolderHandle1, ref ropResponse, ref this.responseHandles); RopModifyRulesResponse modifyRulesResponse = (RopModifyRulesResponse)ropResponse; Site.Assert.AreEqual<uint>(Constants.SuccessCode, modifyRulesResponse.ReturnValue, "RopModifyRules ROP operation performs successfully!"); #endregion #region Step 8. The client calls RopOpenFolder to open [MSOXCFOLDSubfolder1] folder. RopOpenFolderRequest openFolderRequest = new RopOpenFolderRequest { RopId = (byte)RopId.RopOpenFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderId = subfolderId1, OpenModeFlags = (byte)FolderOpenModeFlags.None }; RopOpenFolderResponse openFolderResponse = this.Adapter.OpenFolder(openFolderRequest, subfolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, openFolderResponse.ReturnValue, "RopOpenFolder ROP operation performs successfully!"); #endregion #region Step 9. The client gets the PidTagFolderFlags propertie from [MSOXCFOLDSubfolder1]. PropertyTag[] propertyTagArray = new PropertyTag[1]; propertyTag = new PropertyTag { PropertyId = (ushort)FolderPropertyId.PidTagFolderFlags, PropertyType = (ushort)PropertyType.PtypInteger32 }; propertyTagArray[0] = propertyTag; RopGetPropertiesSpecificRequest getPropertiesSpecificRequest = new RopGetPropertiesSpecificRequest(); RopGetPropertiesSpecificResponse getPropertiesSpecificResponse; getPropertiesSpecificRequest.RopId = (byte)RopId.RopGetPropertiesSpecific; getPropertiesSpecificRequest.LogonId = Constants.CommonLogonId; getPropertiesSpecificRequest.InputHandleIndex = Constants.CommonInputHandleIndex; getPropertiesSpecificRequest.PropertySizeLimit = 0xFFFF; getPropertiesSpecificRequest.PropertyTagCount = (ushort)propertyTagArray.Length; getPropertiesSpecificRequest.PropertyTags = propertyTagArray; getPropertiesSpecificResponse = this.Adapter.GetFolderObjectSpecificProperties(getPropertiesSpecificRequest, subfolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(0, getPropertiesSpecificResponse.ReturnValue, "RopGetPropertiesSpecific ROP operation performs successfully!"); uint pidTagFolderFlags = BitConverter.ToUInt32(getPropertiesSpecificResponse.RowData.PropertyValues[0].Value, 0); #region Verify MS-OXCFOLD_R1035110, MS-OXCFOLD_R1035111, MS-OXCFOLD_R1035103 and MS-OXCFOLD_R1035107 // Add the debug information Site.Log.Add(LogEntryKind.Debug, @"Verify MS-OXCFOLD_R1035110: [In PidTagFolderFlags Property] The PidTagFolderId property ([MS-OXPROPS] section 2.692) contains a computed value that specifies the type or state of a folder."); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1035110 Site.CaptureRequirement( 1035110, @"[In PidTagFolderFlags Property] The PidTagFolderId property ([MS-OXPROPS] section 2.692) contains a computed value that specifies the type or state of a folder."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, @"Verify MS-OXCFOLD_R1035111: [In PidTagFolderFlags Property] The value is a bitwise OR of zero or more values [1: IPM, 2: SEARCH, 4: NORMAL, 8: RULES] from the following table."); bool isR1035111Verified = false; if (((pidTagFolderFlags & 1) == 1) || ((pidTagFolderFlags & 2) == 2) || ((pidTagFolderFlags & 4) == 4) || ((pidTagFolderFlags & 8) == 8)) { isR1035111Verified = true; } // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1035111 Site.CaptureRequirementIfIsTrue( isR1035111Verified, 1035111, @"[In PidTagFolderFlags Property] The value is a bitwise OR of zero or more values [1: IPM, 2: SEARCH, 4: NORMAL, 8: RULES] from the following table."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, @"Verify MS-OXCFOLD_R1035103: [In PidTagFolderFlags Property] [The folder flag named ""IPM"" specified] the folder belongs to the IPM subtree portion of the mailbox."); bool isR1035103Verified = false; if ((pidTagFolderFlags & 1) == 1) { isR1035103Verified = true; } // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1035103 Site.CaptureRequirementIfIsTrue( isR1035103Verified, 1035103, @"[In PidTagFolderFlags Property] [The folder flag named ""IPM"" specified] the folder belongs to the IPM subtree portion of the mailbox."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, @"Verify MS-OXCFOLD_R1035107: [In PidTagFolderFlags Property] [The folder flag named ""NORMAL"" specified] the folder is a generic folder that contains messages and other folders."); bool isR1035107Verified = false; if ((pidTagFolderFlags & 4) == 4) { isR1035107Verified = true; } // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1035107 Site.CaptureRequirementIfIsTrue( isR1035107Verified, 1035107, @"[In PidTagFolderFlags Property] [The folder flag named ""NORMAL"" specified] the folder is a generic folder that contains messages and other folders."); #endregion #endregion }
public void MSOXCFOLD_S03_TC14_ContentIndexedSearchVerification() { this.CheckWhetherSupportTransport(); this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. The client calls RopCreateFolder to create the general folder [MSOXCFOLDSubfolder1] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = (byte)FolderType.Genericfolder, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder1), Comment = Encoding.ASCII.GetBytes(Constants.Subfolder1) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint subfolderHandle1 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; ulong subfolderId1 = createFolderResponse.FolderId; #endregion #region Step 2. The client creates a non-FAI message under the general folder [MSOXCFOLDSubfolder1]. uint messageNonFAIHandle1 = 0; ulong messageNonFAIId1 = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageNonFAIId1, ref messageNonFAIHandle1); #endregion #region Step 3. The client calls RopCreateFolder to create the general folder [MSOXCFOLDSubfolder2] under the general folder [MSOXCFOLDSubfolder1]. createFolderRequest.FolderType = (byte)FolderType.Genericfolder; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder2); createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.Subfolder2); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, subfolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint subfolderHandle2 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; ulong subfolderId2 = createFolderResponse.FolderId; #endregion #region Step 4. The client creates a non-FAI message under the general folder [MSOXCFOLDSubfolder2]. uint messageNonFAIHandle2 = 0; ulong messageNonFAIId2 = 0; this.CreateSaveMessage(subfolderHandle2, subfolderId2, ref messageNonFAIId2, ref messageNonFAIHandle2); #endregion #region Step 5. The client calls RopCreateFolder to create the search folder [MSOXCFOLDSearchFolder1] under the root folder. createFolderRequest.FolderType = (byte)FolderType.Searchfolder; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder); createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle1 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 6. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder1]. RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex }; PropertyTag propertyTag = new PropertyTag { PropertyId = (ushort)MessagePropertyId.PidTagMessageClass, PropertyType = (ushort)PropertyType.PtypString }; ExistRestriction existRestriction = new ExistRestriction { PropTag = propertyTag }; setSearchCriteriaRequest.RestrictionDataSize = (ushort)existRestriction.Size(); setSearchCriteriaRequest.RestrictionData = existRestriction.Serialize(); setSearchCriteriaRequest.FolderIds = new ulong[] { subfolderId1 }; setSearchCriteriaRequest.FolderIdCount = (ushort)setSearchCriteriaRequest.FolderIds.Length; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.ContentIndexedSearch | (uint)SetSearchFlags.RestartSearch | (uint)SetSearchFlags.ForGroundSearch | (uint)SetSearchFlags.RecursiveSearch; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R782"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R782 Site.CaptureRequirementIfAreEqual<uint>( Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, 782, @"[In RopSetSearchCriteria ROP Request Buffer] SearchFlags (4 bytes): CONTENT_INDEXED_SEARCH (0x00010000) means that the search uses a content-indexed search."); #endregion #region Step 7. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. RopGetSearchCriteriaRequest getSearchCriteriaRequest = new RopGetSearchCriteriaRequest { RopId = (byte)RopId.RopGetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, UseUnicode = 0x00, IncludeRestriction = 0x01, IncludeFolders = 0x01 }; RopGetSearchCriteriaResponse getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); ulong priviewFolderId = getSearchCriteriaResponse.FolderIds[0]; #endregion #region Step 8. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder1]. RopGetContentsTableRequest getContentsTableRequest = new RopGetContentsTableRequest(); RopGetContentsTableResponse getContentsTableResponse; getContentsTableRequest.RopId = (byte)RopId.RopGetContentsTable; getContentsTableRequest.LogonId = Constants.CommonLogonId; getContentsTableRequest.InputHandleIndex = Constants.CommonInputHandleIndex; getContentsTableRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; getContentsTableRequest.TableFlags = (byte)FolderTableFlags.None; int count = 0; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != 2) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); #region Verify the requirements: MS-OXCFOLD_R515, MS-OXCFOLD_R770, and MS-OXCFOLD_R789. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R515"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R515 // There has 2 messages matched the search criteria, so the RowCount should be 2. Site.CaptureRequirementIfAreEqual<uint>( 2, getContentsTableResponse.RowCount, 515, @"[In Processing a RopSetSearchCriteria ROP Request] The server fills the search folder according to the search criteria and search scope that are specified in the RopSetSearchCriteria ROP request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R770"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R770 Site.CaptureRequirementIfAreEqual<uint>( 2, getContentsTableResponse.RowCount, 770, @"[In RopSetSearchCriteria ROP Request Buffer]SearchFlags (4 bytes): RECURSIVE_SEARCH (0x00000004) means that the search includes the search folder containers and all of their child folders."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R789"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R789 // There has 2 messages matched search criteria, so the RowCount should be 2. Site.CaptureRequirementIfAreEqual<uint>( 2, getContentsTableResponse.RowCount, 789, @"[In RopGetSearchCriteria ROP Response Buffer] SearchFlags (4 bytes): If this bit [SEARCH_RECURSIVE (0x00000004)] is set, the specified search folder containers and all their child search folder containers are searched for matching entries."); #endregion #endregion #region Step 9. The client creates a non-FAI message under the general folder [MSOXCFOLDSubfolder1]. uint messageNonFAIHandle3 = 0; ulong messageNonFAIId3 = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageNonFAIId3, ref messageNonFAIHandle3); #endregion #region Step 10. The client calls RopSetSearchCriteria without setting the SearchFlags field to establish search criteria for [MSOXCFOLDSearchFolder1]. setSearchCriteriaRequest.FolderIdCount = 0; setSearchCriteriaRequest.FolderIds = null; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.None; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 11. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle1, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R109"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R109 Site.CaptureRequirementIfAreEqual<ulong>( priviewFolderId, getSearchCriteriaResponse.FolderIds[0], 109, @"[In RopSetSearchCriteria ROP Request Buffer] FolderIdCount (2 bytes): If the FolderIdCount field is set to zero, the folders that were used in the most recent search are used again."); #endregion #region Step 12. The client calls RopCreateFolder to create the search folder [MSOXCFOLDSearchFolder2] under the root folder. createFolderRequest.FolderType = (byte)FolderType.Searchfolder; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder2); createFolderRequest.Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder2); createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle2 = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 13. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder2]. setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex }; propertyTag = new PropertyTag { PropertyId = (ushort)MessagePropertyId.PidTagMessageClass, PropertyType = (ushort)PropertyType.PtypString }; existRestriction = new ExistRestriction { PropTag = propertyTag }; setSearchCriteriaRequest.RestrictionDataSize = (ushort)existRestriction.Size(); setSearchCriteriaRequest.RestrictionData = existRestriction.Serialize(); setSearchCriteriaRequest.FolderIds = new ulong[] { subfolderId1 }; setSearchCriteriaRequest.FolderIdCount = (ushort)setSearchCriteriaRequest.FolderIds.Length; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.ContentIndexedSearch | (uint)SetSearchFlags.RestartSearch; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 14. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder2]. getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); #endregion #region Step 15. The client calls RopGetContentsTable to retrieve the contents table for the search folder [MSOXCFOLDSearchFolder2]. count = 0; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle2, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); if (getContentsTableResponse.RowCount != 2) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R960"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R960 // There has 2 messages matched the search criteria, so the RowCount should be 2. Site.CaptureRequirementIfAreEqual<uint>( 2, getContentsTableResponse.RowCount, 960, @"[In RopGetSearchCriteria ROP Response Buffer] If this bit [SEARCH_RECURSIVE] is not set, only the search folder containers that are specified in the last RopSetSearchCriteria ROP request (section 2.2.1.4.1) are being searched."); #endregion }
public void MSOXCFOLD_S03_TC13_RestrictionDataValidation() { this.CheckWhetherSupportTransport(); this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. The client calls RopCreateFolder to create [MSOXCFOLDSubfolder1] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = (byte)FolderType.Genericfolder, UseUnicodeStrings = 0x0, OpenExisting = 0x01, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.Subfolder1), Comment = Encoding.ASCII.GetBytes(Constants.Subfolder1) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); ulong folderId = createFolderResponse.FolderId; uint folderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 2. The client creates a non-FAI message under [MSOXCFOLDSubfolder1]. ulong messageId1 = 0; uint messageHandle1 = 0; this.CreateSaveMessage(folderHandle, folderId, ref messageId1, ref messageHandle1); #endregion #region Step 3. The client calls RopCreateFolder to create a search folder [MSOXCFOLDSearchFolder1] under the root folder. createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = (byte)FolderType.Searchfolder, UseUnicodeStrings = 0x0, OpenExisting = 0x01, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder), Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder) }; createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 4. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSearchFolder1]. ulong[] folderIds = new ulong[] { folderId }; RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest(); setSearchCriteriaRequest.RopId = (byte)RopId.RopSetSearchCriteria; setSearchCriteriaRequest.LogonId = Constants.CommonLogonId; setSearchCriteriaRequest.InputHandleIndex = Constants.CommonInputHandleIndex; ContentRestriction contentRestriction = new ContentRestriction { FuzzyLevelLow = FuzzyLevelLowValues.FL_PREFIX, FuzzyLevelHigh = FuzzyLevelHighValues.FL_IGNORECASE }; PropertyTag propertyTag = new PropertyTag { PropertyId = (ushort)MessagePropertyId.PidTagMessageClass, PropertyType = (ushort)PropertyType.PtypString }; contentRestriction.PropertyTag = propertyTag; TaggedPropertyValue taggedProperty = new TaggedPropertyValue { PropertyTag = propertyTag, Value = Encoding.Unicode.GetBytes("IPM.Task" + Constants.StringNullTerminated) }; contentRestriction.TaggedValue = taggedProperty; NotRestriction notRestriction = new NotRestriction { Restricts = contentRestriction }; setSearchCriteriaRequest.RestrictionDataSize = (ushort)notRestriction.Size(); byte[] restrictionData = notRestriction.Serialize(); setSearchCriteriaRequest.RestrictionData = restrictionData; setSearchCriteriaRequest.FolderIdCount = (ushort)folderIds.Length; setSearchCriteriaRequest.FolderIds = folderIds; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.RestartSearch; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSetSearchCriteria ROP operation performs successfully!"); #endregion #region Step 5. The client calls RopGetSearchCriteria with the UseUnicode field set to 0x01 to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. RopGetSearchCriteriaRequest getSearchCriteriaRequest = new RopGetSearchCriteriaRequest { RopId = (byte)RopId.RopGetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, UseUnicode = 0x01, IncludeRestriction = 0x01, IncludeFolders = 0x01 }; RopGetSearchCriteriaResponse getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); Restriction restrictTemp = RestrictsFactory.Deserialize(getSearchCriteriaResponse.RestrictionData); NotRestriction notRestrictionTemp = (NotRestriction)restrictTemp; ContentRestriction contentRestrictionTemp = (ContentRestriction)notRestrictionTemp.Restricts; contentRestrictionTemp = (ContentRestriction)notRestrictionTemp.Restricts; string str = Encoding.Unicode.GetString(contentRestrictionTemp.TaggedValue.Value); #region Verify the requirements: MS-OXCFOLD_R127, MS-OXCFOLD_R137. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R127"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R127 Site.CaptureRequirementIfAreEqual<string>( "IPM.Task" + Constants.StringNullTerminated, str, 127, @"[In RopGetSearchCriteria ROP Request Buffer] UseUnicode (1 byte): A Boolean value that is nonzero (TRUE) if the value of the RestrictionData field of the ROP response is to be in Unicode format."); #endregion #endregion #region Step 6. The client calls RopGetSearchCriteria with the UseUnicode field set to 0x00 to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. getSearchCriteriaRequest.UseUnicode = 0x00; getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); restrictTemp = RestrictsFactory.Deserialize(getSearchCriteriaResponse.RestrictionData); notRestrictionTemp = (NotRestriction)restrictTemp; contentRestrictionTemp = (ContentRestriction)notRestrictionTemp.Restricts; str = Encoding.Unicode.GetString(contentRestrictionTemp.TaggedValue.Value); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R128"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R128 Site.CaptureRequirementIfAreNotEqual<string>( "IPM.Task" + Constants.StringNullTerminated, str, 128, @"[In RopGetSearchCriteria ROP Request Buffer] UseUnicode (1 byte): [A Boolean value that is] zero (FALSE) otherwise [if the value of the RestrictionData field of the ROP response is not to be in Unicode format]."); #endregion #region Step 7. The client calls RopSetSearchCriteria to restart searching criteria for [MSOXCFOLDSearchFolder1]. setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.RestartSearch; setSearchCriteriaRequest.RestrictionDataSize = 0; setSearchCriteriaRequest.RestrictionData = null; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSetSearchCriteria ROP operation performs successfully!"); #endregion #region Step 8. The client calls RopGetSearchCriteria with the UseUnicode field set to 0x00 to obtain the search criteria and the status of the search folder [MSOXCFOLDSearchFolder1]. getSearchCriteriaRequest.UseUnicode = 0x01; getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); restrictTemp = RestrictsFactory.Deserialize(getSearchCriteriaResponse.RestrictionData); notRestrictionTemp = (NotRestriction)restrictTemp; contentRestrictionTemp = (ContentRestriction)notRestrictionTemp.Restricts; str = Encoding.Unicode.GetString(contentRestrictionTemp.TaggedValue.Value); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R105"); // Get the portion information of RestrictionData field is this data is same as the data set by the previous RopSetSearchCriteria request, this requirement can be verified. // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R105 Site.CaptureRequirementIfAreEqual<string>( "IPM.Task" + Constants.StringNullTerminated, str, 105, @"[In RopSetSearchCriteria ROP Request Buffer] RestrictionDataSize (2 bytes): If the value of the RestrictionDataSize field is zero, the search criteria that were used most recently for the search folder container are used again."); #endregion }
public void MSOXCFOLD_S03_TC11_RopSetSearchCriteriaFailure() { this.CheckWhetherSupportTransport(); this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. The client calls RopSetSearchCriteria to establish search criteria for the root folder which is a generic folder rather a search folder. ulong[] folderIds = new ulong[] { this.DefaultFolderIds[0], this.DefaultFolderIds[1], this.DefaultFolderIds[3], this.DefaultFolderIds[4], this.DefaultFolderIds[5], this.DefaultFolderIds[6], this.DefaultFolderIds[7], this.DefaultFolderIds[8], this.DefaultFolderIds[9], this.DefaultFolderIds[10], this.DefaultFolderIds[11], }; RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, RestrictionDataSize = 0x0005 }; byte[] restrictionData = { 0x08, 0x1f, 0x00, 0x1a, 0x00 }; setSearchCriteriaRequest.RestrictionData = restrictionData; setSearchCriteriaRequest.FolderIdCount = (ushort)folderIds.Length; setSearchCriteriaRequest.FolderIds = folderIds; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.StopSearch; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, this.RootFolderHandle, ref this.responseHandles); #region Verify requirements: MS-OXCFOLD_R569, MS-OXCFOLD_R570, and MS-OXCFOLD_R46. // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R569"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R569 Site.CaptureRequirementIfAreEqual<uint>( 0x00000461, setSearchCriteriaResponse.ReturnValue, 569, @"[In Processing a RopSetSearchCriteria ROP Request]The value of error code ecNotSearchFolder is 0x00000461."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R570"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R570 Site.CaptureRequirementIfAreEqual<uint>( 0x00000461, setSearchCriteriaResponse.ReturnValue, 570, @"[In Processing a RopSetSearchCriteria ROP Request] When the error code is ecNotSearchFolder, it indicates the object is not a search folder."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R46"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R46 Site.CaptureRequirementIfAreNotEqual<uint>( Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, 46, @"[InRopCreateFolder ROP Request Buffer] FolderType (1 byte): The value 1 indicates the folder type is Generic folder."); #endregion #endregion #region Step 2. The client calls RopSetSearchCriteria with a logon object handle rather a search folder handle. // Use logon object handle in which case is purposed to get error code ecNotSupported [0x80040102]. setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, this.LogonHandle, ref this.responseHandles); #region Verify requirement: MS-OXCFOLD_R573, MS-OXCFOLD_R574. // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R573"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R573 Site.CaptureRequirementIfAreEqual<uint>( 0x80040102, setSearchCriteriaResponse.ReturnValue, 573, @"[In Processing a RopSetSearchCriteria ROP Request]The value of error code ecNotSupported is 0x80040102."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R574"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R574 Site.CaptureRequirementIfAreEqual<uint>( 0x80040102, setSearchCriteriaResponse.ReturnValue, 574, @"[In Processing a RopSetSearchCriteria ROP Request] When the error code is ecNotSupported, it indicates the object that this ROP [RopSetSearchCriteria] was called on is not a Folder object."); #endregion #endregion #region Step 3. The client calls RopCreateFolder to create a search folder named [MSOXCFOLDSearchFolder1] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = (byte)FolderType.Searchfolder, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder), Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); uint searchFolderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; ulong searchFolderID = createFolderResponse.FolderId; #endregion #region Step 4. The client calls RopSetSearchCriteria use the handle of [MSOXCFOLDSearchFolder1] and a SearchFlags with invalid bit. setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, RestrictionData = restrictionData, SearchFlags = uint.MaxValue, FolderIdCount = (ushort)folderIds.Length, FolderIds = folderIds }; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); #region Verify the requirements: MS-OXCFOLD_R116001, MS-OXCFOLD_R1091, MS-OXCFOLD_R1092, and MS-OXCFOLD_R116002. if (Common.IsRequirementEnabled(116001, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R116001"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R116001 Site.CaptureRequirementIfAreEqual<uint>( 0x80070057, setSearchCriteriaResponse.ReturnValue, 116001, @"[In Appendix A: Product Behavior] If the client sets an invalid bit in the SearchFlags field, implementation does fail the RopSetSearchCriteria ROP operation with ecInvalidParam (0x80070057). (Microsoft Exchange 2010 and above follow this behavior.)"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1091"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1091 Site.CaptureRequirementIfAreEqual<uint>( 0x80070057, setSearchCriteriaResponse.ReturnValue, 1091, @"[In Processing a RopSetSearchCriteria ROP Request] The value of error code ecInvalidParam is 0x80070057."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1092"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1092 Site.CaptureRequirementIfAreEqual<uint>( 0x80070057, setSearchCriteriaResponse.ReturnValue, 1092, @"[In Processing a RopSetSearchCriteria ROP Request] When the error code is ecInvalidParam, it indicates the SearchFlags field contains an invalid value."); } if (Common.IsRequirementEnabled(116002, this.Site)) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R116002"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R116002 Site.CaptureRequirementIfAreNotEqual<uint>( 0x80070057, setSearchCriteriaResponse.ReturnValue, 116002, @"[In Appendix A: Product Behavior] If the client sets an invalid bit in the SearchFlags field, implementation does not fail the RopSetSearchCriteria ROP operation with ecInvalidParam (0x80070057). <17> Section 3.2.5.4: Exchange 2007 silently ignores invalid bits and does not return the ecInvalidParam error code."); } #endregion #endregion #region Step 5. The client calls RopSetSearchCriteria with no folder ID specified for search folder [MSOXCFOLDSearchFolder1] which is not initialized. setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, RestrictionData = restrictionData, SearchFlags = (uint)SetSearchFlags.RestartSearch, FolderIdCount = 0, FolderIds = null }; setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); #region Verify the requirements: MS-OXCFOLD_R565, MS-OXCFOLD_R566 and MS-OXCFOLD_R1240. // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R565"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R565. Site.CaptureRequirementIfAreEqual<uint>( 0x80040605, setSearchCriteriaResponse.ReturnValue, 565, @"[In Processing a RopSetSearchCriteria ROP Request] The value of error code ecNotInitialized is 0x80040605."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1240: the return value of RopSetSearchCriteria request with no FIDs is {0}", setSearchCriteriaResponse.ReturnValue); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1240. Site.CaptureRequirementIfAreEqual<uint>( 0x80040605, setSearchCriteriaResponse.ReturnValue, 1240, @"[In Processing a RopSetSearchCriteria ROP Request] If the client does not specify FIDs, as specified in ([MS-OXCDATA] section 2.2.1.1), in the initial RopSetSearchCriteria ROP request, the server fails the ROP with ecNotInitialized (0x80040605)."); // Add the debug information. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R566"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R566. // The clients call RopSetSearchCriteria ROP on a not initialized search folder without setting folder IDs, and the error code 0x80040605 was captured, MS-OXCFOLD_R566 can be verified directly. Site.CaptureRequirement( 566, @"[In Processing a RopSetSearchCriteria ROP Request] When the error code is ecNotInitialized, it indicates that no FIDs were specified for this search folder."); #endregion #endregion #region Step 6. The client calls RopSetSearchCriteria with [MSOXCFOLDSearchFolder1] was included in its own search scope. setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, RestrictionDataSize = 0x0005, RestrictionData = restrictionData, SearchFlags = (uint)SetSearchFlags.RestartSearch, FolderIds = new ulong[] { searchFolderID }, FolderIdCount = 1, }; #region Verify the requirements: MS-OXCFOLD_R124201, MS-OXCFOLD_R124202, MS-OXCFOLD_R1243 and MS-OXCFOLD_R1244. if (Common.IsRequirementEnabled(124201, this.Site)) { setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R124201: the return value of the RopSetSearchCriteria is {0}", setSearchCriteriaResponse.ReturnValue); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R124201 Site.CaptureRequirementIfAreEqual<uint>( 0x00000490, setSearchCriteriaResponse.ReturnValue, 124201, @"[In Appendix A: Product Behavior] Implementation does fail the ROP with ecSearchFolderScopeViolation (0x00000490), if the client sets the search scope to include the search folder itself. (Exchange 2013 and above follows this behavior.)"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1243: the return value of the RopSetSearchCriteria is {0}", setSearchCriteriaResponse.ReturnValue); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1243 Site.CaptureRequirementIfAreEqual<uint>( 0x00000490, setSearchCriteriaResponse.ReturnValue, 1243, @"[In Processing a RopSetSearchCriteria ROP Request] The value of error code ecSearchFolderScopeViolation is 0x00000490."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1244: the return value of the RopSetSearchCriteria is {0}", setSearchCriteriaResponse.ReturnValue); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1244 // The client calls RopSetSearchCriteria with [MSOXCFOLDSearchFolder1] was included in its own search scope, so if the return value is ecSearchFolderScopeViolation, R1244 can be verified. Site.CaptureRequirementIfAreEqual<uint>( 0x00000490, setSearchCriteriaResponse.ReturnValue, 1244, @"[In Processing a RopSetSearchCriteria ROP Request] When the error code is ecSearchFolderScopeViolation, it indicates the search folder was included in its own search scope."); } if (Common.IsRequirementEnabled(124202, this.Site)) { setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R124202: the return value of the RopSetSearchCriteria is {0}", setSearchCriteriaResponse.ReturnValue); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R124202 Site.CaptureRequirementIfAreEqual<uint>( 0, setSearchCriteriaResponse.ReturnValue, 124202, @"[In Appendix A: Product Behavior] Implementation does not fail the RopSetSearchCriteria ROP when the search folder is included in its own search scope. <16> Section 3.2.5.4: Exchange 2007, and Exchange 2010 do not fail the RopSetSearchCriteria ROP when the search folder is included in its own search scope."); } #endregion #endregion }
public void MSOXCFOLD_S02_TC11_RopMoveCopyMessagesUseSearchFolderSuccess() { this.Adapter.DoConnect(ConnectionType.PrivateMailboxServer); this.GenericFolderInitialization(); #region Step 1. Call RopCreateFolder to create [MSOXCFOLDSubfolder1] under the root folder. ulong subfolderId1 = 0; uint subfolderHandle1 = 0; this.CreateFolder(this.RootFolderHandle, Constants.Subfolder1, ref subfolderId1, ref subfolderHandle1); #endregion #region Step 2. Create a message in the [MSOXCFOLDSubfolder1] folder created in step 1. uint messageHandle = 0; ulong messageId = 0; this.CreateSaveMessage(subfolderHandle1, subfolderId1, ref messageId, ref messageHandle); #endregion #region Step 3. Call RopCreateFolder to create [MSOXCFOLDSubfolder2] under the root folder. ulong subfolderId2 = 0; uint subfolderHandle2 = 0; this.CreateFolder(this.RootFolderHandle, Constants.Subfolder2, ref subfolderId2, ref subfolderHandle2); #endregion #region Step 4. Create a message in the [MSOXCFOLDSubfolder2] folder created in step 3. uint messageHandleInSubFolder2 = 0; ulong messageIdInSubFolder2 = 0; this.CreateSaveMessage(subfolderHandle2, subfolderId2, ref messageIdInSubFolder2, ref messageHandleInSubFolder2); #endregion #region Step 4. Call RopCreateFolder to create a search folder [MSOXCFOLDSearchFolder] under the root folder. RopCreateFolderRequest createFolderRequest = new RopCreateFolderRequest { RopId = (byte)RopId.RopCreateFolder, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, OutputHandleIndex = Constants.CommonOutputHandleIndex, FolderType = (byte)FolderType.Searchfolder, UseUnicodeStrings = 0x0, OpenExisting = 0x00, Reserved = 0x0, DisplayName = Encoding.ASCII.GetBytes(Constants.SearchFolder), Comment = Encoding.ASCII.GetBytes(Constants.SearchFolder) }; RopCreateFolderResponse createFolderResponse = this.Adapter.CreateFolder(createFolderRequest, this.RootFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, createFolderResponse.ReturnValue, "RopCreateFolder ROP operation performs successfully!"); uint searchFolderHandle = this.responseHandles[0][createFolderResponse.OutputHandleIndex]; #endregion #region Step 5. The client calls RopSetSearchCriteria to establish search criteria for [MSOXCFOLDSubFolder1]. RopSetSearchCriteriaRequest setSearchCriteriaRequest = new RopSetSearchCriteriaRequest { RopId = (byte)RopId.RopSetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex }; PropertyTag propertyTag = new PropertyTag { PropertyId = (ushort)MessagePropertyId.PidTagMessageClass, PropertyType = (ushort)PropertyType.PtypString }; ExistRestriction existRestriction = new ExistRestriction { PropTag = propertyTag }; setSearchCriteriaRequest.RestrictionDataSize = (ushort)existRestriction.Size(); setSearchCriteriaRequest.RestrictionData = existRestriction.Serialize(); setSearchCriteriaRequest.FolderIds = new ulong[] { subfolderId1 }; setSearchCriteriaRequest.FolderIdCount = (ushort)setSearchCriteriaRequest.FolderIds.Length; setSearchCriteriaRequest.SearchFlags = (uint)SetSearchFlags.ContentIndexedSearch | (uint)SetSearchFlags.StaticSearch | (uint)SetSearchFlags.RestartSearch; RopSetSearchCriteriaResponse setSearchCriteriaResponse = this.Adapter.SetSearchCriteria(setSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, setSearchCriteriaResponse.ReturnValue, "RopSearchCriteria ROP operation performs successfully!"); #endregion #region Step 6. The client calls RopGetSearchCriteria to obtain the search criteria and the status of the search folder [MSOXCFOLDSubFolder1]. RopGetSearchCriteriaRequest getSearchCriteriaRequest = new RopGetSearchCriteriaRequest { RopId = (byte)RopId.RopGetSearchCriteria, LogonId = Constants.CommonLogonId, InputHandleIndex = Constants.CommonInputHandleIndex, UseUnicode = 0x00, IncludeRestriction = 0x01, IncludeFolders = 0x01 }; RopGetSearchCriteriaResponse getSearchCriteriaResponse = this.Adapter.GetSearchCriteria(getSearchCriteriaRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getSearchCriteriaResponse.ReturnValue, "RopGetSearchCriteria ROP operation performs successfully!"); #endregion #region Step 7. The client calls RopGetContentsTable to get handle of the contents table in the search folder [MSOXCFOLDSearchFolder]. RopGetContentsTableRequest getContentsTableRequest = new RopGetContentsTableRequest(); RopGetContentsTableResponse getContentsTableResponse; getContentsTableRequest.RopId = (byte)RopId.RopGetContentsTable; getContentsTableRequest.LogonId = Constants.CommonLogonId; getContentsTableRequest.InputHandleIndex = Constants.CommonInputHandleIndex; getContentsTableRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; getContentsTableRequest.TableFlags = (byte)FolderTableFlags.None; int count = 0; uint tableHandle; do { getContentsTableResponse = this.Adapter.GetContentsTable(getContentsTableRequest, searchFolderHandle, ref this.responseHandles); Site.Assert.AreEqual<uint>(Constants.SuccessCode, getContentsTableResponse.ReturnValue, "RopGetContentsTable ROP operation performs successfully!"); tableHandle = this.responseHandles[0][getContentsTableResponse.OutputHandleIndex]; if (getContentsTableResponse.RowCount != 1) { Thread.Sleep(this.WaitTime); } else { break; } count++; } while (count < this.RetryCount); #endregion #region Step 8. Sets the properties PidTagMid visible on the content table. RopSetColumnsRequest setColumnsRequest; PropertyTag[] propertyTags = new PropertyTag[1]; propertyTags[0].PropertyId = (ushort)MessagePropertyId.PidTagMid; propertyTags[0].PropertyType = (ushort)PropertyType.PtypInteger64; setColumnsRequest.RopId = 0x12; setColumnsRequest.LogonId = 0x00; setColumnsRequest.InputHandleIndex = 0x00; setColumnsRequest.PropertyTagCount = (ushort)propertyTags.Length; setColumnsRequest.PropertyTags = propertyTags; setColumnsRequest.SetColumnsFlags = 0x00; // Sync object ropResponse = new object(); this.Adapter.DoRopCall(setColumnsRequest, tableHandle, ref ropResponse, ref this.responseHandles); #endregion #region Step 9. Gets the message ID in the search folder [MSOXCFOLDSearchFolder]. RopQueryRowsRequest queryRowsRequest; RopQueryRowsResponse queryRowsResponse; queryRowsRequest.RopId = 0x15; queryRowsRequest.LogonId = 0x00; queryRowsRequest.InputHandleIndex = 0x00; queryRowsRequest.QueryRowsFlags = 0x00; queryRowsRequest.ForwardRead = 0x01; queryRowsRequest.RowCount = 1; this.Adapter.DoRopCall(queryRowsRequest, tableHandle, ref ropResponse, ref this.responseHandles); queryRowsResponse = (RopQueryRowsResponse)ropResponse; ulong messageID = BitConverter.ToUInt64(queryRowsResponse.RowData.PropertyRows[0].PropertyValues[0].Value, 0); #endregion #region Step 10. Call RopMoveCopyMessages to copy the message in the [MSOXCFOLDSearchFolder] to root folder synchronously. ulong[] messageIds = new ulong[1]; messageIds[0] = messageID; List<uint> handlelist = new List<uint> { searchFolderHandle, this.RootFolderHandle }; RopMoveCopyMessagesRequest moveCopyMessagesRequest = new RopMoveCopyMessagesRequest { RopId = (byte)RopId.RopMoveCopyMessages, LogonId = Constants.CommonLogonId, SourceHandleIndex = 0x00, DestHandleIndex = 0x01, MessageIdCount = (ushort)messageIds.Length, MessageIds = messageIds, WantAsynchronous = 0x00, WantCopy = 0xFF }; // WantCopy is nonzero (TRUE) indicates this is a copy operation. RopMoveCopyMessagesResponse copyMessagesFromSearchFolderResponse = this.Adapter.MoveCopyMessages(moveCopyMessagesRequest, handlelist, ref this.responseHandles); Site.Assert.AreEqual<uint>(0, copyMessagesFromSearchFolderResponse.ReturnValue, "The RopMoveCopyMessages ROP operation performs successfully."); Site.Assert.AreEqual<uint>(0, copyMessagesFromSearchFolderResponse.PartialCompletion, "The ROP successes for all subsets of targets"); handlelist.Clear(); #endregion #region Step 11. Validate the message is copied successfully in above step 9. uint rootFolderContentsCountActual = this.GetContentsTable(FolderTableFlags.None, this.RootFolderHandle); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R121702. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R121702: expected contents count of the root folder is {0}, actual contents count of the root folder is {1};", 1, rootFolderContentsCountActual); // The source folder is a search folder, so if the message was copied successfully from MSOXCFOLDSearchFolder to root folder, R121702 can be verified. Site.CaptureRequirementIfAreEqual<uint>( 1, rootFolderContentsCountActual, 121702, @"[In RopMoveCopyMessages ROP Request Buffer] SourceHandleIndex (1 byte): [The source Server object for this operation [RopMoveCopyMessages ROP] is a Folder object that represents the folder from which the messages will be copied] This folder can be a search folder."); #endregion #region Step 12. Call RopMoveCopyMessages to move the message in the [MSOXCFOLDSearchFolder] to root folder synchronously. messageIds = new ulong[1]; messageIds[0] = messageID; handlelist = new List<uint> { searchFolderHandle, this.RootFolderHandle }; moveCopyMessagesRequest = new RopMoveCopyMessagesRequest { RopId = (byte)RopId.RopMoveCopyMessages, LogonId = Constants.CommonLogonId, SourceHandleIndex = 0x00, DestHandleIndex = 0x01, MessageIdCount = (ushort)messageIds.Length, MessageIds = messageIds, WantAsynchronous = 0x00, WantCopy = 0x00 }; // WantCopy is zero (FALSE) indicates this is a move operation. RopMoveCopyMessagesResponse moveMessagesFromSearchFolderResponse = this.Adapter.MoveCopyMessages(moveCopyMessagesRequest, handlelist, ref this.responseHandles); Site.Assert.AreEqual<uint>(0, moveMessagesFromSearchFolderResponse.ReturnValue, "The RopMoveCopyMessages ROP operation performs successfully."); Site.Assert.AreEqual<uint>(0, moveMessagesFromSearchFolderResponse.PartialCompletion, "The ROP successes for all subsets of targets"); handlelist.Clear(); #endregion #region Step 13. Validate the message is moved successfully in above step 12. rootFolderContentsCountActual = this.GetContentsTable(FolderTableFlags.None, this.RootFolderHandle); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R121701. Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R121701: expected contents count of the root folder is {0}, actual contents count of the root folder is {1};", 2, rootFolderContentsCountActual); // The source folder is a search folder, so if the message was moved successfully from MSOXCFOLDSearchFolder to root folder, R121701 can be verified. Site.CaptureRequirementIfAreEqual<uint>( 2, rootFolderContentsCountActual, 121701, @"[In RopMoveCopyMessages ROP Request Buffer] SourceHandleIndex (1 byte): [The source Server object for this operation [RopMoveCopyMessages ROP] is a Folder object that represents the folder from which the messages will be moved] This folder can be a search folder."); #endregion #region Step 14. Call RopMoveCopyMessages to copy the message in the [MSOXCFOLDSubfolder2] to the [MSOXCFOLDSearchFolder] synchronously. RopMoveCopyMessagesResponse copyMessagesToSearchFolderResponse = new RopMoveCopyMessagesResponse(); if (Common.IsRequirementEnabled(1246, this.Site)) { messageIds[0] = messageIdInSubFolder2; handlelist = new List<uint> { subfolderHandle2, searchFolderHandle }; moveCopyMessagesRequest = new RopMoveCopyMessagesRequest { RopId = (byte)RopId.RopMoveCopyMessages, LogonId = Constants.CommonLogonId, SourceHandleIndex = 0x00, DestHandleIndex = 0x01, MessageIdCount = (ushort)messageIds.Length, MessageIds = messageIds, WantAsynchronous = 0x00, WantCopy = 0xFF }; // WantCopy is nonzero (TRUE) indicates this is a copy operation. copyMessagesToSearchFolderResponse = this.Adapter.MoveCopyMessages(moveCopyMessagesRequest, handlelist, ref this.responseHandles); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R121802: the PartialCompletion in the MoveCopyMessages response is {0}", copyMessagesToSearchFolderResponse.PartialCompletion); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R121802 // If the ROP RopMoveCopyMessages fails to copy message, the value of PartialCompletion field is nonzero. this.Site.CaptureRequirementIfAreNotEqual<uint>( 0x00000000, copyMessagesToSearchFolderResponse.ReturnValue, 121802, @"[In RopMoveCopyMessages ROP Request Buffer] DestHandleIndex (1 byte): [The destination Server object for this operation [RopMoveCopyMessages ROP] is a Folder object that represents the folder to which the messages will be copied.] This folder cannot be a search folder."); } #endregion #region Step 15. Call RopMoveCopyMessages to move the message in the [MSOXCFOLDSubfolder2] to the [MSOXCFOLDSearchFolder] synchronously. RopMoveCopyMessagesResponse moveMessagesToSearchFolderResponse; if (Common.IsRequirementEnabled(1246, this.Site)) { messageIds[0] = messageIdInSubFolder2; handlelist = new List<uint> { subfolderHandle2, searchFolderHandle }; moveCopyMessagesRequest = new RopMoveCopyMessagesRequest { RopId = (byte)RopId.RopMoveCopyMessages, LogonId = Constants.CommonLogonId, SourceHandleIndex = 0x00, DestHandleIndex = 0x01, MessageIdCount = (ushort)messageIds.Length, MessageIds = messageIds, WantAsynchronous = 0x00, WantCopy = 0x00 }; // WantCopy is zero (FLASE) indicates this is a move operation. moveMessagesToSearchFolderResponse = this.Adapter.MoveCopyMessages(moveCopyMessagesRequest, handlelist, ref this.responseHandles); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R121801: the PartialCompletion in the MoveCopyMessages response is {0}", moveMessagesToSearchFolderResponse.PartialCompletion); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R121801 // If the ROP RopMoveCopyMessages fails to move message, the value of PartialCompletion field is nonzero. this.Site.CaptureRequirementIfAreNotEqual<uint>( 0x00000000, moveMessagesToSearchFolderResponse.ReturnValue, 121801, @"[In RopMoveCopyMessages ROP Request Buffer] DestHandleIndex (1 byte): [The destination Server object for this operation [RopMoveCopyMessages ROP] is a Folder object that represents the folder to which the messages will be moved.] This folder cannot be a search folder."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1216"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1216 bool isVerifiedR1216 = copyMessagesFromSearchFolderResponse.ReturnValue == 0x00000000 && moveMessagesFromSearchFolderResponse.ReturnValue == 0x00000000 && copyMessagesToSearchFolderResponse.ReturnValue != 0x00000000 && moveMessagesToSearchFolderResponse.ReturnValue != 0x00000000; this.Site.CaptureRequirementIfIsTrue( isVerifiedR1216, 1216, @"[In RopMoveCopyMessages ROP] The source folder can be a search folder, but the destination folder cannot."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1246: the return value is {0} when copy a message to a search folder and the return value is {1} when move a message to a search folder.", copyMessagesToSearchFolderResponse.ReturnValue, moveMessagesToSearchFolderResponse.ReturnValue); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1246 bool isVerifiedR1246 = copyMessagesToSearchFolderResponse.ReturnValue == 0x00000460 && moveMessagesToSearchFolderResponse.ReturnValue == 0x00000460; this.Site.CaptureRequirementIfIsTrue( isVerifiedR1246, 1246, @"[In Processing a RopMoveCopyMessages ROP Request] When the error code is ecSearchFolder, it indicates the destination object is a search folder. "); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCFOLD_R1245"); // Verify MS-OXCFOLD requirement: MS-OXCFOLD_R1245 this.Site.CaptureRequirementIfAreEqual<uint>( 0x00000460, copyMessagesToSearchFolderResponse.ReturnValue, 1245, @"[In Processing a RopMoveCopyMessages ROP Request] The value of error code ecSearchFolder is 0x00000460."); } #endregion }
/// <summary> /// Establishes search criteria for a search folder. /// </summary> /// <param name="ropSetSearchCriteriaRequest">RopSetSearchCriteriaRequest object.</param> /// <param name="insideObjHandle">Server object handle in RopSetSearchCriteriaRequest.</param> /// <param name="responseSOHTable">Server objects handles in RopSetSearchCriteriaResponse.</param> /// <returns>RopSetSearchCriteriaResponse object.</returns> public RopSetSearchCriteriaResponse SetSearchCriteria(RopSetSearchCriteriaRequest ropSetSearchCriteriaRequest, uint insideObjHandle, ref List<List<uint>> responseSOHTable) { object temp = new object(); int count = 0; bool setSearchCriteriaComplete = false; int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site)); int retryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site)); RopSetSearchCriteriaResponse ropSetSearchCriteriaResponse; do { this.ExcuteRopCall((ISerializable)ropSetSearchCriteriaRequest, insideObjHandle, ref temp, ref responseSOHTable, ref this.rawData); ropSetSearchCriteriaResponse = (RopSetSearchCriteriaResponse)temp; // Error code 0x499 indicates the server is not ready to initialize a search now, the client should wait for a while and try again later. if (0x499 == ropSetSearchCriteriaResponse.ReturnValue) { Thread.Sleep(waitTime); } else { setSearchCriteriaComplete = true; } if (count > retryCount) { Site.Assert.Fail("The server failed to initialize a search!"); } count++; } while (!setSearchCriteriaComplete); #region Capture Code // The ReturnValue equal to 0x00000000 indicate ROP operation success if (0x00000000 == ropSetSearchCriteriaResponse.ReturnValue) { this.VerifyRopSetSearchCriteria(ropSetSearchCriteriaResponse); } #endregion Capture Code return ropSetSearchCriteriaResponse; }