public void MSOXCROPS_S03_TC02_TestRopAbort()
{
this.CheckTransportIsSupported();
// Step 1: Open a folder.
#region Prepare table: Open a Folder
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));
// Log on to a private mailbox.
RopLogonResponse logonResponse = Logon(LogonType.Mailbox, this.userDN, out inputObjHandle);
// Open a folder first
RopOpenFolderRequest openFolderRequest;
RopOpenFolderResponse openFolderResponse;
openFolderRequest.RopId = (byte)RopId.RopOpenFolder;
openFolderRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x0, which specifies the location in the Server object handle table where the handle
// for the input Server object is stored.
openFolderRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Set OutputHandleIndex to 0x1, which specifies the location in the Server object handle table where the handle
// for the output Server object will be stored.
openFolderRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
// Set FolderId to the 5th folder of the logonResponse, which specifies the folder to be opened.
openFolderRequest.FolderId = logonResponse.FolderIds[4];
openFolderRequest.OpenModeFlags = (byte)FolderOpenModeFlags.None;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 1: Begin to send the RopOpenFolder request.");
// Send the RopOpenFolder request and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
openFolderRequest,
this.inputObjHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
openFolderResponse = (RopOpenFolderResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
openFolderResponse.ReturnValue,
"if ROP succeeds, the ReturnValue of its response is 0(success)");
uint openedFolderHandle = responseSOHs[0][openFolderResponse.OutputHandleIndex];
#endregion
// Step 2: Create a subfolder of the opened folder.
#region Prepare table: Create a subfolder of the opened folder
// Create a subfolder of the opened folder, which will be used as target folder in the following ROP.
RopCreateFolderRequest createFolderRequest;
RopCreateFolderResponse createFolderResponse;
createFolderRequest.RopId = (byte)RopId.RopCreateFolder;
createFolderRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x0, which specifies the location in the Server object handle table where the handle
// for the input Server object is stored.
createFolderRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Set OutputHandleIndex to 0x1, which specifies the location in the Server object handle table where the handle
// for the output Server object will be stored.
createFolderRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
createFolderRequest.FolderType = (byte)FolderType.Genericfolder;
// Set UseUnicodeStrings to 0x0(FALSE), which specifies the DisplayName and Comment are not specified in Unicode.
createFolderRequest.UseUnicodeStrings = Convert.ToByte(TestSuiteBase.Zero);
// Set OpenExisting to 0xFF(TRUE), which means the folder being created will be opened when it is already existed,
// as specified in [MS-OXCFOLD].
createFolderRequest.OpenExisting = TestSuiteBase.NonZero;
// Set Reserved to 0x0. This field is reserved and MUST be set to 0.
createFolderRequest.Reserved = TestSuiteBase.Reserved;
// Set DisplayName, which specifies the name of the created folder.
createFolderRequest.DisplayName = Encoding.ASCII.GetBytes(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0");
// Set Comment, which specifies the folder comment that is associated with the created folder.
createFolderRequest.Comment = Encoding.ASCII.GetBytes(TestSuiteBase.DisplayNameAndCommentForNonSearchFolder + "\0");
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 2: Begin to send the RopCreateFolder request.");
// Send the RopCreateFolder request to the server and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
createFolderRequest,
openedFolderHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
createFolderResponse = (RopCreateFolderResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
createFolderResponse.ReturnValue,
"if ROP succeeds, the ReturnValue of its response is 0(success)");
uint targetFolderHandle = responseSOHs[0][openFolderResponse.OutputHandleIndex];
#endregion
// Step 3: Send a RopGetContentsTable request and verify the success response.
#region RopGetContentsTable
RopGetContentsTableRequest getContentsTableRequest;
RopGetContentsTableResponse getContentsTableResponse;
getContentsTableRequest.RopId = (byte)RopId.RopGetContentsTable;
getContentsTableRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x00, which specifies the location in the Server object handle table where the handle
// for the input Server object is stored.
getContentsTableRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Set OutputHandleIndex to 0x1, which specifies the location in the Server object handle table where the handle
// for the output Server object will be stored.
getContentsTableRequest.OutputHandleIndex = TestSuiteBase.OutputHandleIndex1;
getContentsTableRequest.TableFlags = (byte)FolderTableFlags.None;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 3: Begin to send the RopGetContentsTable request.");
// Send a RopGetContentsTable request and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
getContentsTableRequest,
targetFolderHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
getContentsTableResponse = (RopGetContentsTableResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
getContentsTableResponse.ReturnValue,
"if ROP succeeds, the ReturnValue of its response is 0(success)");
uint contentsTableHandle = responseSOHs[0][getContentsTableResponse.OutputHandleIndex];
#endregion
// Step 4: Send RopSetColumns and RopAbort request and verify the success responses.
#region RopSetColumns and RopAbort
RopSetColumnsRequest setColumnsRequest;
// Create Sample ContentsTable PropertyTags by calling CreateSampleContentsTablePropertyTags2 method.
PropertyTag[] propertyTags = this.CreateSampleContentsTableWith8PropertyTags();
setColumnsRequest.RopId = (byte)RopId.RopSetColumns;
setColumnsRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x00, which specifies the location in the Server object handle table where the handle
// for the input Server object is stored.
setColumnsRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
setColumnsRequest.SetColumnsFlags = (byte)AsynchronousFlags.TblAsync;
setColumnsRequest.PropertyTagCount = (ushort)propertyTags.Length;
setColumnsRequest.PropertyTags = propertyTags;
RopAbortRequest abortRequest;
RopAbortResponse abortResponse;
abortRequest.RopId = (byte)RopId.RopAbort;
abortRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x00, which specifies the location in the Server object handle table where the handle
// for the input Server object is stored.
abortRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 4: Begin to send the RopAbort request.");
// Send a RopAbort request and verify the failure response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
abortRequest,
contentsTableHandle,
ref this.response,
ref this.rawData,
RopResponseType.FailureResponse);
abortResponse = (RopAbortResponse)response;
Site.Assert.AreNotEqual<uint>(
TestSuiteBase.SuccessReturnValue,
abortResponse.ReturnValue,
"if ROP succeeds, the ReturnValue of its response is 0(success)");
// Refer to MS-OXCTABL endnote<9>: Exchange 2010 and Exchange 2013 do not support asynchronous operations(RopAbort)
// on tables and ignore the TABL_ASYNC flags.
if (Common.IsRequirementEnabled(60201, this.Site))
{
List<ISerializable> ropRequests = new List<ISerializable>
{
// Add RopSetColumns and RopAbort requests into the request buffer.
setColumnsRequest, abortRequest
};
List<uint> inputObjects = new List<uint>
{
contentsTableHandle
};
List<IDeserializable> ropResponses = new List<IDeserializable>();
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 3: Begin to send the requests, including RopSetColumns and RopAbort requests.");
// Send the requests, including RopSetColumns and RopAbort requests.
this.responseSOHs = cropsAdapter.ProcessMutipleRops(
ropRequests,
inputObjects,
ref ropResponses,
ref this.rawData,
RopResponseType.SuccessResponse);
abortResponse = (RopAbortResponse)ropResponses[1];
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Verify MS-OXCROPS_R60201");
// Verify MS-OXCROPS requirement: MS-OXCROPS_R60201
Site.CaptureRequirementIfAreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
abortResponse.ReturnValue,
60201,
@"[In Appendix A: Product Behavior] Implementation does support asynchronous operations(RopAbort) on tables and ignore the TABL_ASYNC flags, as described in section 2.2.2.1.4. (Exchange 2007 follow this behavior.)");
}
#endregion
// Step 5: Send a RopDeleteFolder request and verify the success response.
#region Delete the folder
RopDeleteFolderRequest deleteFolderRequest;
RopDeleteFolderResponse deleteFolderResponse;
deleteFolderRequest.RopId = (byte)RopId.RopDeleteFolder;
deleteFolderRequest.LogonId = TestSuiteBase.LogonId;
// Set InputHandleIndex to 0x00, which specifies the location in the Server object handle table where the handle
// for the input Server object is stored.
deleteFolderRequest.InputHandleIndex = TestSuiteBase.InputHandleIndex0;
deleteFolderRequest.DeleteFolderFlags = (byte)DeleteFolderFlags.DeleteHardDelete;
// Set FolderId to that of the created folder, which identifies the folder to be deleted.
deleteFolderRequest.FolderId = createFolderResponse.FolderId;
// Add the debug information
Site.Log.Add(LogEntryKind.Debug, "Step 5: Begin to send the RopDeleteFolder request.");
// Send a RopDeleteFolder request and verify the success response.
this.responseSOHs = cropsAdapter.ProcessSingleRop(
deleteFolderRequest,
openedFolderHandle,
ref this.response,
ref this.rawData,
RopResponseType.SuccessResponse);
deleteFolderResponse = (RopDeleteFolderResponse)response;
Site.Assert.AreEqual<uint>(
TestSuiteBase.SuccessReturnValue,
deleteFolderResponse.ReturnValue,
"If ROP succeeds, ReturnValue of its response will be 0 (success)");
#endregion
}