コード例 #1
0
        /// <summary>
        /// This ROP commits the changes made to a message.
        /// </summary>
        /// <param name="handle">The handle to operate.</param>
        /// <param name="needVerify">Whether need to verify the response.</param>
        /// <returns>The response of this ROP.</returns>
        private RopSaveChangesMessageResponse RopSaveChangesMessage(uint handle, bool needVerify)
        {
            this.rawDataValue      = null;
            this.responseValue     = null;
            this.responseSOHsValue = null;

            RopSaveChangesMessageRequest saveChangesMessageRequest = new RopSaveChangesMessageRequest()
            {
                RopId               = (byte)RopId.RopSaveChangesMessage,
                LogonId             = LogonId,
                InputHandleIndex    = (byte)HandleIndex.FirstIndex,
                ResponseHandleIndex = (byte)HandleIndex.SecondIndex,

                // Set the SaveFlags flag to ForceSave, which indicates the client requests server to commit the changes.
                SaveFlags = (byte)SaveFlags.ForceSave,
            };

            this.responseSOHsValue = this.ProcessSingleRop(saveChangesMessageRequest, handle, ref this.responseValue, ref this.rawDataValue, RopResponseType.SuccessResponse);
            RopSaveChangesMessageResponse saveChangesMessageResponse = (RopSaveChangesMessageResponse)this.responseValue;

            if (needVerify)
            {
                this.Site.Assert.AreEqual((uint)RopResponseType.SuccessResponse, saveChangesMessageResponse.ReturnValue, string.Format("RopSaveChangesMessage Failed! Error: 0x{0:X8}", saveChangesMessageResponse.ReturnValue));
            }

            return(saveChangesMessageResponse);
        }
コード例 #2
0
        public void MSOXCMSG_S06_TC02_RopReloadCachedInformationFailure()
        {
            this.CheckMapiHttpIsSupported();
            this.ConnectToServer(ConnectionType.PrivateMailboxServer);

            #region Call RopLogon to log on a private mailbox.
            RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out this.insideObjHandle);
            #endregion

            #region Call RopCreateMessage to create a new message object.
            uint targetMessageHandle = this.CreatedMessage(logonResponse.FolderIds[4], this.insideObjHandle);
            #endregion

            #region Call RopSaveChangesMessage to commit the new message object.
            RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave);
            Site.Assert.AreEqual <uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg);
            ulong messageId = saveChangesMessageResponse.MessageId;
            #endregion

            this.ReleaseRop(targetMessageHandle);

            #region Call RopOpenMessage to open the created message.
            RopOpenMessageResponse openMessageResponse;
            uint openedMessageHandle = this.OpenSpecificMessage(logonResponse.FolderIds[4], messageId, this.insideObjHandle, MessageOpenModeFlags.ReadWrite, out openMessageResponse);
            #endregion

            #region Call RopReloadCachedInformation which contains an InputHandleIndex that does not refer to a message object.
            RopReloadCachedInformationRequest reloadCachedInformationRequest = new RopReloadCachedInformationRequest()
            {
                RopId            = (byte)RopId.RopReloadCachedInformation,
                LogonId          = CommonLogonId,
                InputHandleIndex = CommonInputHandleIndex,
                Reserved         = 0x0000
            };
            this.response     = new RopReloadCachedInformationResponse();
            this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(reloadCachedInformationRequest, TestSuiteBase.InvalidInputHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);
            RopReloadCachedInformationResponse reloadCachedInformationResponse = (RopReloadCachedInformationResponse)this.response;

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1498");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R1498
            this.Site.CaptureRequirementIfAreEqual <uint>(
                0x000004b9,
                reloadCachedInformationResponse.ReturnValue,
                1498,
                @"[In Receiving a RopReloadCachedInformation ROP Request] [ecNullObject (0x000004b9)] means the value of the InputHandleIndex field on which this ROP [RopReloadCachedInformation] was called does not refer to a Message object.");
            #endregion

            #region Call RopRelease to release all resources
            this.ReleaseRop(openedMessageHandle);
            #endregion
        }
