/// <summary> /// Create and save message. /// </summary> /// <param name="folderHandle">Folder Handle </param> /// <param name="folderId">Folder Id which messages will be create in.</param> /// <param name="associatedFlag">Specifies whether the message is a Folder Associated Information message.</param> /// <param name="messageId"> Message Id which will be returned by server.</param> /// <param name="messageHandle">Message Handle which will be returned by server.</param> protected void CreateSaveMessage(uint folderHandle, ulong folderId, byte associatedFlag, ref ulong messageId, ref uint messageHandle) { // Create a Message. RopCreateMessageRequest createMessageRequest = new RopCreateMessageRequest(); RopCreateMessageResponse createMessageResponse = new RopCreateMessageResponse(); object ropResponse = null; createMessageRequest.RopId = (byte)RopId.RopCreateMessage; createMessageRequest.LogonId = Constants.CommonLogonId; createMessageRequest.InputHandleIndex = Constants.CommonInputHandleIndex; createMessageRequest.OutputHandleIndex = Constants.CommonOutputHandleIndex; createMessageRequest.CodePageId = 0x0FFF; createMessageRequest.FolderId = folderId; createMessageRequest.AssociatedFlag = associatedFlag; this.Adapter.DoRopCall(createMessageRequest, folderHandle, ref ropResponse, ref this.responseHandles); createMessageResponse = (RopCreateMessageResponse)ropResponse; Site.Assert.AreEqual<uint>(0, createMessageResponse.ReturnValue, "Creating Message should succeed"); messageHandle = this.responseHandles[0][createMessageResponse.OutputHandleIndex]; // Save a Message. RopSaveChangesMessageRequest saveChangesMessageRequest = new RopSaveChangesMessageRequest(); RopSaveChangesMessageResponse saveChangesMessageResponse = new RopSaveChangesMessageResponse(); saveChangesMessageRequest.RopId = (byte)RopId.RopSaveChangesMessage; saveChangesMessageRequest.LogonId = Constants.CommonLogonId; saveChangesMessageRequest.InputHandleIndex = Constants.CommonInputHandleIndex; saveChangesMessageRequest.ResponseHandleIndex = 0x01; saveChangesMessageRequest.SaveFlags = 0x0C; this.Adapter.DoRopCall(saveChangesMessageRequest, messageHandle, ref ropResponse, ref this.responseHandles); saveChangesMessageResponse = (RopSaveChangesMessageResponse)ropResponse; Site.Assert.AreEqual<uint>( 0, createMessageResponse.ReturnValue, "Save Messages Success."); messageId = saveChangesMessageResponse.MessageId; }
/// <summary> /// Verify RopSaveChangesMessage Failure Response /// </summary> /// <param name="ropSaveChangesMessageResponse">The response of RopSaveChangesMessage request</param> /// <param name="responseHandleIndex">The field of ResponseHandleIndex in RopSaveChangesMessage request</param> private void VerifyRopSaveChangesMessageFailureResponse(RopSaveChangesMessageResponse ropSaveChangesMessageResponse, byte responseHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1820"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1820 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropSaveChangesMessageResponse.RopId.GetType(), 1820, @"[In RopSaveChangesMessage ROP Failure Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1822"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1822 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopSaveChangesMessage, ropSaveChangesMessageResponse.RopId, 1822, @"[In RopSaveChangesMessage ROP Failure Response Buffer,RopId (1 byte)]For this operation[RopSaveChangesMessage], this field is set to 0x0C."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1823"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1823 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropSaveChangesMessageResponse.ResponseHandleIndex.GetType(), 1823, @"[In RopSaveChangesMessage ROP Failure Response Buffer]ResponseHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1824"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1824 Site.CaptureRequirementIfAreEqual<byte>( responseHandleIndex, ropSaveChangesMessageResponse.ResponseHandleIndex, 1824, @"[In RopSaveChangesMessage ROP Failure Response Buffer,ResponseHandleIndex (1 byte)]This index MUST be set to the value specified in the ResponseHandleIndex field in the request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1826"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1826 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropSaveChangesMessageResponse.ReturnValue.GetType(), 1826, @"[In RopSaveChangesMessage ROP Failure Response Buffer]ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1828"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1828 Site.CaptureRequirementIfAreNotEqual<uint>( SuccessReturnValue, ropSaveChangesMessageResponse.ReturnValue, 1828, @"[In RopSaveChangesMessage ROP Failure Response Buffer,ReturnValue (4 bytes)]For this response[Failure Response], this field is set to a value other than 0x00000000."); }
/// <summary> /// Create message each one loop In InBox /// </summary> /// <param name="logonResponse">the logon response be used to create message</param> /// <param name="tableHandle">The tableHanlder of the new folder</param> /// <param name="count">The count of created messages</param> /// <param name="createMessageRequest">The ROP CreateMessageRequest</param> /// <param name="saveChangesMessageRequest">The ROP SaveChangesMessageRequest</param> /// <param name="releaseRequest">The ROP ReleaseRequest</param> protected void CreateSingleProcessEachLoop(ref RopLogonResponse logonResponse, out uint tableHandle, int count, RopCreateMessageRequest createMessageRequest, RopSaveChangesMessageRequest saveChangesMessageRequest, RopReleaseRequest releaseRequest) { RopCreateMessageResponse createMessageResponse = new RopCreateMessageResponse(); RopSaveChangesMessageResponse saveChangesMessageResponse = new RopSaveChangesMessageResponse(); #region Preparing the table: CreateFolder // Open a folder first RopOpenFolderRequest openFolderRequest; RopOpenFolderResponse openFolderResponse; 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 2: Begin to send the RopOpenFolder request."); this.responseSOHs = this.cropsAdapter.ProcessSingleRop( openFolderRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); openFolderResponse = (RopOpenFolderResponse)this.response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, openFolderResponse.ReturnValue, "if ROP succeeds, the ReturnValue of its response is 0(success)"); uint openedFolderHandle = this.responseSOHs[0][openFolderResponse.OutputHandleIndex]; // Create a new subfolder in the opened folder // The new subfolder will be used as target folder RopCreateFolderRequest createFolderRequest; RopCreateFolderResponse createFolderResponse; 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."); this.responseSOHs = this.cropsAdapter.ProcessSingleRop( createFolderRequest, openedFolderHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); createFolderResponse = (RopCreateFolderResponse)this.response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, createFolderResponse.ReturnValue, "if ROP succeeds, the ReturnValue of its response is 0(success)"); uint targetFolderHandle = this.responseSOHs[0][openFolderResponse.OutputHandleIndex]; tableHandle = this.GetContentsTableHandle(targetFolderHandle); ulong folderId = createFolderResponse.FolderId; #endregion #region Preparing the table: RopCreateAndSaveMessages int waitTime = int.Parse(Common.GetConfigurationPropertyValue("WaitTime", this.Site)); int maxRetryCount = int.Parse(Common.GetConfigurationPropertyValue("RetryCount", this.Site)); int retryCount; uint returnValue = 0; for (int i = 1; i < count; i++) { // If the RPC report error code reported by the following three ROP methods is 1726 (The remote procedure call failed), // re-do the common steps of this case. if (returnValue == 1726) { #region The common steps // Add the debug information Site.Log.Add(LogEntryKind.Debug, "If RPC error code is 1726, re-connect to server."); 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)); logonResponse = this.Logon(LogonType.Mailbox, this.userDN, out this.inputObjHandle); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 2:Begin to send the RopOpenFolder request."); this.responseSOHs = this.cropsAdapter.ProcessSingleRop( openFolderRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); openFolderResponse = (RopOpenFolderResponse)this.response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, openFolderResponse.ReturnValue, "if ROP succeeds, the ReturnValue of its response is 0(success)"); openedFolderHandle = this.responseSOHs[0][openFolderResponse.OutputHandleIndex]; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 2:Begin to send the RopCreateFolder request."); this.responseSOHs = this.cropsAdapter.ProcessSingleRop( createFolderRequest, openedFolderHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); createFolderResponse = (RopCreateFolderResponse)this.response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, createFolderResponse.ReturnValue, "if ROP succeeds, the ReturnValue of its response is 0(success)"); targetFolderHandle = this.responseSOHs[0][openFolderResponse.OutputHandleIndex]; tableHandle = this.GetContentsTableHandle(targetFolderHandle); folderId = createFolderResponse.FolderId; #endregion } #region Create message createMessageRequest.FolderId = folderId; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 2:Begin to send the RopCreateMessage request:loop counter i={0}", i); retryCount = maxRetryCount; do { // Send the RopCreateMessage to create message. this.responseSOHs = this.cropsAdapter.ProcessSingleRopWithReturnValue( createMessageRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse, out returnValue); System.Threading.Thread.Sleep(waitTime); retryCount--; } while (this.response is RopBackoffResponse && retryCount >= 0); Site.Assert.IsTrue(retryCount >= 0, "The case {0} failed since server is busy and always returns RopBackoff in the response, reduce your server load and try again.", this.TestContext.TestName); // If the error code is 1726, continue this loop. if (returnValue == 1726) { continue; } createMessageResponse = (RopCreateMessageResponse)this.response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, createMessageResponse.ReturnValue, "if ROP succeeds, the ReturnValue of its response is 0(success)"); uint targetMessageHandle = this.responseSOHs[0][createMessageResponse.OutputHandleIndex]; #endregion #region Save message // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 2:Begin to send the RopSaveChangesMessage request:loop counter i={0}", i); retryCount = maxRetryCount; // Do the loop when response is RopBackoffResponse or saveChangesMessageResponse is 0x80040401 (ecTimeout). do { // Send the RopSaveChangesMessage request to save the created message. this.responseSOHs = this.cropsAdapter.ProcessSingleRopWithReturnValue( saveChangesMessageRequest, targetMessageHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse, out returnValue); if (this.response is RopSaveChangesMessageResponse) { saveChangesMessageResponse = (RopSaveChangesMessageResponse)this.response; } System.Threading.Thread.Sleep(waitTime); retryCount--; } while ((this.response is RopBackoffResponse || saveChangesMessageResponse.ReturnValue == 0x80040401) && retryCount >= 0); Site.Assert.IsTrue(retryCount >= 0, "The case {0} failed since server is busy and always returns RopBackoff in the response, reduce your server load and try again.", this.TestContext.TestName); // If the error code is 1726, continue this loop. if (returnValue == 1726) { continue; } saveChangesMessageResponse = (RopSaveChangesMessageResponse)this.response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, saveChangesMessageResponse.ReturnValue, "if ROP succeeds, the ReturnValue of its response is 0(success)"); #endregion #region Release all resources // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 2:Begin to send the RopRelease request."); retryCount = maxRetryCount; do { this.responseSOHs = this.cropsAdapter.ProcessSingleRopWithReturnValue( releaseRequest, targetMessageHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse, out returnValue); System.Threading.Thread.Sleep(waitTime); retryCount--; } while (this.response is RopBackoffResponse && retryCount >= 0); Site.Assert.IsTrue(retryCount >= 0, "The case {0} failed since server is busy and always returns RopBackoff in the response, reduce your server load and try again.", this.TestContext.TestName); // If the error code is 1726, continue this loop. if (returnValue == 1726) { continue; } #endregion } // If the error code 1726 occurs on the last time of the above "for" loop, re-do the common steps. if (returnValue == 1726) { #region The common steps // Add the debug information Site.Log.Add(LogEntryKind.Debug, "If RPC error code is 1726, re-connect to server."); 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)); logonResponse = this.Logon(LogonType.Mailbox, this.userDN, out this.inputObjHandle); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 2:Begin to send the RopOpenFolder request."); this.responseSOHs = this.cropsAdapter.ProcessSingleRop( openFolderRequest, this.inputObjHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); openFolderResponse = (RopOpenFolderResponse)this.response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, openFolderResponse.ReturnValue, "if ROP succeeds, the ReturnValue of its response is 0(success)"); openedFolderHandle = this.responseSOHs[0][openFolderResponse.OutputHandleIndex]; // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Step 2:Begin to send the RopCreateFolder request."); this.responseSOHs = this.cropsAdapter.ProcessSingleRop( createFolderRequest, openedFolderHandle, ref this.response, ref this.rawData, RopResponseType.SuccessResponse); createFolderResponse = (RopCreateFolderResponse)this.response; Site.Assert.AreEqual<uint>( TestSuiteBase.SuccessReturnValue, createFolderResponse.ReturnValue, "if ROP succeeds, the ReturnValue of its response is 0(success)"); targetFolderHandle = this.responseSOHs[0][openFolderResponse.OutputHandleIndex]; tableHandle = this.GetContentsTableHandle(targetFolderHandle); folderId = createFolderResponse.FolderId; #endregion } #endregion }
/// <summary> /// Verify RopSaveChangesMessage Success Response /// </summary> /// <param name="ropSaveChangesMessageResponse">The response of RopSaveChangesMessage request</param> /// <param name="inputHandleIndex">The field of InputHandleIndex in RopSaveChangesMessage request</param> /// <param name="responseHandleIndex">The field of ResponseHandleIndex in RopSaveChangesMessage request</param> private void VerifyRopSaveChangesMessageSuccessResponse(RopSaveChangesMessageResponse ropSaveChangesMessageResponse, byte inputHandleIndex, byte responseHandleIndex) { // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1806"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1806 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropSaveChangesMessageResponse.RopId.GetType(), 1806, @"[In RopSaveChangesMessage ROP Success Response Buffer]RopId (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1808"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1808 Site.CaptureRequirementIfAreEqual<byte>( (byte)RopId.RopSaveChangesMessage, ropSaveChangesMessageResponse.RopId, 1808, @"[In RopSaveChangesMessage ROP Success Response Buffer,RopId (1 byte)]For this[RopSaveChangesMessage] operation, this field is set to 0x0C."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1809"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1809 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropSaveChangesMessageResponse.ResponseHandleIndex.GetType(), 1809, @"[In RopSaveChangesMessage ROP Success Response Buffer]ResponseHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1810"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1810 Site.CaptureRequirementIfAreEqual<byte>( responseHandleIndex, ropSaveChangesMessageResponse.ResponseHandleIndex, 1810, @"[In RopSaveChangesMessage ROP Success Response Buffer,ResponseHandleIndex (1 byte)]This index MUST be set to the value specified in the ResponseHandleIndex field in the request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1812"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1812 Site.CaptureRequirementIfAreEqual<Type>( typeof(uint), ropSaveChangesMessageResponse.ReturnValue.GetType(), 1812, @"[In RopSaveChangesMessage ROP Success Response Buffer]ReturnValue (4 bytes): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1814"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1814 Site.CaptureRequirementIfAreEqual<uint>( SuccessReturnValue, ropSaveChangesMessageResponse.ReturnValue, 1814, @"[In RopSaveChangesMessage ROP Success Response Buffer,ReturnValue (4 bytes)]For this response[Success Response], this field is set to 0x00000000."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1815"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1815 Site.CaptureRequirementIfAreEqual<Type>( typeof(byte), ropSaveChangesMessageResponse.InputHandleIndex.GetType(), 1815, @"[In RopSaveChangesMessage ROP Success Response Buffer]InputHandleIndex (1 byte): An unsigned integer."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1816"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1816 Site.CaptureRequirementIfAreEqual<byte>( inputHandleIndex, ropSaveChangesMessageResponse.InputHandleIndex, 1816, @"[In RopSaveChangesMessage ROP Success Response Buffer,InputHandleIndex (1 byte)]This index MUST be set to the value specified in the InputHandleIndex field in the request."); // Add the debug information Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R1818"); // Verify MS-OXCROPS requirement: MS-OXCROPS_R1818 Site.CaptureRequirementIfAreEqual<int>( 8, Marshal.SizeOf(ropSaveChangesMessageResponse.MessageId), 1818, @"[In RopSaveChangesMessage ROP Success Response Buffer]MessageId (8 bytes): An identifier."); }