Example #1
0
        /// <summary>
        /// Get the expected message properties included in a specific contents table after retry preconfigured times.
        /// </summary>
        /// <param name="folderHandle">Handle of a specific folder.</param>
        /// <param name="contentsTableHandle">Handle of a specific contents table.</param>
        /// <param name="propertyTagList">>Array of PropertyTag structures. This field specifies the property values that are visible in table rows.</param>
        /// <param name="expectedMessageIndex">The index of the specific message in the table.</param>
        /// <param name="expectedPropertyValue">The value of a specific property of the message to be found in the target mailbox.</param>
        /// <param name="expectedPropertyName">The property name of a specific property of the message to be found in the target mailbox, which type should be string. The default property name is PidTagSubject.</param>
        /// <returns>Response of the RopQueryRow ROP contents the expected message properties.</returns>
        protected RopQueryRowsResponse GetExpectedMessage(uint folderHandle, ref uint contentsTableHandle, PropertyTag[] propertyTagList, ref int expectedMessageIndex, string expectedPropertyValue, PropertyId expectedPropertyName = PropertyId.PidTagSubject)
        {
            RopQueryRowsResponse getNormalMailMessageContent = new RopQueryRowsResponse();
            uint repeatTime = 0;
            uint rowCount   = 0;
            bool isExpectedPropertyInPropertyList = false;

            // If retry time more than expected, terminates the loop
            while (repeatTime < this.getMessageRepeatTime)
            {
                RopGetContentsTableResponse ropGetContentsTableResponse = this.OxoruleAdapter.RopGetContentsTable(folderHandle, ContentTableFlag.None, out contentsTableHandle);
                Site.Assert.AreEqual <uint>(0, ropGetContentsTableResponse.ReturnValue, "Getting contents table should succeed.");
                rowCount = ropGetContentsTableResponse.RowCount;
                repeatTime++;

                if (rowCount > 0)
                {
                    getNormalMailMessageContent = this.OxoruleAdapter.QueryPropertiesInTable(contentsTableHandle, propertyTagList);
                    Site.Assert.AreEqual <uint>(0, getNormalMailMessageContent.ReturnValue, "Getting mail message operation should succeed.");

                    for (int i = 0; i < propertyTagList.Length; i++)
                    {
                        if (propertyTagList[i].PropertyId == (ushort)expectedPropertyName)
                        {
                            isExpectedPropertyInPropertyList = true;
                            for (int j = 0; j < getNormalMailMessageContent.RowData.PropertyRows.Count; j++)
                            {
                                string propertyValue = AdapterHelper.PropertyValueConvertToString(getNormalMailMessageContent.RowData.PropertyRows[j].PropertyValues[i].Value);
                                if (propertyValue.Contains(expectedPropertyValue))
                                {
                                    expectedMessageIndex = j;
                                    return(getNormalMailMessageContent);
                                }
                            }
                        }
                    }

                    Site.Assert.IsTrue(isExpectedPropertyInPropertyList, "The property {0} to be checked should be included in the property list.", expectedPropertyName.ToString());
                }

                if (repeatTime == this.getMessageRepeatTime)
                {
                    break;
                }

                Thread.Sleep(this.WaitForTheRuleToTakeEffect);
            }

            Site.Assert.Fail("Can't find the message which has a property {0} ant its value is {1} in the target mailbox.", expectedPropertyName.ToString(), expectedPropertyValue);
            return(getNormalMailMessageContent);
        }