コード例 #3
0
        /// <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;
        }
コード例 #4
0
        public void MSOXCMSG_S02_TC01_SetAndGetMessageStatus()
        {
            this.CheckMapiHttpIsSupported();
            this.ConnectToServer(ConnectionType.PrivateMailboxServer);

            List <PropertyTag> propertyTags = new List <PropertyTag>
            {
                PropertyHelper.PropertyTagDic[PropertyNames.PidTagMessageStatus],
                PropertyHelper.PropertyTagDic[PropertyNames.PidTagChangeKey],
                PropertyHelper.PropertyTagDic[PropertyNames.PidTagLastModificationTime]
            };

            #region Call RopLogon to logon the private mailbox.
            RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out this.insideObjHandle);
            #endregion

            #region Call RopCreateMessage to create a new message object.
            uint targetMessageHandle = this.CreatedMessage(logonResponse.FolderIds[4], this.insideObjHandle);
            #endregion

            #region Call RopSaveChangesMessage to commit the new message object.
            RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave);
            Site.Assert.AreEqual <uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg);
            #endregion

            #region Call RopRelease to release all resources.
            this.ReleaseRop(targetMessageHandle);
            #endregion

            #region Call RopOpenFolder to open the inbox folder.
            uint folderHandle = this.OpenSpecificFolder(logonResponse.FolderIds[4], this.insideObjHandle);
            #endregion

            #region Call RopGetPropertiesSpecific to get the PidTagMessageStatus,PidTagChangeKey and PidTagLastModificationTime property before set MessagStatus.
            List <PropertyObj> ps = this.GetSpecificPropertiesOfMessage(logonResponse.FolderIds[4], saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags);
            PropertyObj        pidTagMessageStatusBeforeSet        = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageStatus);
            PropertyObj        pidTagChangeKeyBeforeSet            = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagChangeKey);
            PropertyObj        pidTagLastModificationTimeBeforeSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagLastModificationTime);
            #endregion

            #region Call RopSetMessageStatus to set the MessageStatusFlags property of specific message to 0x00001000.
            RopSetMessageStatusRequest setMessageStatusRequest = new RopSetMessageStatusRequest()
            {
                RopId              = (byte)RopId.RopSetMessageStatus,
                LogonId            = CommonLogonId,
                InputHandleIndex   = CommonInputHandleIndex,
                MessageId          = saveChangesMessageResponse.MessageId,
                MessageStatusFlags = (uint)MessageStatusFlags.MsRemoteDownload,
                MessageStatusMask  = (uint)MessageStatusFlags.MsInConflict | (uint)MessageStatusFlags.MsRemoteDownload | (uint)MessageStatusFlags.MsRemoteDelete
            };
            this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageStatusRequest, folderHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);
            RopSetMessageStatusResponse setMessageStatusResponse = (RopSetMessageStatusResponse)this.response;

            #region Verify MS-OXCMSG_R773 and MS-OXCMSG_R549
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R773");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R773
            this.Site.CaptureRequirementIfAreEqual <uint>(
                TestSuiteBase.Success,
                setMessageStatusResponse.ReturnValue,
                773,
                @"[In RopSetMessageStatus ROP] The RopSetMessageStatus ROP ([MS-OXCROPS] section 2.2.6.8) sets the PidTagMessageStatus property ([MS-OXPROPS] section 2.787) on a message in a folder without the need to open or save the Message object.");

            // Because the MS-OXCMSG_R773 has been captured and verify that the RopSetMessthatageStatus ROP sets the PidTagMessageStatus property.
            // So MS-OXCMSG_R549 can be captured directly.
            this.Site.CaptureRequirement(
                549,
                @"[In Sending a RopSetProperties ROP Request] Instead, the client calls the RopSetMessageStatus ROP ([MS-OXCROPS] section 2.2.6.8), as specified in section 2.2.3.8.");
            #endregion
            #endregion

            #region Call RopGetMessageStatus to get the message status of specific message created step 2.
            RopGetMessageStatusRequest getMessageStatusRequest = new RopGetMessageStatusRequest()
            {
                RopId            = (byte)RopId.RopGetMessageStatus,
                LogonId          = CommonLogonId,
                InputHandleIndex = CommonInputHandleIndex,
                MessageId        = saveChangesMessageResponse.MessageId
            };
            this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getMessageStatusRequest, folderHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);

            // The response buffers for RopGetMessageStatus are the same as those for RopSetMessageStatus.
            RopSetMessageStatusResponse getMessageStatusRespnse = (RopSetMessageStatusResponse)this.response;

            #region MS-OXCMSG_R786, MS-OXCMSG_R2028, MS-OXCMSG_R421
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R786, the MessageStatusFlags is {0}.", getMessageStatusRespnse.MessageStatusFlags);

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R786
            bool isVerifiedR786 = getMessageStatusRespnse.ReturnValue == TestSuiteBase.Success && getMessageStatusRespnse.MessageStatusFlags == 0x00001000;

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR786,
                786,
                @"[In RopGetMessageStatus ROP] The RopGetMessageStatus ROP ([MS-OXCROPS] section 2.2.6.9) gets the message status of a message in a folder.");

            // Because the MS-OXCMSG_R786 has been captured and verify that the RopGetMessageStatus gets the message status of a message.
            // So OXCMSG_R55 can be captured directly.
            this.Site.CaptureRequirement(
                55,
                @"[In Sending a RopGetPropertiesSpecific ROP Request] Instead, the client calls the RopGetMessageStatus ROP ([MS-OXCROPS] section 2.2.6.9), as specified in section 2.2.3.9.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R2028");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R2028
            this.Site.CaptureRequirementIfAreEqual <uint>(
                0x00001000,
                getMessageStatusRespnse.MessageStatusFlags,
                2028,
                @"[In PidTagMessageStatus Property] [The value of flag msRemoteDownload is] 0x00001000.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R421");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R421
            // Because the message handle has been release in above step.
            // If RopGetMessageStatus execute successfully then R421 will be verified.
            this.Site.CaptureRequirementIfAreEqual <uint>(
                TestSuiteBase.Success,
                getMessageStatusRespnse.ReturnValue,
                421,
                @"[In Receiving a RopGetMessageStatus ROP Request] When processing the RopGetMessageStatus ROP ([MS-OXCROPS] section 2.2.6.9), the server MUST NOT require the Message object to be opened.");
            #endregion
            #endregion

            #region Call RopGetPropertiesSpecific to get the PidTagMessageStatus,PidTagChangeKey and PidTagLastModificationTime property after set MessagStatus.
            ps = this.GetSpecificPropertiesOfMessage(logonResponse.FolderIds[4], saveChangesMessageResponse.MessageId, this.insideObjHandle, propertyTags);
            PropertyObj pidTagMessageStatusAfterSet        = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagMessageStatus);
            PropertyObj pidTagChangeKeyAfterSet            = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagChangeKey);
            PropertyObj pidTagLastModificationTimeAfterSet = PropertyHelper.GetPropertyByName(ps, PropertyNames.PidTagLastModificationTime);

            #region Verify MS-OXCMSG_R1501
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1501");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R1501
            bool isVerifiedR1501 =
                Common.CompareByteArray((byte[])pidTagChangeKeyBeforeSet.Value, (byte[])pidTagChangeKeyAfterSet.Value) == true &&
                pidTagLastModificationTimeBeforeSet.Value.Equals(pidTagLastModificationTimeAfterSet.Value) &&
                pidTagMessageStatusBeforeSet.Value != pidTagMessageStatusAfterSet.Value;

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR1501,
                1501,
                @"[In Receiving a RopSetMessageStatus ROP Request] The server immediately commits the changes to the Message object as if the Message object had been opened and the RopSaveChangesMessage ROP ([MS-OXCROPS] section 2.2.6.3) had been called, except that it [server] changes only the PidTagMessageStatus property, not the PidTagChangeKey property ([MS-OXCFXICS] section 2.2.1.2.7), the PidTagLastModificationTime property (section 2.2.2.2), or any other property that is modified during the RopSaveChangesMessage ROP request.");
            #endregion
            #endregion

            #region Call RopSetMessageStatus to set the MessageStatusFlags property of specific message to 0x00000800.
            setMessageStatusRequest = new RopSetMessageStatusRequest()
            {
                RopId              = (byte)RopId.RopSetMessageStatus,
                LogonId            = CommonLogonId,
                InputHandleIndex   = CommonInputHandleIndex,
                MessageId          = saveChangesMessageResponse.MessageId,
                MessageStatusFlags = (uint)MessageStatusFlags.MsInConflict,
                MessageStatusMask  = (uint)MessageStatusFlags.MsInConflict | (uint)MessageStatusFlags.MsRemoteDownload | (uint)MessageStatusFlags.MsRemoteDelete
            };
            this.ResponseSOHs        = this.MSOXCMSGAdapter.DoRopCall(setMessageStatusRequest, folderHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);
            setMessageStatusResponse = (RopSetMessageStatusResponse)this.response;
            Site.Assert.AreEqual <uint>(TestSuiteBase.Success, setMessageStatusResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg);

            #region Verify MS-OXCMSG_R784
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R784");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R784
            this.Site.CaptureRequirementIfAreEqual <uint>(
                getMessageStatusRespnse.MessageStatusFlags,
                setMessageStatusResponse.MessageStatusFlags,
                784,
                @"[In RopSetMessageStatus ROP Response Buffer] MessageStatusFlags: 4 bytes indicating the status flags that were set on the Message object before processing this request.");
            #endregion
            #endregion

            #region Call RopGetMessageStatus to get the message status of specific message created step 2.
            // RopGetMessageStatusResponse getMessageStatusResponse;
            getMessageStatusRequest.MessageId = saveChangesMessageResponse.MessageId;
            this.ResponseSOHs       = this.MSOXCMSGAdapter.DoRopCall(getMessageStatusRequest, folderHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);
            getMessageStatusRespnse = (RopSetMessageStatusResponse)this.response;
            Site.Assert.AreEqual <uint>(TestSuiteBase.Success, setMessageStatusResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg);

            #region Verify requirements
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R2029");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R2029
            this.Site.CaptureRequirementIfAreEqual <uint>(
                0x00000800,
                getMessageStatusRespnse.MessageStatusFlags,
                2029,
                @"[In PidTagMessageStatus Property] [The value of flag msInConflict is] 0x00000800.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R416, the MessageStatusFlags value is {0}.", setMessageStatusResponse.MessageStatusFlags);

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R416
            bool isVerifiedR416 = getMessageStatusRespnse.MessageStatusFlags == (setMessageStatusRequest.MessageStatusMask & setMessageStatusRequest.MessageStatusFlags);

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR416,
                416,
                @"[In Receiving a RopSetMessageStatus ROP Request] When processing the RopSetMessageStatus ROP ([MS-OXCROPS] section 2.2.6.8), the server modifies the bits on the PidTagMessageStatus property (section 2.2.1.8) specified by the MessageStatusMask field, preserving only those flags that are set in both the MessageStatusMask field and the MessageStatusFlags field, and clearing any other flags set only in the MessageStatusMask field.");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1500");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R1500
            bool isVerifiedR1500 = (getMessageStatusRespnse.MessageStatusFlags & (~setMessageStatusRequest.MessageStatusFlags & setMessageStatusRequest.MessageStatusMask)) == 0x00000000;

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR1500,
                1500,
                @"[In Receiving a RopSetMessageStatus ROP Request] [When processing the RopSetMessageStatus ROP, the server] clearing any other flags set only in the MessageStatusMask field.");
            #endregion
            #endregion

            #region Call RopSetMessageStatus to set the MessageStatusFlags property of specific message to 0x00002000.
            setMessageStatusRequest = new RopSetMessageStatusRequest()
            {
                RopId              = (byte)RopId.RopSetMessageStatus,
                LogonId            = CommonLogonId,
                InputHandleIndex   = CommonInputHandleIndex,
                MessageId          = saveChangesMessageResponse.MessageId,
                MessageStatusFlags = (uint)MessageStatusFlags.MsRemoteDelete,
                MessageStatusMask  = (uint)MessageStatusFlags.MsInConflict | (uint)MessageStatusFlags.MsRemoteDownload | (uint)MessageStatusFlags.MsRemoteDelete
            };
            this.ResponseSOHs        = this.MSOXCMSGAdapter.DoRopCall(setMessageStatusRequest, folderHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);
            setMessageStatusResponse = (RopSetMessageStatusResponse)this.response;
            Site.Assert.AreEqual <uint>(TestSuiteBase.Success, setMessageStatusResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg);
            #endregion

            #region Call RopGetMessageStatus get the message status of specific message created step 2.
            getMessageStatusRequest.MessageId = saveChangesMessageResponse.MessageId;
            this.ResponseSOHs       = this.MSOXCMSGAdapter.DoRopCall(getMessageStatusRequest, folderHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);
            getMessageStatusRespnse = (RopSetMessageStatusResponse)this.response;
            Site.Assert.AreEqual <uint>(TestSuiteBase.Success, setMessageStatusResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg);

            #region MS-MS-OXCMSG_R2030
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R2030");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R2030
            this.Site.CaptureRequirementIfAreEqual <uint>(
                0x00002000,
                getMessageStatusRespnse.MessageStatusFlags,
                2030,
                @"[In PidTagMessageStatus Property] [The value of flag msRemoteDelete is] 0x00002000.");
            #endregion
            #endregion
        }
