public void MSOXCROPS_S11_TC05_TestRopSynchronizationImportDeletes() { this.CheckTransportIsSupported(); this.cropsAdapter.RpcConnect( Common.GetConfigurationPropertyValue("SutComputerName", this.Site), ConnectionType.PrivateMailboxServer, Common.GetConfigurationPropertyValue("UserEssdn", this.Site), Common.GetConfigurationPropertyValue("Domain", this.Site), Common.GetConfigurationPropertyValue("AdminUserName", this.Site), Common.GetConfigurationPropertyValue("PassWord", this.Site)); // Step 1: Open folder. #region Open folder // Log on to the private mailbox. RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle); RopOpenFolderRequest openFolderRequest; RopOpenFolderResponse openFolderResponse; // Construct the RopOpenFolder request. openFolderRequest.RopId = (byte)RopId.RopOpenFolder; openFolderRequest.LogonId = TestSuiteBase.LogonId; openFolderRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; openFolderRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; openFolderRequest.FolderId = logonResponse.FolderIds[4]; openFolderRequest.OpenModeFlags = (byte)FolderOpenModeFlags.None; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopOpenFolder request."); // Send the RopOpenFolder request and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( openFolderRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); openFolderResponse = (RopOpenFolderResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, openFolderResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)"); // Get the handle of opened folder, which will be used as input handle in RopCreateFolder. uint openedFolderHandle = responseSOHs[0][openFolderResponse.OutputHandleIndex]; #endregion // Step 2: Configure a synchronization upload context. #region Configure a synchronization upload context RopSynchronizationOpenCollectorRequest synchronizationOpenCollectorRequest; RopSynchronizationOpenCollectorResponse synchronizationOpenCollectorResponse; // Construct the RopSynchronizationOpenCollector request. synchronizationOpenCollectorRequest.RopId = (byte)RopId.RopSynchronizationOpenCollector; synchronizationOpenCollectorRequest.LogonId = TestSuiteBase.LogonId; synchronizationOpenCollectorRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; synchronizationOpenCollectorRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; synchronizationOpenCollectorRequest.IsContentsCollector = Convert.ToByte(TestSuiteBase.Zero); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 2: Begin to send the RopSynchronizationOpenCollector request."); // Send the RopSynchronizationOpenCollector request and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( synchronizationOpenCollectorRequest, openedFolderHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); synchronizationOpenCollectorResponse = (RopSynchronizationOpenCollectorResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, synchronizationOpenCollectorResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)"); uint synchronizationUploadContextHandle = responseSOHs[0][synchronizationOpenCollectorResponse.OutputHandleIndex]; #endregion // Step 3: Create message. #region Create message RopCreateMessageRequest createMessageRequest = new RopCreateMessageRequest(); RopCreateMessageResponse createMessageResponse; // Construct the RopCreateMessage request. createMessageRequest.RopId = (byte)RopId.RopCreateMessage; createMessageRequest.LogonId = TestSuiteBase.LogonId; createMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; createMessageRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; // Set CodePageId to 0x0FFF, which specified the code page of Logon object will be used. createMessageRequest.CodePageId = TestSuiteBase.CodePageId; createMessageRequest.FolderId = logonResponse.FolderIds[4]; createMessageRequest.AssociatedFlag = Convert.ToByte(TestSuiteBase.Zero); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 3: Begin to send the RopCreateMessage request."); // Send the RopCreateMessage request and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( createMessageRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); createMessageResponse = (RopCreateMessageResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, createMessageResponse.ReturnValue, "if ROP succeeds, the ReturnValue of its response is 0(success)"); uint targetMessageHandle = responseSOHs[0][createMessageResponse.OutputHandleIndex]; #endregion // Step 4: Save message. #region Save message RopSaveChangesMessageRequest saveChangesMessageRequest; RopSaveChangesMessageResponse saveChangesMessageResponse; // Construct the RopSaveChangesMessage request. saveChangesMessageRequest.RopId = (byte)RopId.RopSaveChangesMessage; saveChangesMessageRequest.LogonId = TestSuiteBase.LogonId; saveChangesMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; saveChangesMessageRequest.ResponseHandleIndex = TestSuiteBase.ResponseHandleIndex1; saveChangesMessageRequest.SaveFlags = (byte)SaveFlags.ForceSave; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopSaveChangesMessage request."); // Send the RopSaveChangesMessage request and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( saveChangesMessageRequest, targetMessageHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); saveChangesMessageResponse = (RopSaveChangesMessageResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, saveChangesMessageResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)."); #endregion // Send the RopSynchronizationImportDeletes request and verify the response. #region RopSynchronizationImportDeletes response RopSynchronizationImportDeletesRequest ropSynchronizationImportDeletesRequest = new RopSynchronizationImportDeletesRequest(); TaggedPropertyValue[] propertyValues = new TaggedPropertyValue[1]; TaggedPropertyValue propertyValue = new TaggedPropertyValue(); // Send the RopLongTermIdFromId request to convert a short-term ID into a long-term ID. #region RopLongTermIdFromId response RopLongTermIdFromIdRequest ropLongTermIdFromIdRequest = new RopLongTermIdFromIdRequest(); RopLongTermIdFromIdResponse ropLongTermIdFromIdResponse; // Construct the RopLongTermIdFromId request. ropLongTermIdFromIdRequest.RopId = (byte)RopId.RopLongTermIdFromId; ropLongTermIdFromIdRequest.LogonId = TestSuiteBase.LogonId; ropLongTermIdFromIdRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; ropLongTermIdFromIdRequest.ObjectId = saveChangesMessageResponse.MessageId; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopGetPropertyIdsFromNames request."); // Send the RopGetPropertyIdsFromNames request. this.responseSOHs = cropsAdapter.ProcessSingleRop( ropLongTermIdFromIdRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); ropLongTermIdFromIdResponse = (RopLongTermIdFromIdResponse)response; #endregion byte[] sampleValue = new byte[24]; propertyValue.PropertyTag.PropertyId = this.propertyDictionary[PropertyNames.PidTagTemplateData].PropertyId; propertyValue.PropertyTag.PropertyType = this.propertyDictionary[PropertyNames.PidTagTemplateData].PropertyType; // The combination of first two bytes (0x0016) indicates the length of value field. sampleValue[0] = 0x16; sampleValue[1] = 0x00; Array.Copy(ropLongTermIdFromIdResponse.LongTermId.DatabaseGuid, 0, sampleValue, 2, 16); Array.Copy(ropLongTermIdFromIdResponse.LongTermId.GlobalCounter, 0, sampleValue, 18, 6); propertyValue.Value = sampleValue; propertyValues[0] = propertyValue; // Construct the RopSynchronizationImportDeletes request. ropSynchronizationImportDeletesRequest.RopId = (byte)RopId.RopSynchronizationImportDeletes; ropSynchronizationImportDeletesRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; ropSynchronizationImportDeletesRequest.LogonId = TestSuiteBase.LogonId; ropSynchronizationImportDeletesRequest.IsHierarchy = Convert.ToByte(TestSuiteBase.Zero); ropSynchronizationImportDeletesRequest.PropertyValueCount = (ushort)propertyValues.Length; ropSynchronizationImportDeletesRequest.PropertyValues = propertyValues; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopSynchronizationImportDeletes request to invoke success response."); // Send the RopSynchronizationImportDeletes request to get the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( ropSynchronizationImportDeletesRequest, synchronizationUploadContextHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); // Send the RopSynchronizationImportDeletes request to get the failure response. ropSynchronizationImportDeletesRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopSynchronizationImportDeletes request to invoke failure response."); this.responseSOHs = cropsAdapter.ProcessSingleRop( ropSynchronizationImportDeletesRequest, synchronizationUploadContextHandle, ref this.response, ref this.rawData, RopResponseType.FailureResponse); #endregion }
public void MSOXCROPS_S11_TC06_TestRopSynchronizationImportMessageMove() { this.CheckTransportIsSupported(); this.cropsAdapter.RpcConnect( Common.GetConfigurationPropertyValue("SutComputerName", this.Site), ConnectionType.PrivateMailboxServer, Common.GetConfigurationPropertyValue("UserEssdn", this.Site), Common.GetConfigurationPropertyValue("Domain", this.Site), Common.GetConfigurationPropertyValue("AdminUserName", this.Site), Common.GetConfigurationPropertyValue("PassWord", this.Site)); // Step 1: Open folder. #region Open folder RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle); RopOpenFolderRequest openFolderRequest; RopOpenFolderResponse openFolderResponse; // Construct RopOpenFolder request. openFolderRequest.RopId = (byte)RopId.RopOpenFolder; openFolderRequest.LogonId = TestSuiteBase.LogonId; openFolderRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; openFolderRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; openFolderRequest.FolderId = logonResponse.FolderIds[4]; openFolderRequest.OpenModeFlags = (byte)FolderOpenModeFlags.None; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopOpenFolder request."); // Send the RopOpenFolder request to the server and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( openFolderRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); openFolderResponse = (RopOpenFolderResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, openFolderResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)"); // Get the handle of opened folder, which will be used as input handle in RopCreateFolder. uint openedFolderHandle = responseSOHs[0][openFolderResponse.OutputHandleIndex]; #endregion // Step 2: Create the first subfolder in opened folder. #region Create the first subfolder RopCreateFolderRequest createFolderRequest; RopCreateFolderResponse createFolderResponse; // Construct RopCreateFolder request. createFolderRequest.RopId = (byte)RopId.RopCreateFolder; createFolderRequest.LogonId = TestSuiteBase.LogonId; createFolderRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; createFolderRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; createFolderRequest.FolderType = (byte)FolderType.Genericfolder; createFolderRequest.UseUnicodeStrings = Convert.ToByte(TestSuiteBase.Zero); createFolderRequest.OpenExisting = TestSuiteBase.NonZero; createFolderRequest.Reserved = TestSuiteBase.Reserved; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0"); createFolderRequest.Comment = Encoding.ASCII.GetBytes(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 2: Begin to send the RopCreateFolder request."); // Send the RopCreateFolder request to the server and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( createFolderRequest, openedFolderHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); createFolderResponse = (RopCreateFolderResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, createFolderResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)"); uint targetFolderHandle = responseSOHs[0][createFolderResponse.OutputHandleIndex]; #endregion // Step 3: Create the second subfolder in opened folder #region Create the second subfolder RopCreateFolderResponse createSecondFolderResponse; createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0"); createFolderRequest.Comment = Encoding.ASCII.GetBytes(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0"); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 3: Begin to send the RopCreateFolder request."); // Send the RopCreateFolder request to create the second subfolder. this.responseSOHs = cropsAdapter.ProcessSingleRop( createFolderRequest, openedFolderHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); createSecondFolderResponse = (RopCreateFolderResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, createFolderResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)"); uint secondFolderHandle = responseSOHs[0][createSecondFolderResponse.OutputHandleIndex]; #endregion // Step 4: Configure a synchronization upload context #region Configure a synchronization upload context RopSynchronizationOpenCollectorRequest synchronizationOpenCollectorMsgRequest; RopSynchronizationOpenCollectorResponse synchronizationOpenCollectorMsgResponse; // Construct RopSynchronizationOpenCollector request. synchronizationOpenCollectorMsgRequest.RopId = (byte)RopId.RopSynchronizationOpenCollector; synchronizationOpenCollectorMsgRequest.LogonId = TestSuiteBase.LogonId; synchronizationOpenCollectorMsgRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; synchronizationOpenCollectorMsgRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; synchronizationOpenCollectorMsgRequest.IsContentsCollector = TestSuiteBase.NonZero; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopSynchronizationOpenCollector request."); // Send the RopSynchronizationOpenCollector request to the server and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( synchronizationOpenCollectorMsgRequest, targetFolderHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); synchronizationOpenCollectorMsgResponse = (RopSynchronizationOpenCollectorResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, synchronizationOpenCollectorMsgResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)"); uint synchronizationUploadContextHandleMsg = responseSOHs[0][synchronizationOpenCollectorMsgResponse.OutputHandleIndex]; #endregion // Step 5: Send the RopSynchronizationImportMessageChange request to import new messages // or full changes to existing messages into the server replica. #region RopSynchronizationImportMessageChange RopSynchronizationImportMessageChangeRequest synchronizationImportMessageChangeRequest; RopSynchronizationImportMessageChangeResponse synchronizationImportMessageChangeResponse; // Call CreateSamplePropertyValues method to create property value samples. TaggedPropertyValue[] propertyValues = this.CreateSamplePropertyValues(); // Construct the RopSynchronizationImportMessageChange request. synchronizationImportMessageChangeRequest.RopId = (byte)RopId.RopSynchronizationImportMessageChange; synchronizationImportMessageChangeRequest.LogonId = TestSuiteBase.LogonId; synchronizationImportMessageChangeRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; synchronizationImportMessageChangeRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; synchronizationImportMessageChangeRequest.ImportFlag = (byte)ImportFlag.Normal; synchronizationImportMessageChangeRequest.PropertyValueCount = (ushort)propertyValues.Length; synchronizationImportMessageChangeRequest.PropertyValues = propertyValues; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 5: Begin to send the RopSynchronizationImportMessageChange request."); // Send the RopSynchronizationImportMessageChange request and get its output handle. this.responseSOHs = cropsAdapter.ProcessSingleRop( synchronizationImportMessageChangeRequest, synchronizationUploadContextHandleMsg, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); synchronizationImportMessageChangeResponse = (RopSynchronizationImportMessageChangeResponse)response; uint targetMessageHandle = responseSOHs[0][synchronizationImportMessageChangeResponse.OutputHandleIndex]; #endregion // Step 6: Save message. #region Save message RopSaveChangesMessageRequest saveChangesMessageRequest; RopSaveChangesMessageResponse saveChangesMessageResponse; // Construct the RopSaveChangesMessage request. saveChangesMessageRequest.RopId = (byte)RopId.RopSaveChangesMessage; saveChangesMessageRequest.LogonId = TestSuiteBase.LogonId; saveChangesMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; saveChangesMessageRequest.ResponseHandleIndex = TestSuiteBase.ResponseHandleIndex1; saveChangesMessageRequest.SaveFlags = (byte)SaveFlags.ForceSave; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 6: Begin to send the RopSaveChangesMessage request."); // Send the RopSaveChangesMessage request to the server and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( saveChangesMessageRequest, targetMessageHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); saveChangesMessageResponse = (RopSaveChangesMessageResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, saveChangesMessageResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)."); #endregion // Step 7: Send the RopSynchronizationImportMessageMove request and verify the response. #region RopSynchronizationImportMessageMove response. RopSynchronizationImportMessageMoveRequest importMessageMoveRequest = new RopSynchronizationImportMessageMoveRequest(); RopSynchronizationImportMessageMoveResponse importMessageMoveResponse; // Construct the RopSynchronizationImportMessageMove request. #region Construct the RopSynchronizationImportMessageMove request importMessageMoveRequest.RopId = (byte)RopId.RopSynchronizationImportMessageMove; importMessageMoveRequest.LogonId = TestSuiteBase.LogonId; importMessageMoveRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; importMessageMoveRequest.SourceFolderIdSize = 22; byte[] value = new byte[22]; // Send the RopLongTermIdFromId request to convert the short-term ID into a long-term ID. #region convert the short-term ID into the long-term ID RopLongTermIdFromIdRequest ropLongTermIdFromIdRequest = new RopLongTermIdFromIdRequest(); RopLongTermIdFromIdResponse ropLongTermIdFromIdResponse; // Construct the RopLongTermIdFromId request. ropLongTermIdFromIdRequest.RopId = (byte)RopId.RopLongTermIdFromId; ropLongTermIdFromIdRequest.LogonId = TestSuiteBase.LogonId; ropLongTermIdFromIdRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; ropLongTermIdFromIdRequest.ObjectId = createFolderResponse.FolderId; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 7: Begin to send the RopSaveChangesMessage request."); // Send the RopLongTermIdFromId request to convert the short-term ID into a long-term ID. this.responseSOHs = cropsAdapter.ProcessSingleRop( ropLongTermIdFromIdRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); ropLongTermIdFromIdResponse = (RopLongTermIdFromIdResponse)response; Array.Copy(ropLongTermIdFromIdResponse.LongTermId.DatabaseGuid, 0, value, 0, 16); Array.Copy(ropLongTermIdFromIdResponse.LongTermId.GlobalCounter, 0, value, 16, 6); #endregion importMessageMoveRequest.SourceFolderId = value; importMessageMoveRequest.SourceMessageIdSize = 22; byte[] value1 = new byte[22]; Array.Copy(propertyValues[0].Value, 2, value1, 0, 22); importMessageMoveRequest.SourceMessageId = value1; byte[] value3 = new byte[22]; // Send the RopGetLocalReplicaIds to reserve a range of IDs to be used by a local replica. #region Reserve a range of IDs RopGetLocalReplicaIdsRequest ropGetLocalReplicaIdsRequest; RopGetLocalReplicaIdsResponse ropGetLocalReplicaIdsResponse; // Construct the RopGetLocalReplicaIds request. ropGetLocalReplicaIdsRequest.IdCount = 2; ropGetLocalReplicaIdsRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; ropGetLocalReplicaIdsRequest.LogonId = TestSuiteBase.LogonId; ropGetLocalReplicaIdsRequest.RopId = (byte)RopId.RopGetLocalReplicaIds; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 7: Begin to send the RopGetLocalReplicaIds request."); // Send the RopGetLocalReplicaIds to reserve a range of IDs to be used by a local replica. this.responseSOHs = cropsAdapter.ProcessSingleRop( ropGetLocalReplicaIdsRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); ropGetLocalReplicaIdsResponse = (RopGetLocalReplicaIdsResponse)response; Array.Copy(ropGetLocalReplicaIdsResponse.ReplGuid, 0, value3, 0, 16); Array.Copy(ropGetLocalReplicaIdsResponse.GlobalCount, 0, value3, 16, 6); #endregion importMessageMoveRequest.DestinationMessageIdSize = 22; importMessageMoveRequest.DestinationMessageId = value3; // PidTagChangeKey byte[] bytesForChangeNumber = new byte[20]; byte[] guid = Guid.NewGuid().ToByteArray(); Array.Copy(guid, 0, bytesForChangeNumber, 0, 16); importMessageMoveRequest.ChangeNumberSize = 20; importMessageMoveRequest.ChangeNumber = bytesForChangeNumber; importMessageMoveRequest.PredecessorChangeListSize = 23; byte[] bytesForPredecessorChangeList = { 0x16, 0x19, 0xD7, 0xFB, 0x0F, 0x06, 0x16, 0xA1, 0x41, 0xBF, 0xF6, 0x91, 0xC7, 0x63, 0xDA, 0xA8, 0x66, 0x00, 0x00, 0x00, 0x78, 0x4D, 0x1C }; importMessageMoveRequest.PredecessorChangeList = bytesForPredecessorChangeList; // Configure a synchronization upload context #region Configure a synchronization upload context RopSynchronizationOpenCollectorRequest synchronizationOpenCollectorRequest; RopSynchronizationOpenCollectorResponse synchronizationOpenCollectorResponse; // Construct the RopSynchronizationOpenCollector request. synchronizationOpenCollectorRequest.RopId = (byte)RopId.RopSynchronizationOpenCollector; synchronizationOpenCollectorRequest.LogonId = TestSuiteBase.LogonId; synchronizationOpenCollectorRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; synchronizationOpenCollectorRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; synchronizationOpenCollectorRequest.IsContentsCollector = TestSuiteBase.NonZero; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 7: Begin to send the RopSynchronizationOpenCollector request."); // Send the RopSynchronizationOpenCollector request to the server and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( synchronizationOpenCollectorRequest, secondFolderHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); synchronizationOpenCollectorResponse = (RopSynchronizationOpenCollectorResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, synchronizationOpenCollectorResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)"); uint synchronizationUploadContextHandle = responseSOHs[0][synchronizationOpenCollectorResponse.OutputHandleIndex]; #endregion #endregion // RopSynchronizationImportMessageMove success response. #region RopSynchronizationImportMessageMove success response // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 7: Begin to send the RopSynchronizationImportMessageMove request to invoke success response."); this.responseSOHs = cropsAdapter.ProcessSingleRop( importMessageMoveRequest, synchronizationUploadContextHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); importMessageMoveResponse = (RopSynchronizationImportMessageMoveResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, importMessageMoveResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)"); #endregion // RopSynchronizationImportMessageMove failure response. #region RopSynchronizationImportMessageMove failure response importMessageMoveRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 7: Begin to send the RopSynchronizationImportMessageMove request to invoke failure response."); this.responseSOHs = cropsAdapter.ProcessSingleRop( importMessageMoveRequest, synchronizationUploadContextHandle, ref this.response, ref this.rawData, RopResponseType.FailureResponse); #endregion #endregion }
/// <summary> /// Create hierarchy value samples. /// </summary> /// <param name="parentFolderId">Parent folder id.</param> /// <returns>The property values of hierarchy</returns> private TaggedPropertyValue[] CreateSampleHierarchyValues(ulong parentFolderId) { TaggedPropertyValue[] hierarchyValues = new TaggedPropertyValue[6]; TaggedPropertyValue propertyValue = new TaggedPropertyValue(); // PidTagParentSourceKey propertyValue = new TaggedPropertyValue { PropertyTag = { PropertyId = this.propertyDictionary[PropertyNames.PidTagParentSourceKey].PropertyId, PropertyType = this.propertyDictionary[PropertyNames.PidTagParentSourceKey].PropertyType } }; // Send RopLongTermIdFromId request to convert a short-term ID into a long-term ID. #region RopLongTermIdFromId response RopLongTermIdFromIdRequest ropLongTermIdFromIdRequest = new RopLongTermIdFromIdRequest(); RopLongTermIdFromIdResponse ropLongTermIdFromIdResponse; ropLongTermIdFromIdRequest.RopId = (byte)RopId.RopLongTermIdFromId; ropLongTermIdFromIdRequest.LogonId = TestSuiteBase.LogonId; ropLongTermIdFromIdRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; ropLongTermIdFromIdRequest.ObjectId = parentFolderId; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Begin to send the RopGetLocalReplicaIds request in CreateSampleHierarchyValues method."); // Send RopLongTermIdFromId request. this.responseSOHs = cropsAdapter.ProcessSingleRop( ropLongTermIdFromIdRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); ropLongTermIdFromIdResponse = (RopLongTermIdFromIdResponse)response; byte[] sampleForPidTagParentSourceKey = new byte[24]; // The combination of first two bytes (0x0016) indicates the length of value field. sampleForPidTagParentSourceKey[0] = 0x16; sampleForPidTagParentSourceKey[1] = 0x00; Array.Copy(ropLongTermIdFromIdResponse.LongTermId.DatabaseGuid, 0, sampleForPidTagParentSourceKey, 2, 16); Array.Copy(ropLongTermIdFromIdResponse.LongTermId.GlobalCounter, 0, sampleForPidTagParentSourceKey, 18, 6); #endregion propertyValue.Value = sampleForPidTagParentSourceKey; hierarchyValues[0] = propertyValue; // PidTagSourceKey propertyValue = new TaggedPropertyValue { PropertyTag = { PropertyId = this.propertyDictionary[PropertyNames.PidTagSourceKey].PropertyId, PropertyType = this.propertyDictionary[PropertyNames.PidTagSourceKey].PropertyType } }; byte[] sampleForPidTagSourceKey = new byte[24]; // The combination of first two bytes (0x0016) indicates the length of value field. sampleForPidTagSourceKey[0] = 0x16; sampleForPidTagSourceKey[1] = 0x00; // Send the RopGetLocalReplicaIds request to reserve a range of IDs to be used by a local replica. #region RopGetLocalReplicaIds response RopGetLocalReplicaIdsRequest ropGetLocalReplicaIdsRequest; RopGetLocalReplicaIdsResponse ropGetLocalReplicaIdsResponse; ropGetLocalReplicaIdsRequest.IdCount = 1; ropGetLocalReplicaIdsRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; ropGetLocalReplicaIdsRequest.LogonId = TestSuiteBase.LogonId; ropGetLocalReplicaIdsRequest.RopId = (byte)RopId.RopGetLocalReplicaIds; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Begin to send the RopGetLocalReplicaIds request in CreateSampleHierarchyValues method."); // Send RopGetLocalReplicaIds request. this.responseSOHs = cropsAdapter.ProcessSingleRop( ropGetLocalReplicaIdsRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); ropGetLocalReplicaIdsResponse = (RopGetLocalReplicaIdsResponse)response; Array.Copy(ropGetLocalReplicaIdsResponse.ReplGuid, 0, sampleForPidTagSourceKey, 2, 16); Array.Copy(ropGetLocalReplicaIdsResponse.GlobalCount, 0, sampleForPidTagSourceKey, 18, 6); #endregion propertyValue.Value = sampleForPidTagSourceKey; hierarchyValues[1] = propertyValue; // PidTagLastModificationTime propertyValue = new TaggedPropertyValue { PropertyTag = { PropertyId = this.propertyDictionary[PropertyNames.PidTagLastModificationTime].PropertyId, PropertyType = this.propertyDictionary[PropertyNames.PidTagLastModificationTime].PropertyType } }; byte[] sampleForPidTagLastModificationTime = { 154, 148, 234, 120, 114, 202, 202, 1 }; propertyValue.Value = sampleForPidTagLastModificationTime; hierarchyValues[2] = propertyValue; // PidTagChangeKey propertyValue = new TaggedPropertyValue { PropertyTag = { PropertyId = this.propertyDictionary[PropertyNames.PidTagChangeKey].PropertyId, PropertyType = this.propertyDictionary[PropertyNames.PidTagChangeKey].PropertyType } }; byte[] sampleForPidTagChangeKey = new byte[22]; byte[] guid = Guid.NewGuid().ToByteArray(); // The combination of first two bytes (0x0014) indicates the length of value field. sampleForPidTagChangeKey[0] = 0x14; sampleForPidTagChangeKey[1] = 0x00; Array.Copy(guid, 0, sampleForPidTagChangeKey, 2, 16); propertyValue.Value = sampleForPidTagChangeKey; hierarchyValues[3] = propertyValue; // PidTagPredecessorChangeList propertyValue = new TaggedPropertyValue { PropertyTag = { PropertyId = this.propertyDictionary[PropertyNames.PidTagPredecessorChangeList].PropertyId, PropertyType = this.propertyDictionary[PropertyNames.PidTagPredecessorChangeList].PropertyType } }; byte[] sampleForPidTagPredecessorChangeList = { 0x17, 0x00, 0x16, 0x19, 0xD7, 0xFB, 0x0F, 0x06, 0x16, 0xA1, 0x41, 0xBF, 0xF6, 0x91, 0xC7, 0x63, 0xDA, 0xA8, 0x66, 0x00, 0x00, 0x00, 0x78, 0x4D, 0x1C }; propertyValue.Value = sampleForPidTagPredecessorChangeList; hierarchyValues[4] = propertyValue; // PidTagDisplayName propertyValue = new TaggedPropertyValue { PropertyTag = { PropertyId = this.propertyDictionary[PropertyNames.PidTagDisplayName].PropertyId, PropertyType = this.propertyDictionary[PropertyNames.PidTagDisplayName].PropertyType } }; byte[] sampleForPidTagDisplayName = new byte[Encoding.Unicode.GetByteCount(DisplayNameAndCommentForNonSearchFolder + "\0")]; Array.Copy( Encoding.Unicode.GetBytes(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0"), 0, sampleForPidTagDisplayName, 0, Encoding.Unicode.GetByteCount(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0")); propertyValue.Value = sampleForPidTagDisplayName; hierarchyValues[5] = propertyValue; return hierarchyValues; }
public void MSOXCROPS_S11_TC03_TestRopSynchronizationImportReadStateChanges() { this.CheckTransportIsSupported(); this.cropsAdapter.RpcConnect( Common.GetConfigurationPropertyValue("SutComputerName", this.Site), ConnectionType.PrivateMailboxServer, Common.GetConfigurationPropertyValue("UserEssdn", this.Site), Common.GetConfigurationPropertyValue("Domain", this.Site), Common.GetConfigurationPropertyValue("AdminUserName", this.Site), Common.GetConfigurationPropertyValue("PassWord", this.Site)); // Step 1: Create a message. #region Create message // Log on to the private mailbox. RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle); RopCreateMessageRequest createMessageRequest = new RopCreateMessageRequest(); RopCreateMessageResponse createMessageResponse; // Construct the RopCreateMessage request. createMessageRequest.RopId = (byte)RopId.RopCreateMessage; createMessageRequest.LogonId = TestSuiteBase.LogonId; createMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; createMessageRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; // Set CodePageId to 0x0FFF, which specified the code page of Logon object will be used. createMessageRequest.CodePageId = TestSuiteBase.CodePageId; createMessageRequest.FolderId = logonResponse.FolderIds[4]; createMessageRequest.AssociatedFlag = Convert.ToByte(TestSuiteBase.Zero); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopCreateMessage request."); // Send the RopCreateMessage request and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( createMessageRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); createMessageResponse = (RopCreateMessageResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, createMessageResponse.ReturnValue, "if ROP succeeds, the ReturnValue of its response is 0(success)"); uint targetMessageHandle = responseSOHs[0][createMessageResponse.OutputHandleIndex]; #endregion // Step 2: Save message. #region Save message RopSaveChangesMessageRequest saveChangesMessageRequest; RopSaveChangesMessageResponse saveChangesMessageResponse; // Construct the RopSaveChangesMessage request. saveChangesMessageRequest.RopId = (byte)RopId.RopSaveChangesMessage; saveChangesMessageRequest.LogonId = TestSuiteBase.LogonId; saveChangesMessageRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; saveChangesMessageRequest.ResponseHandleIndex = TestSuiteBase.ResponseHandleIndex1; saveChangesMessageRequest.SaveFlags = (byte)SaveFlags.ForceSave; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 2: Begin to send the RopSaveChangesMessage request."); // Send the RopSaveChangesMessage request and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( saveChangesMessageRequest, targetMessageHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); saveChangesMessageResponse = (RopSaveChangesMessageResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, saveChangesMessageResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)."); #endregion // Step 3: Open folder. #region Open folder RopOpenFolderRequest openFolderRequest; RopOpenFolderResponse openFolderResponse; // Construct the RopOpenFolder request. openFolderRequest.RopId = (byte)RopId.RopOpenFolder; openFolderRequest.LogonId = TestSuiteBase.LogonId; openFolderRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; openFolderRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; openFolderRequest.FolderId = logonResponse.FolderIds[4]; openFolderRequest.OpenModeFlags = (byte)FolderOpenModeFlags.None; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 3: Begin to send the RopOpenFolder request."); // Send the RopOpenFolder request and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( openFolderRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); openFolderResponse = (RopOpenFolderResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, openFolderResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)"); // Get the handle of opened folder, which will be used as input handle in RopCreateFolder. uint openedFolderHandle = responseSOHs[0][openFolderResponse.OutputHandleIndex]; #endregion // Step 4: Configure a synchronization upload context. #region Configure a synchronization upload context RopSynchronizationOpenCollectorRequest synchronizationOpenCollectorRequest; RopSynchronizationOpenCollectorResponse synchronizationOpenCollectorResponse; // Construct the RopSynchronizationOpenCollector request. synchronizationOpenCollectorRequest.RopId = (byte)RopId.RopSynchronizationOpenCollector; synchronizationOpenCollectorRequest.LogonId = TestSuiteBase.LogonId; synchronizationOpenCollectorRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; synchronizationOpenCollectorRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1; synchronizationOpenCollectorRequest.IsContentsCollector = Convert.ToByte(TestSuiteBase.Zero); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopSynchronizationOpenCollector request."); // Send the RopSynchronizationOpenCollector request and verify the success response. this.responseSOHs = cropsAdapter.ProcessSingleRop( synchronizationOpenCollectorRequest, openedFolderHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); synchronizationOpenCollectorResponse = (RopSynchronizationOpenCollectorResponse)response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, synchronizationOpenCollectorResponse.ReturnValue, "If ROP succeeds, the ReturnValue of its response is 0 (success)"); uint synchronizationUploadContextHandle = responseSOHs[0][synchronizationOpenCollectorResponse.OutputHandleIndex]; #endregion // Step 5: Send the RopSynchronizationImportReadStateChanges request. #region RopSynchronizationImportReadStateChanges response RopSynchronizationImportReadStateChangesRequest synchronizationImportReadStateChangesRequest = new RopSynchronizationImportReadStateChangesRequest(); MessageReadState[] messageReadStates = new MessageReadState[1]; MessageReadState messageReadState = new MessageReadState { MarkAsRead = Convert.ToByte(TestSuiteBase.Zero) }; // Send the RopLongTermIdFromId request to convert a short-term ID into a long-term ID. #region RopLongTermIdFromId response RopLongTermIdFromIdRequest ropLongTermIdFromIdRequest = new RopLongTermIdFromIdRequest(); RopLongTermIdFromIdResponse ropLongTermIdFromIdResponse; ropLongTermIdFromIdRequest.RopId = (byte)RopId.RopLongTermIdFromId; ropLongTermIdFromIdRequest.LogonId = TestSuiteBase.LogonId; ropLongTermIdFromIdRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; ropLongTermIdFromIdRequest.ObjectId = saveChangesMessageResponse.MessageId; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 5: Begin to send the RopLongTermIdFromId request."); this.responseSOHs = cropsAdapter.ProcessSingleRop( ropLongTermIdFromIdRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); ropLongTermIdFromIdResponse = (RopLongTermIdFromIdResponse)response; #endregion byte[] messageID = new byte[22]; Array.Copy(ropLongTermIdFromIdResponse.LongTermId.DatabaseGuid, 0, messageID, 0, 16); Array.Copy(ropLongTermIdFromIdResponse.LongTermId.GlobalCounter, 0, messageID, 16, 6); messageReadState.MessageId = messageID; messageReadState.MessageIdSize = 22; messageReadStates[0] = messageReadState; // Construct the RopSynchronizationImportReadStateChanges request. synchronizationImportReadStateChangesRequest.RopId = (byte)RopId.RopSynchronizationImportReadStateChanges; synchronizationImportReadStateChangesRequest.LogonId = TestSuiteBase.LogonId; synchronizationImportReadStateChangesRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0; synchronizationImportReadStateChangesRequest.MessageReadStates = messageReadStates; synchronizationImportReadStateChangesRequest.MessageReadStateSize = (ushort)messageReadStates[0].Size(); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 5: Begin to send the RopSynchronizationImportReadStateChanges request to invoke success response."); this.responseSOHs = cropsAdapter.ProcessSingleRop( synchronizationImportReadStateChangesRequest, synchronizationUploadContextHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); // Test RopSynchronizationImportReadStateChanges failure response. synchronizationImportReadStateChangesRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 5: Begin to send the RopSynchronizationImportReadStateChanges request to invoke failure response."); this.responseSOHs = cropsAdapter.ProcessSingleRop( synchronizationImportReadStateChangesRequest, synchronizationUploadContextHandle, ref this.response, ref this.rawData, RopResponseType.FailureResponse); #endregion }
/// <summary> /// Get longTermId bytes. /// </summary> /// <param name="serverId">The server ID</param> /// <param name="objectId">The id need to be converted</param> /// <returns>The converted longTermId from id.</returns> private byte[] GetLongTermIdByte(int serverId, ulong objectId) { RopLongTermIdFromIdRequest ropLongTermIdFromIdRequest = new RopLongTermIdFromIdRequest(); RopLongTermIdFromIdResponse ropLongTermIdFromIdResponse = new RopLongTermIdFromIdResponse(); // Construct the RopLongTermIdFromId request. ropLongTermIdFromIdRequest.RopId = 0x43; ropLongTermIdFromIdRequest.LogonId = 0x00; ropLongTermIdFromIdRequest.InputHandleIndex = 0x00; ropLongTermIdFromIdRequest.ObjectId = objectId; // Send the RopLongTermIdFromId request to convert the short-term ID into a long-term ID. ropLongTermIdFromIdResponse = (RopLongTermIdFromIdResponse)this.Process(serverId, ropLongTermIdFromIdRequest, this.logonHandleOut); byte[] longTermByte = new byte[ropLongTermIdFromIdResponse.LongTermId.DatabaseGuid.Length + ropLongTermIdFromIdResponse.LongTermId.GlobalCounter.Length]; Array.Copy(ropLongTermIdFromIdResponse.LongTermId.DatabaseGuid, 0, longTermByte, 0, ropLongTermIdFromIdResponse.LongTermId.DatabaseGuid.Length); Array.Copy(ropLongTermIdFromIdResponse.LongTermId.GlobalCounter, 0, longTermByte, ropLongTermIdFromIdResponse.LongTermId.DatabaseGuid.Length, ropLongTermIdFromIdResponse.LongTermId.GlobalCounter.Length); return longTermByte; }
/// <summary> /// Verify the response by sending the ROP RopLongTermIdFromId /// </summary> /// <param name="request">The structure of ROP RopLongTermIdFromId request.</param> /// <param name="response">The structure of ROP RopLongTermIdFromId response.</param> private void VerifyRopLongTermIdFromId(RopLongTermIdFromIdRequest request, RopLongTermIdFromIdResponse response) { if (response.ReturnValue == 0) { ulong globalCounter = 0; for (int i = 0; i < 6; i++) { globalCounter += (ulong)(((ulong)response.LongTermId.GlobalCounter[i]) << (i * 8)); } globalCounter = globalCounter << 16; // The last 2 bytes of the Folder ID or Message ID are not fixed. ulong maskedObjectId = request.ObjectId & ~(ulong)0xFFFF; // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R69742"); // If the response can be parsed successfully and the return value is success, indicates the ROP's functionality is consistent with its description. // The returned LongTermID is associated with the given a Folder ID or Message ID. this.Site.CaptureRequirementIfAreEqual<ulong>( maskedObjectId, globalCounter, 69742, @"[In RopLongTermIdFromId ROP] The RopLongTermIdFromId ROP ([MS-OXCROPS] section 2.2.3.8) is used to obtain a LongTermID structure, as specified in [MS-OXCDATA] section 2.2.1.3.1, given a Folder ID structure or Message ID structure, as specified in [MS-OXCDATA] section 2.2.1.1 or section 2.2.1.2. "); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R440"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R440 // If the high 48 bits in ObjectId and GlobalCounter are same, indicates the LongTermId related to the requested REPLID is valid in the REPLID and REPLGUID to-and-from mapping table. Site.CaptureRequirementIfAreEqual<ulong>( maskedObjectId, globalCounter, 440, @"[In RopLongTermIdFromId ROP Request Buffer] ObjectId: The 16-bit REPLID portion of the Folder ID or Message ID MUST be a valid entry in the REPLID and REPLGUID to-and-from mapping table."); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R442"); // The LongTermId field is verified in the RopLongTermIdFromIdResponse structure. // If the LongTermId field is parsed successfully, this requirement can be captured directly. Site.CaptureRequirementIfIsNotNull( response.LongTermId, 442, @"[In RopLongTermIdFromId ROP Success Response Buffer] LongTermId: Contains the LongTermID structure, as specified in [MS-OXCDATA] section 2.2.1.3.1."); // The longTermId is null indicates its invalid object ID. if (response.LongTermId.DatabaseGuid != null) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCSTOR_R1244"); // Verify MS-OXCSTOR requirement: MS-OXCSTOR_R1244 // The underlying structure for LongTermId is parsed as structure as REPLGUID(128-bit) with the specified sequence, if GlobalCounter is associated with the given short-term ID,this requirement can be verified. Site.CaptureRequirementIfAreEqual<ulong>( maskedObjectId, globalCounter, 1244, @"[In Receiving a RopLongTermIdFromId ROP Request] The LongTermID consists of the 128-bit REPLGUID, followed by the 48-bit global counter portion of the given Folder ID or Message ID, followed by 16 bits of padding set to 0x0000."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2188"); // Verify MS-OXCDATA requirement: MS-OXCDATA_R2188 // The LongTermID is a GID, which is verified in "MS-OXCDATA", so here only need to verify the length of Pad field. bool isVerifyR2188 = response.LongTermId.Size() == 24; Site.CaptureRequirementIfIsTrue( isVerifyR2188, "MS-OXCDATA", 2188, @"[In LongTermID Structure] A LongTermID structure is a Global Identifier structure, as specified in section 2.2.1.3, plus a 2-byte Pad field that has the value 0x0000."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCDATA_R2189"); // The longtermID consists of DatabaseGuid, GlobalCounter and Padding, so its length is the sum of the three. int longTermIdLength = response.LongTermId.DatabaseGuid.Length + response.LongTermId.GlobalCounter.Length + 2; // +response.LongTermId.Padding.Length; // Verify MS-OXCDATA requirement: MS-OXCDATA_R2189 Site.CaptureRequirementIfAreEqual<int?>( 24, longTermIdLength, "MS-OXCDATA", 2189, @"[In LongTermID Structure] The total length of the LongTermID structure is 24 bytes."); } } }
public void MSOXCMSG_S03_TC04_RopSetMessageReadFlagsInPublicFolderMode() { this.CheckMapiHttpIsSupported(); this.ConnectToServer(ConnectionType.PublicFolderServer); List<PropertyTag> propertyTags = new List<PropertyTag> { PropertyHelper.PropertyTagDic[PropertyNames.PidTagMessageFlags] }; List<PropertyObj> ps = new List<PropertyObj>(); #region Call RopLogon to logon the public folder. RopLogonResponse logonResponse = this.Logon(LogonType.PublicFolder, out this.insideObjHandle); #endregion #region Call RopOpenFolder to open the second folder. uint openedFolderHandle = this.OpenSpecificFolder(logonResponse.FolderIds[1], this.insideObjHandle); #endregion #region Call RopCreateFolder to create a temporary public folder. ulong folderId = this.CreateSubFolder(openedFolderHandle); this.isCreatePulbicFolder = true; this.publicFolderID = folderId; #endregion #region Call RopOpenFolder to open the temporary public folder. this.OpenSpecificFolder(folderId, this.insideObjHandle); #endregion #region Call RopCreateMessage to create a message. uint targetMessageHandle = this.CreatedMessage(folderId, this.insideObjHandle); #endregion #region Call RopSaveChangesMessage to save the created message. RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave); Site.Assert.AreEqual<uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); this.ReleaseRop(targetMessageHandle); #endregion #region Call RopLongTermIdFromId to get the Long Term Id. RopLongTermIdFromIdRequest longTermIdFromIdRequest = new RopLongTermIdFromIdRequest() { RopId = (byte)RopId.RopLongTermIdFromId, // RopId 0x43 indicates RopLongTermIdFromId LogonId = CommonLogonId, // The logonId 0x00 is associated with this operation. InputHandleIndex = CommonInputHandleIndex, // This index specifies the location 0x00 in the Server Object Handle Table where the handle for the input Server Object is stored. ObjectId = saveChangesMessageResponse.MessageId }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(longTermIdFromIdRequest, this.insideObjHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopLongTermIdFromIdResponse longTermIdFromIdResponse = (RopLongTermIdFromIdResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, longTermIdFromIdResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopOpenMessage to open the created message. uint openMessageHandle = this.OpenSpecificMessage(folderId, saveChangesMessageResponse.MessageId, this.insideObjHandle, MessageOpenModeFlags.ReadWrite); #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to rfDefault for the created message. RopSetMessageReadFlagRequest setMessageReadFlagRequest = new RopSetMessageReadFlagRequest() { RopId = (byte)RopId.RopSetMessageReadFlag, LogonId = CommonLogonId, // The logonId 0x00 is associated with this operation. ResponseHandleIndex = CommonOutputHandleIndex, // This index specifies the location in the Server object handle table that is referenced in the response. InputHandleIndex = CommonInputHandleIndex, // This index specifies the location 0x00 in the Server Object Handle Table where the handle for the input Server Object is stored. ClientData = longTermIdFromIdResponse.LongTermId.Serialize(), ReadFlags = (byte)ReadFlags.Default }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, openMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopSetMessageReadFlagResponse setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to rfSuppressReceipt for the created message. setMessageReadFlagRequest.ReadFlags = (byte)ReadFlags.SuppressReceipt; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, openMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to rfClearReadFlag for the created message. ps = this.GetSpecificPropertiesOfMessage(folderId, saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags); PropertyObj pidTagMessageFlagsBeforeSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); setMessageReadFlagRequest.ReadFlags = (byte)ReadFlags.ClearReadFlag; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, openMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); ps = this.GetSpecificPropertiesOfMessage(folderId, saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags); PropertyObj pidTagMessageFlagsAfterSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R921, the ReadStatusChanged field value is {0}.", setMessageReadFlagResponse.ReadStatusChanged); // Verify MS-OXCMSG requirement: MS-OXCMSG_R921 bool isVerifiedR921 = setMessageReadFlagResponse.ReadStatusChanged > 0 && pidTagMessageFlagsBeforeSet.Value != pidTagMessageFlagsAfterSet.Value; this.Site.CaptureRequirementIfIsTrue( isVerifiedR921, 921, @"[In RopSetMessageReadFlag ROP Response Buffer] [ReadStatusChanged] [The value non-zero indicates that] The read status on the Message object changed and the logon is in public folder mode."); #endregion #region Call RopSetMessageReadFlag to set the ReadFlags to rfGenerateReceiptOnly for the created message. ps = this.GetSpecificPropertiesOfMessage(folderId, saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags); pidTagMessageFlagsBeforeSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); setMessageReadFlagRequest.ReadFlags = (byte)ReadFlags.GenerateReceiptOnly; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageReadFlagRequest, openMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); setMessageReadFlagResponse = (RopSetMessageReadFlagResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, setMessageReadFlagResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg); ps = this.GetSpecificPropertiesOfMessage(folderId, saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags); pidTagMessageFlagsAfterSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageFlags); // Add the debug information this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R920, the ReadStatusChanged field value is {0}.", setMessageReadFlagResponse.ReadStatusChanged); // Verify MS-OXCMSG requirement: MS-OXCMSG_R920 bool isVerifiedR920 = setMessageReadFlagResponse.ReadStatusChanged == 0 && Convert.ToInt32(pidTagMessageFlagsBeforeSet.Value) == Convert.ToInt32(pidTagMessageFlagsAfterSet.Value); this.Site.CaptureRequirementIfIsTrue( isVerifiedR920, 920, @"[In RopSetMessageReadFlag ROP Response Buffer] [ReadStatusChanged] [The value 0x00 indicates that] The read status on the Message object was unchanged."); #endregion #region Call RopRelease to release the created folder and message this.ReleaseRop(openMessageHandle); this.ReleaseRop(openedFolderHandle); #endregion }
/// <summary> /// Get the LongTermId form specified object ID. /// </summary> /// <param name="objectId">The specified object ID.</param> /// <param name="logonHandle">The logon handle.</param> /// <returns>Return the LongTermId that mapping with specified object id.</returns> protected LongTermId GetLongTermIdFormID(ulong objectId, uint logonHandle) { RopLongTermIdFromIdRequest longTermIdFromIdRequest = new RopLongTermIdFromIdRequest() { RopId = (byte)RopId.RopLongTermIdFromId, LogonId = CommonLogonId, InputHandleIndex = CommonInputHandleIndex, // Set ObjectId to that got in the foregoing code, this id will be converted to a short-term ID. ObjectId = objectId }; this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(longTermIdFromIdRequest, logonHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None); RopLongTermIdFromIdResponse longTermIdFromIdResponse = (RopLongTermIdFromIdResponse)this.response; Site.Assert.AreEqual<uint>(TestSuiteBase.Success, longTermIdFromIdResponse.ReturnValue, "Call RopLongTermIdFromId should be success."); return longTermIdFromIdResponse.LongTermId; }
/// <summary> /// Get LongTermId from object id. /// </summary> /// <param name="objHandle">object handle.</param> /// <param name="objId">Object id value.</param> /// <returns>ROP response.</returns> public RopLongTermIdFromIdResponse GetLongTermId(uint objHandle, ulong objId) { RopLongTermIdFromIdRequest longTermIdFromIdRequest = new RopLongTermIdFromIdRequest(); RopLongTermIdFromIdResponse longTermIdFromIdResponse = new RopLongTermIdFromIdResponse(); longTermIdFromIdRequest.InputHandleIndex = 0x00; longTermIdFromIdRequest.LogonId = 0x00; longTermIdFromIdRequest.RopId = 0x43; longTermIdFromIdRequest.ObjectId = objId; this.responseSOHs = this.DoRPCCall(longTermIdFromIdRequest, objHandle, ref this.response, ref this.rawData); longTermIdFromIdResponse = (RopLongTermIdFromIdResponse)this.response; return longTermIdFromIdResponse; }