Example #2
0
        /// <summary>
        /// Get the properties' value from the rows of the table.
        /// </summary>
        /// <param name="tableHandle">The table handle.</param>
        /// <param name="rowCount">The amount of the rows.</param>
        /// <param name="properties">The properties need to show.</param>
        /// <returns>The property rows in the specified table object.</returns>
        protected List <PropertyRow> GetTableRowValue(uint tableHandle, ushort rowCount, PropertyTag[] properties)
        {
            #region The client calls RopSetColumns operation to set the property information to show.

            RopSetColumnsRequest setColumnsRequest = new RopSetColumnsRequest();
            object ropResponse = new object();
            setColumnsRequest.RopId            = (byte)RopId.RopSetColumns;
            setColumnsRequest.LogonId          = Constants.CommonLogonId;
            setColumnsRequest.InputHandleIndex = Constants.CommonInputHandleIndex;
            setColumnsRequest.PropertyTagCount = (ushort)properties.Length;
            setColumnsRequest.PropertyTags     = properties;
            setColumnsRequest.SetColumnsFlags  = (byte)AsynchronousFlags.None;
            this.Adapter.DoRopCall(setColumnsRequest, tableHandle, ref ropResponse, ref this.responseHandles);
            #endregion

            #region The client calls RopQueryRows operation to query the folder which have the special properties.

            RopQueryRowsRequest queryRowsRequest = new RopQueryRowsRequest();
            ropResponse                       = new object();
            queryRowsRequest.RopId            = (byte)RopId.RopQueryRows;
            queryRowsRequest.LogonId          = Constants.CommonLogonId;
            queryRowsRequest.InputHandleIndex = Constants.CommonInputHandleIndex;
            queryRowsRequest.RowCount         = (ushort)rowCount;
            queryRowsRequest.QueryRowsFlags   = (byte)QueryRowsFlags.Advance;
            queryRowsRequest.ForwardRead      = 0x01;
            this.Adapter.DoRopCall(queryRowsRequest, tableHandle, ref ropResponse, ref this.responseHandles);
            RopQueryRowsResponse queryRowsResponse = (RopQueryRowsResponse)ropResponse;
            Site.Assert.AreEqual <uint>(Constants.SuccessCode, queryRowsResponse.ReturnValue, "RopQueryRows ROP operation performs successful!");
            #endregion

            List <PropertyRow> propertyRows = null;

            if (queryRowsResponse.RowData != null)
            {
                propertyRows = queryRowsResponse.RowData.PropertyRows;
            }

            return(propertyRows);
        }
Example #3
0
        /// <summary>
        /// Clear all rules of the inbox folder.
        /// </summary>
        protected void ClearAllRules()
        {
            // Call RopGetRulesTable with valid TableFlags.
            RopGetRulesTableResponse ropGetRulesTableResponse;
            uint ruleTableHandle = this.OxoruleAdapter.RopGetRulesTable(this.InboxFolderHandle, TableFlags.Normal, out ropGetRulesTableResponse);

            if (ropGetRulesTableResponse.ReturnValue == 0)
            {
                // Get rule ID if rules exist.
                PropertyTag ruleIDTag = new PropertyTag
                {
                    PropertyId   = (ushort)PropertyId.PidTagRuleId,
                    PropertyType = (ushort)PropertyType.PtypInteger64
                };
                RopQueryRowsResponse queryRowsResponse = this.OxoruleAdapter.QueryPropertiesInTable(ruleTableHandle, new PropertyTag[1] {
                    ruleIDTag
                });
                Site.Assert.AreEqual <uint>(0, queryRowsResponse.ReturnValue, "Retrieving rows from the rule table should succeed.");

                // Delete all rules if exist.
                if (queryRowsResponse.RowCount > 0)
                {
                    RuleData[] ruleDatas = new RuleData[queryRowsResponse.RowCount];
                    for (int i = 0; i < queryRowsResponse.RowCount; i++)
                    {
                        ulong          ruleId         = BitConverter.ToUInt64(queryRowsResponse.RowData.PropertyRows[i].PropertyValues[0].Value, 0);
                        RuleProperties ruleProperties = new RuleProperties();
                        ruleDatas[i] = AdapterHelper.GenerateValidRuleData(ActionType.OP_MARK_AS_READ, TestRuleDataType.ForRemove, 0, RuleState.ST_ENABLED, null, ruleProperties, ruleId);
                    }

                    RopModifyRulesResponse modifyRulesResponse = this.OxoruleAdapter.RopModifyRules(this.InboxFolderHandle, ModifyRuleFlag.Modify_OnExisting, ruleDatas);
                    Site.Assert.AreEqual <uint>(0, modifyRulesResponse.ReturnValue, "Deleting rule should be success");

                    // Wait the rule to be deleted
                    Thread.Sleep(this.WaitForTheRuleToTakeEffect);
                }
            }
        }