コード例 #5
0
        public void MSOXCMSG_S02_TC02_ErrorCodeOfMessageStatus()
        {
            this.CheckMapiHttpIsSupported();
            this.ConnectToServer(ConnectionType.PrivateMailboxServer);

            #region Call RopLogon to logon the private mailbox.
            RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out this.insideObjHandle);
            #endregion

            #region Call RopCreateMessage to create a Message object.
            uint targetMessageHandle = this.CreatedMessage(logonResponse.FolderIds[4], this.insideObjHandle);
            #endregion

            #region Call RopSaveChangesMessage to save created message.
            RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave);
            Site.Assert.AreEqual <uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg);
            #endregion

            #region Call RopOpenFolder to open the inbox folder.
            uint folderHandle = this.OpenSpecificFolder(logonResponse.FolderIds[4], this.insideObjHandle);
            #endregion

            #region Call RopSetMessageStatus to set message status. The value of the InputHandleIndex field on which this ROP was called does not refer to a Folder object.
            RopSetMessageStatusRequest setMessageStatusRequest = new RopSetMessageStatusRequest()
            {
                RopId              = (byte)RopId.RopSetMessageStatus,
                LogonId            = CommonLogonId,
                InputHandleIndex   = CommonInputHandleIndex,
                MessageId          = saveChangesMessageResponse.MessageId,
                MessageStatusFlags = (uint)MessageStatusFlags.MsRemoteDownload,
                MessageStatusMask  = (uint)MessageStatusFlags.MsRemoteDownload
            };
            this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(setMessageStatusRequest, TestSuiteBase.InvalidInputHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);
            RopSetMessageStatusResponse setMessageStatusResponse = (RopSetMessageStatusResponse)this.response;

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1505");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R1505
            this.Site.CaptureRequirementIfAreEqual <uint>(
                0x000004B9,
                setMessageStatusResponse.ReturnValue,
                1505,
                @"[In Receiving a RopSetMessageStatus ROP Request] [ecNullObject (0x000004B9)] The value of the InputHandleIndex field on which this ROP [RopSetMessageStatus] was called does not refer to a Folder object.");
            #endregion

            #region Call RopGetMessageStatus to get message status.The value of the InputHandleIndex field on which this ROP was called does not refer to a Folder object.
            RopGetMessageStatusRequest getMessageStatusRequest = new RopGetMessageStatusRequest
            {
                RopId            = (byte)RopId.RopGetMessageStatus,
                LogonId          = CommonLogonId,
                InputHandleIndex = CommonInputHandleIndex,
                MessageId        = saveChangesMessageResponse.MessageId
            };

            // RopGetMessageStatusResponse getMessageStatusResponse;
            this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(getMessageStatusRequest, TestSuiteBase.InvalidInputHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);

            // The response buffers for RopGetMessageStatus are the same as those for RopSetMessageStatus
            setMessageStatusResponse = (RopSetMessageStatusResponse)this.response;

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R1507");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R1507
            this.Site.CaptureRequirementIfAreEqual <uint>(
                0x000004B9,
                setMessageStatusResponse.ReturnValue,
                1507,
                @"[In Receiving a RopGetMessageStatus ROP Request] [ecNullObject (0x000004B9)] The value of the InputHandleIndex field on which this ROP [RopGetMessageStatus] was called does not refer to a Folder object.");
            #endregion

            #region Call RopRelease to release created message.
            this.ReleaseRop(targetMessageHandle);
            this.ReleaseRop(folderHandle);
            #endregion
        }