Example #4
0
        /// <summary>
        /// Check if an unexpected message with a specific property value exists in the target mailbox.
        /// </summary>
        /// <param name="folderHandle">Handle of a specific folder.</param>
        /// <param name="contentsTableHandle">Handle of a specific contents table.</param>
        /// <param name="propertyTagList">>Array of PropertyTag structures. This field specifies the property values that are visible in table rows.</param>
        /// <param name="unexpectedPropertyValue">The value of a specific property of the message to be checked in the target mailbox.</param>
        /// <param name="propertyName">The property name of a specific property of the message to be checked in the target mailbox, which type should be string. The default property name is PidTagSubject.</param>
        /// <returns>A bool value indicates whether a message with specific property value exists in the target mailbox. True means exist, otherwise not.</returns>
        protected bool CheckUnexpectedMessageExist(uint folderHandle, ref uint contentsTableHandle, PropertyTag[] propertyTagList, string unexpectedPropertyValue, PropertyId propertyName = PropertyId.PidTagSubject)
        {
            bool doesUnexpectedMessageExist       = false;
            bool isExpectedPropertyInPropertyList = false;
            RopGetContentsTableResponse ropGetContentTableResponse = this.OxoruleAdapter.RopGetContentsTable(folderHandle, ContentTableFlag.None, out contentsTableHandle);

            Site.Assert.AreEqual <uint>(0, ropGetContentTableResponse.ReturnValue, "Getting contents table should succeed.");

            RopQueryRowsResponse getNormalMailMessageContent = this.OxoruleAdapter.QueryPropertiesInTable(contentsTableHandle, propertyTagList);

            Site.Assert.AreEqual <uint>(0, getNormalMailMessageContent.ReturnValue, "Getting mail message operation should succeed.");
            if (getNormalMailMessageContent.RowData.Count > 0)
            {
                for (int i = 0; i < propertyTagList.Length; i++)
                {
                    if (propertyTagList[i].PropertyId == (ushort)propertyName)
                    {
                        isExpectedPropertyInPropertyList = true;
                        for (int j = 0; j < getNormalMailMessageContent.RowData.PropertyRows.Count; j++)
                        {
                            string propertyValue = AdapterHelper.PropertyValueConvertToString(getNormalMailMessageContent.RowData.PropertyRows[j].PropertyValues[i].Value);
                            Site.Log.Add(LogEntryKind.Debug, "The value of the {0} property of the No.{1} message is : {2}", propertyName.ToString(), j + 1, propertyValue);
                            if (propertyValue.Contains(unexpectedPropertyValue))
                            {
                                doesUnexpectedMessageExist = true;
                                return(doesUnexpectedMessageExist);
                            }
                        }
                    }
                }

                Site.Assert.IsTrue(isExpectedPropertyInPropertyList, "The property {0} to be checked should be included in the property list.", propertyName.ToString());
            }

            return(doesUnexpectedMessageExist);
        }
Example #5
0
        public void MSOXORULE_S04_TC01_AddModifyDeleteStandardRule_OnPublicFolder()
        {
            this.CheckMAPIHTTPTransportSupported();

            #region TestUser1 logs on to the public folder.
            RopOpenFolderResponse openFolderResponse;
            RopLogonResponse      logonResponse;
            bool ret = this.OxoruleAdapter.Connect(ConnectionType.PublicFolderServer, this.User1Name, this.User1ESSDN, this.User1Password);
            Site.Assert.IsTrue(ret, "connect to public folder server should be successful");
            uint publicFolderLogonHandler = this.OxoruleAdapter.RopLogon(LogonType.PublicFolder, this.User1ESSDN, out logonResponse);

            // Assert the client to log on to the public folder successfully.
            Site.Assert.AreEqual <uint>(0, logonResponse.ReturnValue, "Logon the public folder should be successful.");

            // Folder index 1 is the Interpersonal Messages subtree, and this is defined in MS-OXCSTOR.
            uint publicfolderHandler = this.OxoruleAdapter.RopOpenFolder(publicFolderLogonHandler, logonResponse.FolderIds[1], out openFolderResponse);

            // Get the store object's entry ID.
            this.GetStoreObjectEntryID(StoreObjectType.PublicFolder, this.Server, this.User1ESSDN);

            RopCreateFolderResponse createFolderResponse;
            string newFolderName   = Common.GenerateResourceName(this.Site, Constants.FolderDisplayName);
            uint   newFolderHandle = this.OxoruleAdapter.RopCreateFolder(publicfolderHandler, newFolderName, Constants.FolderComment, out createFolderResponse);
            Site.Assert.AreEqual <uint>(0, createFolderResponse.ReturnValue, "Creating folder operation should succeed.");
            #endregion

            #region TestUser1 prepares value for rule properties variable.
            RuleProperties ruleProperties = AdapterHelper.GenerateRuleProperties(this.Site, Constants.RuleNameDelete);
            RuleData       ruleForDelete  = AdapterHelper.GenerateValidRuleData(ActionType.OP_DELETE, TestRuleDataType.ForAdd, 1, RuleState.ST_ENABLED, new DeleteMarkReadActionData(), ruleProperties, null);
            #endregion

            #region TestUser1 adds rule OP_Delelte.
            RopModifyRulesResponse modifyRulesResponse = this.OxoruleAdapter.RopModifyRules(newFolderHandle, ModifyRuleFlag.Modify_ReplaceAll, new RuleData[] { ruleForDelete });
            Site.Assert.AreEqual <uint>(0, modifyRulesResponse.ReturnValue, "Adding Delete rule should succeed.");
            #endregion

            #region TestUser1 gets rule ID of the created rule.
            RopGetRulesTableResponse ropGetRulesTableResponse;
            uint ruleTableHandle = this.OxoruleAdapter.RopGetRulesTable(newFolderHandle, TableFlags.Normal, out ropGetRulesTableResponse);
            Site.Assert.AreEqual <uint>(0, ropGetRulesTableResponse.ReturnValue, "Getting rule table should succeed.");

            PropertyTag ruleIDTag = new PropertyTag
            {
                PropertyId   = (ushort)PropertyId.PidTagRuleId,
                PropertyType = (ushort)PropertyType.PtypInteger64
            };
            RopQueryRowsResponse queryRowsResponse = this.OxoruleAdapter.QueryPropertiesInTable(ruleTableHandle, new PropertyTag[1] {
                ruleIDTag
            });
            Site.Assert.AreEqual <uint>(0, queryRowsResponse.ReturnValue, "Retrieving rows from the rule table should succeed.");

            // Only one rule added in this folder, so the row count in the rule table should be 1.
            Site.Assert.AreEqual <uint>(1, queryRowsResponse.RowCount, "The rule number in the rule table is {0}", queryRowsResponse.RowCount);
            this.VerifyRuleTable();
            ulong ruleId = BitConverter.ToUInt64(queryRowsResponse.RowData.PropertyRows[0].PropertyValues[0].Value, 0);
            #endregion

            #region TestUser1 modifies the created rule.
            ruleProperties.Name = Common.GenerateResourceName(this.Site, "RuleNameForModify");
            ruleForDelete       = AdapterHelper.GenerateValidRuleData(ActionType.OP_DELETE, TestRuleDataType.ForModify, 1, RuleState.ST_ENABLED, new DeleteMarkReadActionData(), ruleProperties, ruleId);
            modifyRulesResponse = this.OxoruleAdapter.RopModifyRules(newFolderHandle, ModifyRuleFlag.Modify_OnExisting, new RuleData[] { ruleForDelete });
            Site.Assert.AreEqual <uint>(0, modifyRulesResponse.ReturnValue, "Modifying the OP_DELETE rule should be success");
            #endregion

            #region TestUser1 calls RopGetRulesTable with valid TableFlags.
            ruleTableHandle = this.OxoruleAdapter.RopGetRulesTable(newFolderHandle, TableFlags.Normal, out ropGetRulesTableResponse);
            #endregion

            #region TestUser1 retrieves rule information for the modified rule.

            PropertyTag ruleNameTag = new PropertyTag {
                PropertyId = (ushort)PropertyId.PidTagRuleName, PropertyType = (ushort)PropertyType.PtypString
            };

            // Retrieves rows from the rule table.
            queryRowsResponse = this.OxoruleAdapter.QueryPropertiesInTable(ruleTableHandle, new PropertyTag[2] {
                ruleIDTag, ruleNameTag
            });
            Site.Assert.AreEqual <uint>(0, queryRowsResponse.ReturnValue, "Retrieving rows from the rule table should succeed.");

            // Only one rule added in this folder, so the row count in the rule table should be 1.
            Site.Assert.AreEqual <uint>(1, queryRowsResponse.RowCount, "The rule number in the rule table is {0}", queryRowsResponse.RowCount);
            this.VerifyRuleTable();

            ulong ruleIdModified = BitConverter.ToUInt64(queryRowsResponse.RowData.PropertyRows[0].PropertyValues[0].Value, 0);
            bool  isSameRuleId   = ruleId == ruleIdModified;
            Site.Assert.IsTrue(isSameRuleId, "The original rule Id is {0} and the modified rule Id is {1}", ruleId, ruleIdModified);

            string modifiedRuleName = AdapterHelper.PropertyValueConvertToString(queryRowsResponse.RowData.PropertyRows.ToArray()[0].PropertyValues[1].Value);
            Site.Assert.AreEqual <string>(ruleProperties.Name, modifiedRuleName, "The actual rule name {0} should be equal to the expected rule name {1}.", modifiedRuleName, ruleProperties.Name);
            #endregion

            #region TestUser1 deletes the created rule.
            ruleForDelete       = AdapterHelper.GenerateValidRuleData(ActionType.OP_DELETE, TestRuleDataType.ForRemove, 1, RuleState.ST_ENABLED, null, ruleProperties, ruleId);
            modifyRulesResponse = this.OxoruleAdapter.RopModifyRules(newFolderHandle, ModifyRuleFlag.Modify_OnExisting, new RuleData[] { ruleForDelete });
            Site.Assert.AreEqual <uint>(0, modifyRulesResponse.ReturnValue, "Deleting the OP_DELETE rule should succeed.");

            RopDeleteFolderResponse deleteFolder = this.OxoruleAdapter.RopDeleteFolder(publicfolderHandler, createFolderResponse.FolderId);
            Site.Assert.AreEqual <uint>(0, deleteFolder.ReturnValue, "Deleting folder should succeed.");
            #endregion
        }