コード例 #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
        }
コード例 #7
0
        public void MSOXORULE_S04_TC02_AddModifyDeleteExtendedRule_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 creates an FAI message.
            RopCreateMessageResponse ropCreateMessageResponse;
            uint extendedRuleMessageHandle = this.OxoruleAdapter.RopCreateMessage(newFolderHandle, newFolderID, Convert.ToByte(true), out ropCreateMessageResponse);
            Site.Assert.AreEqual <uint>(0, ropCreateMessageResponse.ReturnValue, "Creating the first FAI message should succeed.");
            #endregion

            #region TestUser1 adds the extended rule with NamedProperty successfully.
            string            ruleConditionSubjectNameForAdd = Constants.RuleConditionSubjectContainString;
            NamedPropertyInfo namedPropertyInfo = new NamedPropertyInfo
            {
                NoOfNamedProps = 2,
                PropId         = new uint[2]
                {
                    0x8001, 0x8002
                }
            };
            PropertyName testPropertyName = new PropertyName
            {
                Guid = System.Guid.NewGuid().ToByteArray(),
                Kind = 0x01,
                Name = Encoding.Unicode.GetBytes(Constants.NameOfPropertyName + "\0")
            };

            // 0x01 means the property is identified by the name property.
            testPropertyName.NameSize = (byte)testPropertyName.Name.Length;

            PropertyName secondPropertyName = new PropertyName
            {
                Guid = System.Guid.NewGuid().ToByteArray(),
                Kind = 0x00,
                LID  = 0x88888888
            };

            // 0x00 means the property is identified by the LID.
            namedPropertyInfo.NamedProperty = new PropertyName[2] {
                testPropertyName, secondPropertyName
            };
            namedPropertyInfo.NamedPropertiesSize = (uint)(testPropertyName.Serialize().Length + secondPropertyName.Serialize().Length);
            string ruleName = Common.GenerateResourceName(this.Site, Constants.ExtendRulename1);
            TaggedPropertyValue[] extendedRulePropertiesForAdd = AdapterHelper.GenerateExtendedRuleTestData(ruleName, 0, (uint)RuleState.ST_ENABLED, Constants.PidTagRuleProvider, ActionType.OP_MARK_AS_READ, new DeleteMarkReadActionData(), ruleConditionSubjectNameForAdd, namedPropertyInfo);

            // Set properties for extended rule FAI message.
            RopSetPropertiesResponse ropSetPropertiesResponse = this.OxoruleAdapter.RopSetProperties(extendedRuleMessageHandle, extendedRulePropertiesForAdd);
            Site.Assert.AreEqual <uint>(0, ropSetPropertiesResponse.ReturnValue, "Setting property for Extended rule FAI message should succeed.");

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

            // Specify the properties to be got.
            PropertyTag[] propertyTagArray = new PropertyTag[1];

            // PidTagRuleMessageProvider
            propertyTagArray[0].PropertyId   = (ushort)PropertyId.PidTagRuleMessageProvider;
            propertyTagArray[0].PropertyType = (ushort)PropertyType.PtypString;

            // Get the specific properties of the extended rule.
            RopGetPropertiesSpecificResponse ropGetPropertiesSpecificResponse = this.OxoruleAdapter.RopGetPropertiesSpecific(extendedRuleMessageHandle, propertyTagArray);
            Site.Assert.AreEqual <uint>(0, ropGetPropertiesSpecificResponse.ReturnValue, "Getting specific properties operation should succeed.");
            string pidTagRuleMessageProviderData = AdapterHelper.PropertyValueConvertToString(ropGetPropertiesSpecificResponse.RowData.PropertyValues[0].Value);
            Site.Assert.AreEqual <string>(Constants.PidTagRuleProvider, pidTagRuleMessageProviderData, "The rule provider data should be RuleOrganizer.");
            #endregion

            #region Modify the created rule.
            ruleName = Common.GenerateResourceName(this.Site, Constants.ExtendRulename2);
            TaggedPropertyValue[] extendedRulePropertiesForModify = AdapterHelper.GenerateExtendedRuleTestData(ruleName, 0, (uint)RuleState.ST_ENABLED, Constants.PidTagRuleProvider, ActionType.OP_MARK_AS_READ, new DeleteMarkReadActionData(), ruleConditionSubjectNameForAdd, namedPropertyInfo);

            // Set properties for extended rule FAI message.
            ropSetPropertiesResponse = this.OxoruleAdapter.RopSetProperties(extendedRuleMessageHandle, extendedRulePropertiesForModify);
            Site.Assert.AreEqual <uint>(0, ropSetPropertiesResponse.ReturnValue, "Setting property for Extended rule FAI message should succeed.");

            // Save changes of message.
            ropSaveChangesMessagResponse = this.OxoruleAdapter.RopSaveChangesMessage(extendedRuleMessageHandle);
            Site.Assert.AreEqual <uint>(0, ropSaveChangesMessagResponse.ReturnValue, "Saving Extend rule message should succeed.");

            // PidTagSubject
            propertyTagArray[0].PropertyId   = (ushort)PropertyId.PidTagRuleMessageName;
            propertyTagArray[0].PropertyType = (ushort)PropertyType.PtypString;

            // Get the specific properties of the extended rule.
            ropGetPropertiesSpecificResponse = this.OxoruleAdapter.RopGetPropertiesSpecific(extendedRuleMessageHandle, propertyTagArray);
            Site.Assert.AreEqual <uint>(0, ropGetPropertiesSpecificResponse.ReturnValue, "Getting specific properties operation should succeed.");
            string messageName = AdapterHelper.PropertyValueConvertToString(ropGetPropertiesSpecificResponse.RowData.PropertyValues[0].Value);
            Site.Assert.AreEqual <string>(ruleName, messageName, "The rule subject should be {0}.", ruleName);
            #endregion

            #region Release the created message to delete the created rule.
            this.OxoruleAdapter.ReleaseRop(extendedRuleMessageHandle);

            // Get the specific properties of the extended rule.
            ropGetPropertiesSpecificResponse = this.OxoruleAdapter.RopGetPropertiesSpecific(extendedRuleMessageHandle, propertyTagArray);
            Site.Assert.IsNull(ropGetPropertiesSpecificResponse.RowData, "The property value of the extended rule should be null!");
            #endregion

            #region Delete the folder.
            RopDeleteFolderResponse deleteFolder = this.OxoruleAdapter.RopDeleteFolder(publicfolderHandler, newFolderID);
            Site.Assert.AreEqual <uint>(0, deleteFolder.ReturnValue, "Deleting folder should succeed.");
            #endregion
        }