Example #6
0
        public void MSOXORULE_S04_TC03_ServerExecuteRule_Action_OP_TAG_OnPublicFolder()
        {
            this.CheckMAPIHTTPTransportSupported();

            #region TestUser1 logs on to the public folder.
            RopOpenFolderResponse openFolderResponse;
            RopLogonResponse      logonResponse;
            bool ret = this.OxoruleAdapter.Connect(ConnectionType.PublicFolderServer, this.User1Name, this.User1ESSDN, this.User1Password);
            Site.Assert.IsTrue(ret, "connect to public folder server should be successful");
            uint publicFolderLogonHandler = this.OxoruleAdapter.RopLogon(LogonType.PublicFolder, this.User1ESSDN, out logonResponse);

            // Assert the client to log on to the public folder successfully.
            Site.Assert.AreEqual <uint>(0, logonResponse.ReturnValue, "Logon the public folder should be successful.");

            // Folder index 1 is the Interpersonal Messages subtree, and this is defined in MS-OXCSTOR.
            uint publicfolderHandler = this.OxoruleAdapter.RopOpenFolder(publicFolderLogonHandler, logonResponse.FolderIds[1], out openFolderResponse);

            // Get the store object's entry ID.
            this.GetStoreObjectEntryID(StoreObjectType.PublicFolder, this.Server, this.User1ESSDN);

            RopCreateFolderResponse createFolderResponse;
            string newFolderName   = Common.GenerateResourceName(this.Site, Constants.FolderDisplayName);
            uint   newFolderHandle = this.OxoruleAdapter.RopCreateFolder(publicfolderHandler, newFolderName, Constants.FolderComment, out createFolderResponse);
            ulong  newFolderID     = createFolderResponse.FolderId;
            Site.Assert.AreEqual <uint>(0, createFolderResponse.ReturnValue, "Creating folder operation should succeed.");
            #endregion

            #region TestUser1 prepares value for ruleProperties variable.
            RuleProperties ruleProperties = AdapterHelper.GenerateRuleProperties(this.Site, Constants.RuleNameTag);
            #endregion

            #region TestUser1 adds an OP_TAG rule to the new created folder.
            TagActionData tagActionData            = new TagActionData();
            PropertyTag   tagActionDataPropertyTag = new PropertyTag
            {
                PropertyId   = (ushort)PropertyId.PidTagImportance,
                PropertyType = (ushort)PropertyType.PtypInteger32
            };
            tagActionData.PropertyTag   = tagActionDataPropertyTag;
            tagActionData.PropertyValue = BitConverter.GetBytes(1);

            RuleData ruleOpTag = AdapterHelper.GenerateValidRuleData(ActionType.OP_TAG, TestRuleDataType.ForAdd, 1, RuleState.ST_ENABLED, tagActionData, ruleProperties, null);
            RopModifyRulesResponse modifyRulesResponse = this.OxoruleAdapter.RopModifyRules(newFolderHandle, ModifyRuleFlag.Modify_ReplaceAll, new RuleData[] { ruleOpTag });
            Site.Assert.AreEqual <uint>(0, modifyRulesResponse.ReturnValue, "Adding OP_TAG rule should succeed.");
            #endregion

            #region TestUser1 creates a message.
            RopCreateMessageResponse ropCreateMessageResponse;
            uint messageHandle = this.OxoruleAdapter.RopCreateMessage(newFolderHandle, newFolderID, Convert.ToByte(false), out ropCreateMessageResponse);
            Site.Assert.AreEqual <uint>(0, ropCreateMessageResponse.ReturnValue, "Creating message should succeed.");
            #endregion

            #region TestUser1 saves the subject property of the message to trigger the rule.
            string subjectName = Common.GenerateResourceName(this.Site, ruleProperties.ConditionSubjectName + "Title");
            TaggedPropertyValue subjectProperty          = new TaggedPropertyValue();
            PropertyTag         pidTagSubjectPropertyTag = new PropertyTag
            {
                PropertyId   = (ushort)PropertyId.PidTagSubject,
                PropertyType = (ushort)PropertyType.PtypString
            };
            subjectProperty.PropertyTag = pidTagSubjectPropertyTag;
            subjectProperty.Value       = Encoding.Unicode.GetBytes(subjectName + "\0");

            // Set properties for the created message to trigger the rule.
            RopSetPropertiesResponse ropSetPropertiesResponse = this.OxoruleAdapter.RopSetProperties(messageHandle, new TaggedPropertyValue[] { subjectProperty });
            Site.Assert.AreEqual <uint>(0, ropSetPropertiesResponse.ReturnValue, "Setting property for the created message should succeed.");

            // Save changes of message.
            RopSaveChangesMessageResponse ropSaveChangesMessagResponse = this.OxoruleAdapter.RopSaveChangesMessage(messageHandle);
            Site.Assert.AreEqual <uint>(0, ropSaveChangesMessagResponse.ReturnValue, "Saving the created message should succeed.");

            // Wait for the message to be saved and the rule to take effect.
            Thread.Sleep(this.WaitForTheRuleToTakeEffect);
            #endregion

            #region TestUser1 gets the message and its properties to verify the rule evaluation.
            PropertyTag[] propertyTagList = new PropertyTag[2];
            propertyTagList[0].PropertyId   = (ushort)PropertyId.PidTagImportance;
            propertyTagList[0].PropertyType = (ushort)PropertyType.PtypInteger32;
            propertyTagList[1].PropertyId   = (ushort)PropertyId.PidTagSubject;
            propertyTagList[1].PropertyType = (ushort)PropertyType.PtypString;

            uint contentTableHandle = 0;
            uint rowCount           = 0;
            RopQueryRowsResponse getMailMessageContent = this.GetExpectedMessage(newFolderHandle, ref contentTableHandle, propertyTagList, ref rowCount, 1, subjectName);
            Site.Assert.AreEqual <uint>(1, rowCount, @"The message number in the specific folder should be 1.");
            Site.Assert.AreEqual <int>(1, BitConverter.ToInt32(getMailMessageContent.RowData.PropertyRows[(int)rowCount - 1].PropertyValues[0].Value, 0), "If the rule is executed, the PidTagImportance property of the message should be the value set by the rule.");

            RopDeleteFolderResponse deleteFolder = this.OxoruleAdapter.RopDeleteFolder(publicfolderHandler, newFolderID);
            Site.Assert.AreEqual <uint>(0, deleteFolder.ReturnValue, "Deleting folder should succeed.");
            #endregion
        }
        public void MSOXCROPS_S08_TC01_TestRopGetAndModifyPermissions()
        {
            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: Preparations-Open folder and create a subfolder, then get it's handle.
            #region Common operations

            RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle);
            uint             folderHandle  = GetFolderObjectHandle(ref logonResponse);

            #endregion

            // Step 2: Construct RopGetPermissionsTable request.
            #region RopGetPermissionsTable request

            RopGetPermissionsTableRequest getPermissionsTableRequest;

            getPermissionsTableRequest.RopId = (byte)RopId.RopGetPermissionsTable;

            getPermissionsTableRequest.LogonId           = TestSuiteBase.LogonId;
            getPermissionsTableRequest.InputHandleIndex  = TestSuiteBase.InputHandleIndex0;
            getPermissionsTableRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
            getPermissionsTableRequest.TableFlags        = (byte)PermTableFlags.IncludeFreeBusy;

            #endregion

            // Step 3: Construct RopSetColumns request.
            #region RopSetColumns request

            // Call CreatePermissionPropertyTags method to create Permission PropertyTags.
            PropertyTag[]        propertyTags = this.CreatePermissionPropertyTags();
            RopSetColumnsRequest setColumnsRequest;

            setColumnsRequest.RopId            = (byte)RopId.RopSetColumns;
            setColumnsRequest.LogonId          = TestSuiteBase.LogonId;
            setColumnsRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1;
            setColumnsRequest.PropertyTagCount = (ushort)propertyTags.Length;
            setColumnsRequest.PropertyTags     = propertyTags;
            setColumnsRequest.SetColumnsFlags  = (byte)AsynchronousFlags.None;

            #endregion

            // Step 4: Construct RopQueryRows request.
            #region RopQueryRows request

            RopQueryRowsRequest queryRowsRequest;

            queryRowsRequest.RopId            = (byte)RopId.RopQueryRows;
            queryRowsRequest.LogonId          = TestSuiteBase.LogonId;
            queryRowsRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex1;
            queryRowsRequest.QueryRowsFlags   = (byte)QueryRowsFlags.Advance;

            // TRUE: read the table forwards.
            queryRowsRequest.ForwardRead = TestSuiteBase.NonZero;

            // Maximum number of rows to be returned
            queryRowsRequest.RowCount = TestSuiteBase.RowCount;

            #endregion

            // Step 5: Send the Multiple ROPs request and verify the success response.
            #region Multiple ROPs

            List <ISerializable>   requests     = new List <ISerializable>();
            List <IDeserializable> ropResponses = new List <IDeserializable>();
            List <uint>            handleList   = new List <uint>
            {
                folderHandle,
                TestSuiteBase.DefaultFolderHandle
            };
            requests.Add(getPermissionsTableRequest);
            requests.Add(setColumnsRequest);
            requests.Add(queryRowsRequest);

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 5: Begin to send the Multiple ROPs request.");

            // Send the Multiple ROPs request and verify the success response.
            this.responseSOHs = cropsAdapter.ProcessMutipleRops(
                requests,
                handleList,
                ref ropResponses,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            RopGetPermissionsTableResponse getPermissionsTableResponse = (RopGetPermissionsTableResponse)ropResponses[0];
            RopSetColumnsResponse          setColumnsResponse          = (RopSetColumnsResponse)ropResponses[1];
            RopQueryRowsResponse           queryRowsResponse           = (RopQueryRowsResponse)ropResponses[2];

            // Send the RopModifyPermissions request and verify response.
            #region RopModifyPermissions request

            RopModifyPermissionsRequest modifyPermissionsRequest;
            PermissionData[]            permissionsDataArray = this.GetPermissionDataArray();

            modifyPermissionsRequest.RopId            = (byte)RopId.RopModifyPermissions;
            modifyPermissionsRequest.LogonId          = TestSuiteBase.LogonId;
            modifyPermissionsRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
            modifyPermissionsRequest.ModifyFlags      = (byte)ModifyFlags.IncludeFreeBusy;
            modifyPermissionsRequest.ModifyCount      = (ushort)permissionsDataArray.Length;
            modifyPermissionsRequest.PermissionsData  = permissionsDataArray;

            // Add the debug information
            Site.Log.Add(LogEntryKind.Debug, "Step 5: Begin to send the RopModifyPermissions request.");

            this.responseSOHs = cropsAdapter.ProcessSingleRop(
                modifyPermissionsRequest,
                folderHandle,
                ref this.response,
                ref this.rawData,
                RopResponseType.SuccessResponse);
            RopModifyPermissionsResponse modifyPermissionsResponse = (RopModifyPermissionsResponse)response;

            #endregion

            bool isRopsSuccess = (getPermissionsTableResponse.ReturnValue == TestSuiteBase.SuccessReturnValue) &&
                                 (setColumnsResponse.ReturnValue == TestSuiteBase.SuccessReturnValue) &&
                                 (queryRowsResponse.ReturnValue == TestSuiteBase.SuccessReturnValue) &&
                                 (modifyPermissionsResponse.ReturnValue == TestSuiteBase.SuccessReturnValue);
            Site.Assert.IsTrue(isRopsSuccess, "If ROP succeeds, the ReturnValue of its response is 0 (success)");

            #endregion
        }