コード例 #8
0
        public void MSOXCMSG_S06_TC01_RopReloadCachedInformation()
        {
            this.CheckMapiHttpIsSupported();
            this.ConnectToServer(ConnectionType.PrivateMailboxServer);

            #region Call RopLogon to log on a private mailbox.
            uint             logonHandle;
            RopLogonResponse logonResponse = this.Logon(LogonType.Mailbox, out logonHandle);
            #endregion

            #region Call RopCreateMessage to create a new message object.
            uint targetMessageHandle = this.CreatedMessage(logonResponse.FolderIds[4], logonHandle);
            #endregion

            #region Call RopSaveChangesMessage to commit the new message object.
            RopSaveChangesMessageResponse saveChangesMessageResponse = this.SaveMessage(targetMessageHandle, (byte)SaveFlags.ForceSave);
            Site.Assert.AreEqual <uint>(TestSuiteBase.Success, saveChangesMessageResponse.ReturnValue, TestSuiteBase.ROPSucceedMsg);
            ulong messageId = saveChangesMessageResponse.MessageId;
            #endregion

            this.ReleaseRop(targetMessageHandle);

            #region Call RopOpenMessage to open the created message.
            RopOpenMessageResponse openMessageResponse;
            uint openedMessageHandle = this.OpenSpecificMessage(logonResponse.FolderIds[4], messageId, logonHandle, MessageOpenModeFlags.ReadWrite, out openMessageResponse);
            #endregion

            #region Call RopReloadCachedInformation to get information of the specific message.
            RopReloadCachedInformationRequest reloadCachedInformationRequest = new RopReloadCachedInformationRequest()
            {
                RopId            = (byte)RopId.RopReloadCachedInformation,
                LogonId          = CommonLogonId,
                InputHandleIndex = CommonInputHandleIndex,
                Reserved         = 0x0000
            };
            this.response     = new RopReloadCachedInformationResponse();
            this.ResponseSOHs = this.MSOXCMSGAdapter.DoRopCall(reloadCachedInformationRequest, openedMessageHandle, ref this.response, ref this.rawData, GetPropertiesFlags.None);
            RopReloadCachedInformationResponse reloadCachedInformationResponse = (RopReloadCachedInformationResponse)this.response;

            #region Verify MS-OXCMSG_R279, MS-OXCMSG_R766
            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R279");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R279
            this.Site.CaptureRequirementIfAreEqual <uint>(
                TestSuiteBase.Success,
                reloadCachedInformationResponse.ReturnValue,
                279,
                @"[In Reload Message Object Header Info] A client retrieves the current state of the data returned in a RopOpenMessage ROP ([MS-OXCROPS] section 2.2.6.1) by sending a RopReloadCachedInformation ROP request ([MS-OXCROPS] section 2.2.6.7).");

            // Add the debug information
            this.Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCMSG_R766");

            // Verify MS-OXCMSG requirement: MS-OXCMSG_R766
            bool isVerifiedR766 = this.CompareResponseOfOpenMessageAndRopReloadCachedInformation(openMessageResponse, reloadCachedInformationResponse);

            this.Site.CaptureRequirementIfIsTrue(
                isVerifiedR766,
                766,
                @"[In RopReloadCachedInformation ROP] The RopReloadCachedInformation ROP ([MS-OXCROPS] section 2.2.6.7) retrieves the same information as RopOpenMessage ROP ([MS-OXCROPS] section 2.2.6.1) but operates on an already opened Message object.");
            #endregion
            #endregion

            #region Call RopRelease to release all resources
            this.ReleaseRop(openedMessageHandle);
            #endregion
        }